K8SPXC-1378: add labels to every resource #1823
Open
+2,288
−660
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://perconadev.atlassian.net/browse/K8SPXC-1378
DESCRIPTION
This PR adds new labels to all resources created by the operator. All changes are listed in the table below
Table of label changes
<cluster-name>-pxc
<cluster-name>-haproxy
<cluster-name>-proxysql
.spec.volumeClaimTemplates[].metadata.labels
+ app.kubernetes.io/component: <component-name>
+ app.kubernetes.io/instance: <cluster-name>
+ app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
+ app.kubernetes.io/name: percona-xtradb-cluster
+ app.kubernetes.io/part-of: percona-xtradb-cluster
<cluster-name>-pxc
<cluster-name>-pxc-unready
<cluster-name>-haproxy
<cluster-name>-haproxy-replicas
<cluster-name>-proxysql
<cluster-name>-proxysql-unready
.spec.selector
+ app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
+ app.kubernetes.io/part-of: percona-xtradb-cluster
xb-<pxc-backup-name>
.metadata.labels
.spec.selector.matchLabels
.spec.template.metadata.labels
- backup-name: <backup-name>
- cluster: <cluster-name>
- job-name: xb-<backup-name>
- type: xtrabackup
+ app.kubernetes.io/instance: <cluster-name>
+ app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
+ app.kubernetes.io/name: percona-xtradb-cluster
+ app.kubernetes.io/part-of: percona-xtradb-cluster
+ percona.com/backup-job-name: xb-<backup-name>
+ percona.com/backup-name: <backup-name>
+ percona.com/backup-type: xtrabackup
+ percona.com/cluster: <cluster-name>
restore-job-<pxc-restore-name>-<cluster-name>
.metadata.labels
.spec.template.metadata.labels
+ app.kubernetes.io/instance: <cluster-name>
+ app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
+ app.kubernetes.io/name: percona-xtradb-cluster
+ app.kubernetes.io/part-of: percona-xtradb-cluster
+ percona.com/restore-job-name: restore-job-<pxc-restore-name>-<cluster-name>
restore-src-<pxc-restore-name>-<cluster-name>
.metadata.labels
- name: restore-src-<pxc-restore-name>-<cluster-name>
+ app.kubernetes.io/instance: <cluster-name>
+ app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
+ app.kubernetes.io/name: percona-xtradb-cluster
+ app.kubernetes.io/part-of: percona-xtradb-cluster
+ percona.com/restore-svc-name: <pxc-restore-name>-<cluster-name>
<cluster-name>-pxc
<cluster-name>-haproxy
<cluster-name>-proxysql
.metadata.labels
+ app.kubernetes.io/component: <component-name>
+ app.kubernetes.io/instance: <cluster-name>
+ app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
+ app.kubernetes.io/name: percona-xtradb-cluster
+ app.kubernetes.io/part-of: percona-xtradb-cluster
<cluster-name>-ssl
<cluster-name>-ssl-internal
.metadata.labels
+ app.kubernetes.io/instance: <cluster-name>
+ app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
+ app.kubernetes.io/name: percona-xtradb-cluster
+ app.kubernetes.io/part-of: percona-xtradb-cluster
<cluster-name>-pxc-issuer
<cluster-name>-pxc-ca-issuer
.metadata.labels
+ app.kubernetes.io/instance: <cluster-name>
+ app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
+ app.kubernetes.io/name: percona-xtradb-cluster
+ app.kubernetes.io/part-of: percona-xtradb-cluster
<cluster-name>-pxc
<cluster-name>-proxysql
<cluster-name>-haproxy
<cluster-name>-logcollector
.metadata.labels
+ app.kubernetes.io/instance: <cluster-name>
+ app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
+ app.kubernetes.io/name: percona-xtradb-cluster
+ app.kubernetes.io/part-of: percona-xtradb-cluster
Important notes:
StatefulSet
s created withcrVersion: 1.15.0
or below, because it's not allowed to update.spec.volumeClaimTemplates
forStatefulSet
s.spec.pxc.labels
. In this PR operator adds default labels and uses labels from.spec.backup.storages[].labels
insteadThis PR also resolves
K8SPXC-1230
CHECKLIST
Jira
Needs Doc
) and QA (Needs QA
)?Tests
compare/*-oc.yml
)?Config/Logging/Testability