Add template support for pod labels and annotations 88/10788/2 2.0.1
authorJoshua Kraitberg <joshua.kraitberg@windriver.com>
Mon, 27 Mar 2023 19:39:22 +0000 (15:39 -0400)
committerJoshua Kraitberg <joshua.kraitberg@windriver.com>
Tue, 28 Mar 2023 13:44:15 +0000 (13:44 +0000)
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 <joshua.kraitberg@windriver.com>
Change-Id: Ib3e44eb7e0f1ab707f50615be30d16e33b0c8af8

charts/templates/deployment.yaml
charts/values.yaml

index a5deaf6..72e3580 100644 (file)
@@ -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 }}
index aa6a487..0ab6f73 100644 (file)
@@ -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