Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8SPXC-1378: add labels to every resource #1823

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

pooknull
Copy link
Contributor

@pooknull pooknull commented Sep 19, 2024

K8SPXC-1378 Powered by Pull Request Badge

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
Name apiVersion kind Field Changes
<cluster-name>-pxc

<cluster-name>-haproxy

<cluster-name>-proxysql
apps/v1 StatefulSet .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
v1 Service .spec.selector + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
+ app.kubernetes.io/part-of: percona-xtradb-cluster
xb-<pxc-backup-name> batch/v1 Job .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> batch/v1 Job .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> v1 Pod .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
policy/v1 PodDisruptionBudget .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
cert-manager.io/v1 Certificate .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
cert-manager.io/v1 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
v1 ConfigMap .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:

  • Labels will not be changed for StatefulSets created with crVersion: 1.15.0 or below, because it's not allowed to update .spec.volumeClaimTemplates for StatefulSets
  • Previously restore job used labels from .spec.pxc.labels. In this PR operator adds default labels and uses labels from .spec.backup.storages[].labels instead

This PR also resolves K8SPXC-1230

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?
  • Are OpenShift compare files changed for E2E tests (compare/*-oc.yml)?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PXC version?
  • Does the change support oldest and newest supported Kubernetes version?

@pull-request-size pull-request-size bot added size/XL 500-999 lines size/XXL 1000+ lines and removed size/XL 500-999 lines labels Sep 19, 2024
@JNKPercona
Copy link
Collaborator

Test name Status
affinity-8-0 passed
auto-tuning-8-0 passed
cross-site-8-0 passed
demand-backup-cloud-8-0 passed
demand-backup-encrypted-with-tls-8-0 passed
demand-backup-8-0 passed
haproxy-5-7 passed
haproxy-8-0 passed
init-deploy-5-7 passed
init-deploy-8-0 passed
limits-8-0 passed
monitoring-2-0-8-0 passed
one-pod-5-7 passed
one-pod-8-0 passed
pitr-8-0 passed
pitr-gap-errors-8-0 passed
proxy-protocol-8-0 passed
proxysql-sidecar-res-limits-8-0 passed
pvc-resize-5-7 passed
pvc-resize-8-0 passed
recreate-8-0 passed
restore-to-encrypted-cluster-8-0 passed
scaling-proxysql-8-0 passed
scaling-8-0 passed
scheduled-backup-5-7 passed
scheduled-backup-8-0 passed
security-context-8-0 passed
smart-update1-8-0 passed
smart-update2-8-0 passed
storage-8-0 passed
tls-issue-cert-manager-ref-8-0 passed
tls-issue-cert-manager-8-0 passed
tls-issue-self-8-0 passed
upgrade-consistency-8-0 passed
upgrade-haproxy-5-7 passed
upgrade-haproxy-8-0 passed
upgrade-proxysql-5-7 passed
upgrade-proxysql-8-0 passed
users-5-7 passed
users-8-0 passed
validation-hook-8-0 passed
We run 41 out of 41

commit: f7282fc
image: perconalab/percona-xtradb-cluster-operator:PR-1823-f7282fc3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL 1000+ lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants