Add platform label to pods in stx-openstack

Add the label app.starlingx.io/component to the pods and allow the
value to be updated via "system helm-override-update". This change
also ensures that when changing the label value and reapplying the
app, the pod is restarted.

The value of the label can only be "platform" or "application", if
the value is different from that, the label will not be applied.
By default, all pods start with the value platform.

Patches for the openstack-helm and openstack-helm-infra
repositories with the same purpose will be created later.

Test Plan:
PASS: upload/apply/remove/delete/update stx-openstack
PASS: Install stx-openstack and check if pods have the label
'app.starlingx.io/component' with the value 'platform'.
PASS: After updating the isApplication variable to true for
nova-api-proxy chart using "system update-helm-override" and
reapplying stx-openstack, the pods were restarted and the label
was successfully changed.
PASS: If "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: 49294

Change-Id: I984be94a42cc302357d0b2202be1425e80a52505
Signed-off-by: David Barbosa Bastos <david.barbosabastos@windriver.com>
This commit is contained in:
dbarbosa 2023-12-18 20:28:29 -03:00
parent 2957dfdb0b
commit a6401e831d
13 changed files with 25 additions and 0 deletions

View File

@ -32,7 +32,10 @@ spec:
template:
metadata:
labels:
app.starlingx.io/component: {{ ternary "application" "platform" .Values.labels.isApplication }}
{{ tuple $envAll "clients" "clients" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
configchecksum: {{ toYaml .Values.labels.isApplication | sha256sum | trunc 63 }}
spec:
{{ dict "envAll" . "application" "clients" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
serviceAccountName: {{ $serviceAccountName }}

View File

@ -24,6 +24,7 @@ images:
- image_repo_sync
labels:
isApplication: false
openstack_clients:
node_selector_key: openstack-control-plane
node_selector_value: enabled

View File

@ -30,7 +30,10 @@ spec:
template:
metadata:
labels:
app.starlingx.io/component: {{ ternary "application" "platform" .Values.labels.isApplication }}
{{ tuple $envAll $serviceName "ks-config" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
configchecksum: {{ toYaml .Values.labels.isApplication | sha256sum | trunc 63 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
restartPolicy: OnFailure

View File

@ -11,6 +11,7 @@
replicaCount: 1
labels:
isApplication: false
dcdbsync:
node_selector_key: openstack-control-plane
node_selector_value: enabled

View File

@ -41,6 +41,9 @@ spec:
annotations:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
labels:
app.starlingx.io/component: {{ ternary "application" "platform" .Values.labels.isApplication }}
annotations:
configchecksum: {{ toYaml .Values.labels.isApplication | sha256sum | trunc 63 }}
{{ tuple $envAll "garbd" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
shareProcessNamespace: true

View File

@ -85,6 +85,7 @@ images:
- image_repo_sync
labels:
isApplication: false
server:
node_selector_key: openstack-compute-node
node_selector_value: enabled

View File

@ -30,10 +30,12 @@ spec:
template:
metadata:
labels:
app.starlingx.io/component: {{ ternary "application" "platform" .Values.labels.isApplication }}
{{ tuple $envAll "dcorch" "keystone-api-proxy" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
configchecksum: {{ toYaml .Values.labels.isApplication | sha256sum | trunc 63 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
affinity:

View File

@ -26,7 +26,10 @@ spec:
template:
metadata:
labels:
app.starlingx.io/component: {{ ternary "application" "platform" .Values.labels.isApplication }}
{{ tuple $envAll $serviceName "ks-endpoints" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
configchecksum: {{ toYaml .Values.labels.isApplication | sha256sum | trunc 63 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
restartPolicy: OnFailure

View File

@ -11,6 +11,7 @@
replicaCount: 1
labels:
isApplication: false
keystone_api_proxy:
node_selector_key: openstack-control-plane
node_selector_value: enabled

View File

@ -30,10 +30,12 @@ spec:
template:
metadata:
labels:
app.starlingx.io/component: {{ ternary "application" "platform" .Values.labels.isApplication }}
{{ tuple $envAll "nova" "api-proxy" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
configchecksum: {{ toYaml .Values.labels.isApplication | sha256sum | trunc 63 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
affinity:

View File

@ -11,6 +11,7 @@
replicaCount: 1
labels:
isApplication: false
api_proxy:
node_selector_key: openstack-control-plane
node_selector_value: enabled

View File

@ -30,7 +30,10 @@ spec:
template:
metadata:
labels:
app.starlingx.io/component: {{ ternary "application" "platform" .Values.labels.isApplication }}
{{ tuple $envAll .Chart.Name $daemonset | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
configchecksum: {{ toYaml .Values.labels.isApplication | sha256sum | trunc 63 }}
spec:
serviceAccountName: {{ $daemonset | quote }}
nodeSelector:

View File

@ -22,6 +22,7 @@ images:
- dep_check
labels:
isApplication: false
agent:
pci_irq_affinity_agent:
node_selector_key: openstack-compute-node