vmware-archive / kube-prod-runtime

A standard infrastructure environment for Kubernetes
Apache License 2.0
764 stars 134 forks source link

More consistent objects hierarchy #344

Open jbianquetti-nami opened 5 years ago

jbianquetti-nami commented 5 years ago

Current objects hierarchy and naming lacks consistency (some camelcase there while mostly lowercase), e.g. for prometheus stack:

prometheus.prometheus.deploy (StatefulSet) prometheus.ingress (Ingress) prometheus.config (ConfigMap) prometheus.nodeExporter.daemonset (DaemonSet) prometheus.alertmanager.config (ConfigMap) prometheus.alertmanager.deploy (Deployment)

We should have a clearer take on this, also using a “TLD" naming after the provided stack, as monitoring.<...>, logging.<...> and ingress.<...>, e.g. for above:

monitoring.prometheus.sts (StatefulSet) monitoring.ingress (Ingress) [*] monitoring.prometheus.config (ConfigMap) monitoring.node_exporter.daemonset (DaemonSet) monitoring.alertmanager.config (ConfigMap) monitoring.alertmanager.deploy (Deployment)

anguslees commented 5 years ago

The convention I had been using (without enforcement, so there are plenty of exceptions) is:

I also found it useful to give the generic deployment (lowercase "d") a consistent name (deploy) because in many cases you can switch a Deployment (uppercase "D") with a DaemonSet or StatefulSet, and jsonnet cross-references continue to make sense (eg: the embedded podspec has the same json path in all 3 resource types). So here I chose "deploy" as the general concept rather than a specific "Deployment" type. I agree that's probably confusing.

.. So that's how we got here. We should document some of that style guide somewhere, and/or change it to some other (consistent) style. Patches very welcome to rename things for consistency.

I think your suggestion to add a top-level "functional" name is a good one, and we should do that. It doesn't scale very well to future hypothetical infrastructure that doesn't fit within a single silo however (where does "postgres" appear when it is used as both a logging and monitoring datastore?) so we should also be ready to break that rule sometimes.

For this bug: what are some actions or results you want to see before we can consider this bug closed? It would be nice to rephrase this as a more specific and achievable issue, otherwise it's just going to linger forever.

jjo commented 5 years ago

I think that the description of the bug it pretty clear: having a consistent way to traverse the jsonnet hierarchy, to ease the user on fields overriding.

+1 the convention you mention, it would be good to also use it consistently: using showtree.jsonnet from https://github.com/bitnami/kube-prod-runtime/pull/415/files#diff-30281b17ed0975937ed0f651c012eb98:

.../github.com/bitnami/kube-prod-runtime/manifests/contrib$ jsonnet showtree.jsonnet | sed -e '1d;$d' -e 's/[",:]//g' | column -t
.cert_manager.certCRD                               CustomResourceDefinition  certificates.certmanager.k8s.io
.cert_manager.clusterRole                           ClusterRole               cert-manager
.cert_manager.clusterRoleBinding                    ClusterRoleBinding        cert-manager
.cert_manager.clusterissuerCRD                      CustomResourceDefinition  clusterissuers.certmanager.k8s.io
.cert_manager.deploy                                Deployment                cert-manager                       -n  kubeprod
.cert_manager.issuerCRD                             CustomResourceDefinition  issuers.certmanager.k8s.io
.cert_manager.letsencryptProd                       ClusterIssuer             letsencrypt-prod
.cert_manager.letsencryptStaging                    ClusterIssuer             letsencrypt-staging
.cert_manager.sa                                    ServiceAccount            cert-manager                       -n  kubeprod
.edns.clusterRole                                   ClusterRole               external-dns
.edns.clusterRoleBinding                            ClusterRoleBinding        external-dns-viewer
.edns.deploy                                        Deployment                external-dns                       -n  kubeprod
.edns.gcreds                                        Secret                    external-dns-google-credentials    -n  kubeprod
.edns.sa                                            ServiceAccount            external-dns                       -n  kubeprod
.elasticsearch.disruptionBudget                     PodDisruptionBudget       elasticsearch-logging              -n  kubeprod
.elasticsearch.elasticsearchBinding                 ClusterRoleBinding        elasticsearch-logging
.elasticsearch.elasticsearchRole                    ClusterRole               elasticsearch-logging              -n  kubeprod
.elasticsearch.java_security                        ConfigMap                 java-elasticsearch-logging         -n  kubeprod
.elasticsearch.serviceAccount                       ServiceAccount            elasticsearch-logging              -n  kubeprod
.elasticsearch.sts                                  StatefulSet               elasticsearch-logging              -n  kubeprod
.elasticsearch.svc                                  Service                   elasticsearch-logging              -n  kubeprod
.fluentd_es.daemonset                               DaemonSet                 fluentd-es                         -n  kubeprod
.fluentd_es.fluentdBinding                          ClusterRoleBinding        fluentd-es
.fluentd_es.fluentdRole                             ClusterRole               fluentd-es
.fluentd_es.fluentd_es_conf                         ConfigMap                 fluentd-es                         -n  kubeprod
.fluentd_es.fluentd_es_configd                      ConfigMap                 fluentd-es-configd                 -n  kubeprod
.fluentd_es.serviceAccount                          ServiceAccount            fluentd-es                         -n  kubeprod
.grafana.datasources                                ConfigMap                 grafana-prometheus-datasource      -n  kubeprod
.grafana.grafana                                    StatefulSet               grafana                            -n  kubeprod
.grafana.ingress                                    Ingress                   grafana                            -n  kubeprod
.grafana.svc                                        Service                   grafana                            -n  kubeprod
.kibana.deploy                                      Deployment                kibana                             -n  kubeprod
.kibana.ingress                                     Ingress                   kibana-logging                     -n  kubeprod
.kibana.serviceAccount                              ServiceAccount            kibana                             -n  kubeprod
.kibana.svc                                         Service                   kibana-logging                     -n  kubeprod
.kubeprod                                           Namespace                 kubeprod
.nginx_ingress.config                               ConfigMap                 nginx-ingress                      -n  kubeprod
.nginx_ingress.controller                           Deployment                nginx-ingress-controller           -n  kubeprod
.nginx_ingress.hpa                                  HorizontalPodAutoscaler   nginx-ingress-controller           -n  kubeprod
.nginx_ingress.ingressControllerClusterRole         ClusterRole               nginx-ingress-controller
.nginx_ingress.ingressControllerClusterRoleBinding  ClusterRoleBinding        nginx-ingress-controller
.nginx_ingress.ingressControllerRole                Role                      nginx-ingress-controller           -n  kubeprod
.nginx_ingress.ingressControllerRoleBinding         RoleBinding               nginx-ingress-controller           -n  kubeprod
.nginx_ingress.serviceAccount                       ServiceAccount            nginx-ingress-controller           -n  kubeprod
.nginx_ingress.svc                                  Service                   nginx-ingress                      -n  kubeprod
.nginx_ingress.tcpconf                              ConfigMap                 tcp-services                       -n  kubeprod
.nginx_ingress.udpconf                              ConfigMap                 udp-services                       -n  kubeprod
.oauth2_proxy.deploy                                Deployment                oauth2-proxy                       -n  kubeprod
.oauth2_proxy.gcreds                                Secret                    oauth2-proxy-google-credentials    -n  kubeprod
.oauth2_proxy.hpa                                   HorizontalPodAutoscaler   oauth2-proxy                       -n  kubeprod
.oauth2_proxy.secret                                Secret                    oauth2-proxy                       -n  kubeprod
.oauth2_proxy.svc                                   Service                   oauth2-proxy                       -n  kubeprod
.prometheus.alertmanager.config                     ConfigMap                 alertmanager                       -n  kubeprod
.prometheus.alertmanager.deploy                     StatefulSet               alertmanager                       -n  kubeprod
.prometheus.alertmanager.svc                        Service                   alertmanager                       -n  kubeprod
.prometheus.ingress                                 Ingress                   prometheus                         -n  kubeprod
.prometheus.ksm.clusterRole                         ClusterRole               kube-state-metrics
.prometheus.ksm.clusterRoleBinding                  ClusterRoleBinding        kube-state-metrics
.prometheus.ksm.deploy                              Deployment                kube-state-metrics                 -n  kubeprod
.prometheus.ksm.role                                Role                      kube-state-metrics-resizer         -n  kubeprod
.prometheus.ksm.roleBinding                         RoleBinding               kube-state-metrics                 -n  kubeprod
.prometheus.ksm.serviceAccount                      ServiceAccount            kube-state-metrics                 -n  kubeprod
.prometheus.nodeExporter.daemonset                  DaemonSet                 node-exporter                      -n  kubeprod
.prometheus.prometheus.config                       ConfigMap                 prometheus                         -n  kubeprod
.prometheus.prometheus.deploy                       StatefulSet               prometheus                         -n  kubeprod
.prometheus.prometheus.prometheusBinding            ClusterRoleBinding        prometheus
.prometheus.prometheus.prometheusRole               ClusterRole               prometheus
.prometheus.prometheus.serviceAccount               ServiceAccount            prometheus                         -n  kubeprod
.prometheus.prometheus.svc                          Service                   prometheus                         -n  kubeprod
.version.config                                     ConfigMap                 release                            -n  kubeprod
.version.readerRole                                 Role                      release-reader                     -n  kubeprod
.version.readerRoleBinding                          RoleBinding               release-read-public                -n  kubeprod