From 34244dc4e31185ce2bb20c2a611b75edee39b2c1 Mon Sep 17 00:00:00 2001 From: Joshua Kraitberg Date: Mon, 27 Mar 2023 15:39:22 -0400 Subject: [PATCH] Add template support for pod labels and annotations Pod labels on the deployment are required for integration in StarlingX. TEST PLAN PASS: Chart can be deployed with new values present 1. Create test-values.yaml with podAnnotations/podLabels filled e.g. ```yaml --- podLabels: app.starlingx.io/component: platform ``` 2. cd into charts directory 3. Run: helm install --create-namespace -n oran-o2 \ -f values.yaml -f test-values.yaml oran-o2 . 4. Confirm workload pods contain the annotation/labels in test-values Issue-ID: INF-395 Signed-off-by: Joshua Kraitberg Change-Id: Ib3e44eb7e0f1ab707f50615be30d16e33b0c8af8 --- charts/templates/deployment.yaml | 9 ++++++++- charts/values.yaml | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/charts/templates/deployment.yaml b/charts/templates/deployment.yaml index a5deaf6..72e3580 100644 --- a/charts/templates/deployment.yaml +++ b/charts/templates/deployment.yaml @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Wind River Systems, Inc. +# Copyright (C) 2021-2023 Wind River Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,6 +29,13 @@ spec: metadata: labels: app: o2api + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} spec: serviceAccountName: {{ .Values.o2ims.serviceaccountname }} {{- if .Values.imagePullSecrets }} diff --git a/charts/values.yaml b/charts/values.yaml index aa6a487..0ab6f73 100644 --- a/charts/values.yaml +++ b/charts/values.yaml @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Wind River Systems, Inc. +# Copyright (C) 2021-2023 Wind River Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,6 +22,9 @@ replicaCount: 1 nameOverride: "" fullnameOverride: "" +podLabels: {} +podAnnotations: {} + # The default value "" doesn't work with binaryData, # So generate the value with: # echo "" | base64 -- 2.16.6