elastic/cloud-on-k8s

Some of the labelling is inconsistent

Open

#3,044 opened on May 12, 2020

 (2 comments) (0 reactions) (0 assignees)Go (788 forks)auto 404
>enhancementdiscussgood first issue

Repository metrics

Stars
 (2,841 stars)
PR merge metrics
 (PR metrics pending)

Description

It seems to me that we are inconsistent with the way we label resources throughout all the resources we create. I don't think we have documented it either.

$ kubectl tree es es-apm-sample | tail -n +2 | tr -d '├─└' | tr -s ' ' | cut -f 2 -d' ' | xargs -I {} sh -c "echo {}; kubectl get {} -o json | jq .metadata.labels"
Elasticsearch/es-apm-sample
null
ConfigMap/es-apm-sample-es-scripts
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample-es-scripts"
}
ConfigMap/es-apm-sample-es-unicast-hosts
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
PersistentVolumeClaim/elasticsearch-data-es-apm-sample-es-default-0
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "elasticsearch.k8s.elastic.co/statefulset-name": "es-apm-sample-es-default"
}
PersistentVolumeClaim/elasticsearch-data-es-apm-sample-es-default-1
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "elasticsearch.k8s.elastic.co/statefulset-name": "es-apm-sample-es-default"
}
PersistentVolumeClaim/elasticsearch-data-es-apm-sample-es-default-2
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "elasticsearch.k8s.elastic.co/statefulset-name": "es-apm-sample-es-default"
}
PodDisruptionBudget/es-apm-sample-es-default
{
  "common.k8s.elastic.co/template-hash": "2199531887",
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/default-apm-apm-sample-apm-user
{
  "apmassociation.k8s.elastic.co/name": "apm-apm-sample",
  "apmassociation.k8s.elastic.co/namespace": "default",
  "common.k8s.elastic.co/type": "user",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/default-kb-apm-sample-kibana-user
{
  "common.k8s.elastic.co/type": "user",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "kibanaassociation.k8s.elastic.co/name": "kb-apm-sample",
  "kibanaassociation.k8s.elastic.co/namespace": "default"
}
Secret/es-apm-sample-es-ca-certs-public
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/es-apm-sample-es-default-es-config
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "elasticsearch.k8s.elastic.co/statefulset-name": "es-apm-sample-es-default"
}
Secret/es-apm-sample-es-elastic-user
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "eck.k8s.elastic.co/credentials": "true",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/es-apm-sample-es-http-ca-internal
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/es-apm-sample-es-http-certs-internal
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/es-apm-sample-es-http-certs-public
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/es-apm-sample-es-internal-users
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "eck.k8s.elastic.co/credentials": "true",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/es-apm-sample-es-remote-ca
{
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/es-apm-sample-es-transport-ca-internal
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/es-apm-sample-es-transport-certificates
{
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/es-apm-sample-es-xpack-file-realm
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Service/es-apm-sample-es-default
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "elasticsearch.k8s.elastic.co/statefulset-name": "es-apm-sample-es-default"
}
Service/es-apm-sample-es-http
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Service/es-apm-sample-es-transport
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
StatefulSet/es-apm-sample-es-default
{
  "common.k8s.elastic.co/template-hash": "3104818528",
  "common.k8s.elastic.co/type": "elasticsearch",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "elasticsearch.k8s.elastic.co/statefulset-name": "es-apm-sample-es-default"
}
ControllerRevision/es-apm-sample-es-default-646744fdd6
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "controller.kubernetes.io/hash": "646744fdd6",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "elasticsearch.k8s.elastic.co/config-hash": "3887705278",
  "elasticsearch.k8s.elastic.co/http-scheme": "https",
  "elasticsearch.k8s.elastic.co/node-data": "true",
  "elasticsearch.k8s.elastic.co/node-ingest": "true",
  "elasticsearch.k8s.elastic.co/node-master": "true",
  "elasticsearch.k8s.elastic.co/node-ml": "true",
  "elasticsearch.k8s.elastic.co/statefulset-name": "es-apm-sample-es-default",
  "elasticsearch.k8s.elastic.co/version": "7.6.0"
}
Pod/es-apm-sample-es-default-0
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "controller-revision-hash": "es-apm-sample-es-default-646744fdd6",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "elasticsearch.k8s.elastic.co/config-hash": "3887705278",
  "elasticsearch.k8s.elastic.co/http-scheme": "https",
  "elasticsearch.k8s.elastic.co/node-data": "true",
  "elasticsearch.k8s.elastic.co/node-ingest": "true",
  "elasticsearch.k8s.elastic.co/node-master": "true",
  "elasticsearch.k8s.elastic.co/node-ml": "true",
  "elasticsearch.k8s.elastic.co/statefulset-name": "es-apm-sample-es-default",
  "elasticsearch.k8s.elastic.co/version": "7.6.0",
  "statefulset.kubernetes.io/pod-name": "es-apm-sample-es-default-0"
}
Pod/es-apm-sample-es-default-1
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "controller-revision-hash": "es-apm-sample-es-default-646744fdd6",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "elasticsearch.k8s.elastic.co/config-hash": "3887705278",
  "elasticsearch.k8s.elastic.co/http-scheme": "https",
  "elasticsearch.k8s.elastic.co/node-data": "true",
  "elasticsearch.k8s.elastic.co/node-ingest": "true",
  "elasticsearch.k8s.elastic.co/node-master": "true",
  "elasticsearch.k8s.elastic.co/node-ml": "true",
  "elasticsearch.k8s.elastic.co/statefulset-name": "es-apm-sample-es-default",
  "elasticsearch.k8s.elastic.co/version": "7.6.0",
  "statefulset.kubernetes.io/pod-name": "es-apm-sample-es-default-1"
}
Pod/es-apm-sample-es-default-2
{
  "common.k8s.elastic.co/type": "elasticsearch",
  "controller-revision-hash": "es-apm-sample-es-default-646744fdd6",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "elasticsearch.k8s.elastic.co/config-hash": "3887705278",
  "elasticsearch.k8s.elastic.co/http-scheme": "https",
  "elasticsearch.k8s.elastic.co/node-data": "true",
  "elasticsearch.k8s.elastic.co/node-ingest": "true",
  "elasticsearch.k8s.elastic.co/node-master": "true",
  "elasticsearch.k8s.elastic.co/node-ml": "true",
  "elasticsearch.k8s.elastic.co/statefulset-name": "es-apm-sample-es-default",
  "elasticsearch.k8s.elastic.co/version": "7.6.0",
  "statefulset.kubernetes.io/pod-name": "es-apm-sample-es-default-2"
}
$ kubectl tree kibana kibana-apm-sample | tail -n +2 | tr -d '├─└' | tr -s ' ' | cut -f 2 -d' ' | xargs -I {} sh -c "echo {}; kubectl get {} -o json | jq .metadata.labels"
Kibana/kb-apm-sample
null
Deployment/kb-apm-sample-kb
{
  "common.k8s.elastic.co/template-hash": "1486650515",
  "common.k8s.elastic.co/type": "kibana",
  "kibana.k8s.elastic.co/name": "kb-apm-sample"
}
ReplicaSet/kb-apm-sample-kb-5dd6c8bb6d
{
  "common.k8s.elastic.co/type": "kibana",
  "kibana.k8s.elastic.co/config-checksum": "63999b178af07cf8351bb913696256a8675315d8ca9e38e28e8b21e4",
  "kibana.k8s.elastic.co/name": "kb-apm-sample",
  "kibana.k8s.elastic.co/version": "7.6.0",
  "pod-template-hash": "5dd6c8bb6d"
}
Pod/kb-apm-sample-kb-5dd6c8bb6d-t975v
{
  "common.k8s.elastic.co/type": "kibana",
  "kibana.k8s.elastic.co/config-checksum": "63999b178af07cf8351bb913696256a8675315d8ca9e38e28e8b21e4",
  "kibana.k8s.elastic.co/name": "kb-apm-sample",
  "kibana.k8s.elastic.co/version": "7.6.0",
  "pod-template-hash": "5dd6c8bb6d"
}
Secret/kb-apm-sample-kb-config
{
  "eck.k8s.elastic.co/credentials": "true",
  "kibana.k8s.elastic.co/name": "kb-apm-sample"
}
Secret/kb-apm-sample-kb-es-ca
{
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "kibanaassociation.k8s.elastic.co/name": "kb-apm-sample",
  "kibanaassociation.k8s.elastic.co/namespace": "default"
}
Secret/kb-apm-sample-kb-http-ca-internal
{
  "apm.k8s.elastic.co/name": "kb-apm-sample",
  "common.k8s.elastic.co/type": "apm-server"
}
Secret/kb-apm-sample-kb-http-certs-internal
{
  "apm.k8s.elastic.co/name": "kb-apm-sample",
  "common.k8s.elastic.co/type": "apm-server"
}
Secret/kb-apm-sample-kb-http-certs-public
{
  "apm.k8s.elastic.co/name": "kb-apm-sample",
  "common.k8s.elastic.co/type": "apm-server"
}
Secret/kb-apm-sample-kibana-user
{
  "eck.k8s.elastic.co/credentials": "true",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample",
  "kibanaassociation.k8s.elastic.co/name": "kb-apm-sample",
  "kibanaassociation.k8s.elastic.co/namespace": "default"
}
Service/kb-apm-sample-kb-http
{
  "common.k8s.elastic.co/type": "kibana",
  "kibana.k8s.elastic.co/name": "kb-apm-sample"
}
$ kubectl tree apm apm-apm-sample | tail -n +2 | tr -d '├─└│' | tr -s ' ' | cut -f 2 -d' ' | xargs -I {} sh -
c "echo {}; kubectl get {} -o json | jq .metadata.labels"
ApmServer/apm-apm-sample
null
Deployment/apm-apm-sample-apm-server
{
  "apm.k8s.elastic.co/name": "apm-apm-sample",
  "common.k8s.elastic.co/template-hash": "4153132823",
  "common.k8s.elastic.co/type": "apm-server"
}
ReplicaSet/apm-apm-sample-apm-server-77f7bf59fd
{
  "apm.k8s.elastic.co/config-file-checksum": "7e9fbd9cc5ebaecd8077889add36ffee5c47e4e40e63d478aa9fed27",
  "apm.k8s.elastic.co/es-ca-file-checksum": "e6d72af4f20ed6aeea0a867396e930abfcfbbfd9888828072bd832d0",
  "apm.k8s.elastic.co/name": "apm-apm-sample",
  "common.k8s.elastic.co/type": "apm-server",
  "pod-template-hash": "77f7bf59fd"
}
Pod/apm-apm-sample-apm-server-77f7bf59fd-5ng5z
{
  "apm.k8s.elastic.co/config-file-checksum": "7e9fbd9cc5ebaecd8077889add36ffee5c47e4e40e63d478aa9fed27",
  "apm.k8s.elastic.co/es-ca-file-checksum": "e6d72af4f20ed6aeea0a867396e930abfcfbbfd9888828072bd832d0",
  "apm.k8s.elastic.co/name": "apm-apm-sample",
  "common.k8s.elastic.co/type": "apm-server",
  "pod-template-hash": "77f7bf59fd"
}
Secret/apm-apm-sample-apm-config
{
  "apm.k8s.elastic.co/name": "apm-apm-sample",
  "common.k8s.elastic.co/type": "apm-server"
}
Secret/apm-apm-sample-apm-es-ca
{
  "apmassociation.k8s.elastic.co/name": "apm-apm-sample",
  "apmassociation.k8s.elastic.co/namespace": "default",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Secret/apm-apm-sample-apm-http-ca-internal
{
  "apm.k8s.elastic.co/name": "apm-apm-sample",
  "common.k8s.elastic.co/type": "apm-server"
}
Secret/apm-apm-sample-apm-http-certs-internal
{
  "apm.k8s.elastic.co/name": "apm-apm-sample",
  "common.k8s.elastic.co/type": "apm-server"
}
Secret/apm-apm-sample-apm-http-certs-public
{
  "apm.k8s.elastic.co/name": "apm-apm-sample",
  "common.k8s.elastic.co/type": "apm-server"
}
Secret/apm-apm-sample-apm-token
{
  "apm.k8s.elastic.co/name": "apm-apm-sample",
  "common.k8s.elastic.co/type": "apm-server",
  "eck.k8s.elastic.co/credentials": "true"
}
Secret/apm-apm-sample-apm-user
{
  "apmassociation.k8s.elastic.co/name": "apm-apm-sample",
  "apmassociation.k8s.elastic.co/namespace": "default",
  "eck.k8s.elastic.co/credentials": "true",
  "elasticsearch.k8s.elastic.co/cluster-name": "es-apm-sample"
}
Service/apm-apm-sample-apm-http
{
  "apm.k8s.elastic.co/name": "apm-apm-sample",
  "common.k8s.elastic.co/type": "apm-server"
}

I listed some inconsistencies I'm seeing below.

  1. Secret/es-apm-sample-es-remote-ca doesn't have a type
  2. Secret/es-apm-sample-es-transport-certificates doesn't have a type
  3. We label some users with "eck.k8s.elastic.co/credentials": "true" and some with "common.k8s.elastic.co/type": "user"
  4. ES uses .../cluster-name while everything else uses just .../name
  5. Secret/kb-apm-sample-kb-config doesn't have a type
  6. Secret/kb-apm-sample-kb-es-ca doesn't have a type
  7. Secret/apm-apm-sample-apm-es-ca doesn't have a type
  8. APM Pods don't have version label

We might address only some of the above, but it would be good to document where/how we label.

Contributor guide