From b7b3207afaff51445d86fb05db34d6ea35229927 Mon Sep 17 00:00:00 2001 From: dbarbosa Date: Thu, 23 Nov 2023 13:53:04 -0300 Subject: [PATCH] Add label platform/application to pods Add support to 'app.starlingx.io/component' to be overwritten by user override, with possible values being 'platform' and 'application'. With 'platform' being the default value. This change will also restart the pods if the label changes. Test Plan: PASS: upload/apply/remove/delete/update ptp-notification. PASS: Install ptp-notification and check if pods have the label 'app.starlingx.io/component' with the value 'platform'. PASS: Change the value of the labels.isApplication to true using "system helm-override-update" and check, if after re-applying the app, the label 'app.starlingx.component' changes to application' in the pods. PASS: Use 'system application-apply ptp-notification' when there is a change to be applied to 'app.starlingx.component' and verify if the pod is restarted. PASS: If "labels.isApplication" is updated with a value other than true or false, the label on the pods "app.starlingx.io/component" will not change. Story: 2010612 Task: 49132 Change-Id: I2f8586cbb7ceac75892af41b7120db6c189cdafa Signed-off-by: David Barbosa Bastos --- .../helm-charts/ptp-notification/templates/daemonset.yaml | 4 ++++ .../helm-charts/ptp-notification/templates/deployment.yaml | 4 ++++ .../helm-charts/ptp-notification/values.yaml | 3 +++ 3 files changed, 11 insertions(+) diff --git a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/daemonset.yaml b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/daemonset.yaml index d8badfa..3e2b940 100644 --- a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/daemonset.yaml +++ b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/daemonset.yaml @@ -24,6 +24,10 @@ spec: labels: app: {{ include "notification.name" . }} release: {{ .Release.Name }} + app.starlingx.io/component: {{ ternary "application" "platform" .Values.labels.isApplication}} + annotations: { + configchecksum: {{ toYaml .Values.labels | sha256sum | trunc 63 }} + } spec: imagePullSecrets: - name: {{ .Values.ptptracking.imagePullSecrets}} diff --git a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/deployment.yaml b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/deployment.yaml index 7a5a7d0..d181101 100644 --- a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/deployment.yaml +++ b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/templates/deployment.yaml @@ -20,6 +20,10 @@ spec: metadata: labels: app: rabbitmq + app.starlingx.io/component: {{ ternary "application" "platform" .Values.labels.isApplication}} + annotations: { + configchecksum: {{ toYaml .Values.labels | sha256sum | trunc 63 }} + } spec: imagePullSecrets: - name: {{ .Values.registration.imagePullSecrets }} diff --git a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/values.yaml b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/values.yaml index d0e0f9e..727c39f 100644 --- a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/values.yaml +++ b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/values.yaml @@ -19,6 +19,9 @@ fullnameOverride: "" global: namespace: notification +labels: + isApplication: false + registration: imagePullSecrets: default-registry-key image: