From 30094ecc850d53af556b1d4c29f85bfe71442b81 Mon Sep 17 00:00:00 2001
From: Tadas Sutkaitis <tadasas@gmail.com>
Date: Mon, 18 Mar 2024 23:48:36 +0200
Subject: [PATCH] Cinder: Enable custom annotations

Enable custom annotations for pods [deployments, daemonsets]

Change-Id: I7e3605d521e6b8e9485c76a06def866fff7c6029
---
 cinder/Chart.yaml                                        | 2 +-
 cinder/templates/deployment-api.yaml                     | 1 +
 cinder/templates/deployment-backup.yaml                  | 1 +
 cinder/templates/deployment-scheduler.yaml               | 1 +
 cinder/templates/deployment-volume.yaml                  | 1 +
 .../{secret_rabbitmq.yaml => secret-rabbitmq.yaml}       | 0
 cinder/values_overrides/annotations.yaml                 | 9 +++++++++
 releasenotes/notes/cinder.yaml                           | 1 +
 8 files changed, 15 insertions(+), 1 deletion(-)
 mode change 100755 => 100644 cinder/templates/deployment-backup.yaml
 mode change 100755 => 100644 cinder/templates/deployment-volume.yaml
 rename cinder/templates/{secret_rabbitmq.yaml => secret-rabbitmq.yaml} (100%)
 create mode 100644 cinder/values_overrides/annotations.yaml

diff --git a/cinder/Chart.yaml b/cinder/Chart.yaml
index e12912441a..eb8578f11e 100644
--- a/cinder/Chart.yaml
+++ b/cinder/Chart.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
 appVersion: v1.0.0
 description: OpenStack-Helm Cinder
 name: cinder
-version: 0.3.17
+version: 0.3.18
 home: https://docs.openstack.org/cinder/latest/
 icon: https://www.openstack.org/themes/openstack/images/project-mascots/Cinder/OpenStack_Project_Cinder_vertical.png
 sources:
diff --git a/cinder/templates/deployment-api.yaml b/cinder/templates/deployment-api.yaml
index feab3ef738..9c9e16d5b6 100644
--- a/cinder/templates/deployment-api.yaml
+++ b/cinder/templates/deployment-api.yaml
@@ -43,6 +43,7 @@ spec:
 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
         configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
         configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
+{{ tuple "cinder_api" . | include "helm-toolkit.snippets.custom_pod_annotations" | indent 8 }}
 {{ dict "envAll" $envAll "podName" "cinder-api" "containerNames" (list "cinder-api" "ceph-coordination-volume-perms" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
     spec:
       serviceAccountName: {{ $serviceAccountName }}
diff --git a/cinder/templates/deployment-backup.yaml b/cinder/templates/deployment-backup.yaml
old mode 100755
new mode 100644
index 47fac408c8..365744668e
--- a/cinder/templates/deployment-backup.yaml
+++ b/cinder/templates/deployment-backup.yaml
@@ -45,6 +45,7 @@ spec:
 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
         configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
         configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
+{{ tuple "cinder_backup" . | include "helm-toolkit.snippets.custom_pod_annotations" | indent 8 }}
 {{ dict "envAll" $envAll "podName" "cinder-backup" "containerNames" (list "cinder-backup" "ceph-coordination-volume-perms" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
     spec:
       serviceAccountName: {{ $serviceAccountName }}
diff --git a/cinder/templates/deployment-scheduler.yaml b/cinder/templates/deployment-scheduler.yaml
index cf69dd1e08..03206a8d7e 100644
--- a/cinder/templates/deployment-scheduler.yaml
+++ b/cinder/templates/deployment-scheduler.yaml
@@ -43,6 +43,7 @@ spec:
 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
         configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
         configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
+{{ tuple "cinder_scheduler" . | include "helm-toolkit.snippets.custom_pod_annotations" | indent 8 }}
 {{ dict "envAll" $envAll "podName" "cinder-scheduler" "containerNames" (list "cinder-scheduler" "ceph-coordination-volume-perms" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
     spec:
       serviceAccountName: {{ $serviceAccountName }}
diff --git a/cinder/templates/deployment-volume.yaml b/cinder/templates/deployment-volume.yaml
old mode 100755
new mode 100644
index 01aea233c6..9362553679
--- a/cinder/templates/deployment-volume.yaml
+++ b/cinder/templates/deployment-volume.yaml
@@ -45,6 +45,7 @@ spec:
 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
         configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
         configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
+{{ tuple "cinder_volume" . | include "helm-toolkit.snippets.custom_pod_annotations" | indent 8 }}
 {{ dict "envAll" $envAll "podName" "cinder-volume" "containerNames" (list "cinder-volume" "ceph-coordination-volume-perms" "init-cinder-conf" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
     spec:
       serviceAccountName: {{ $serviceAccountName }}
diff --git a/cinder/templates/secret_rabbitmq.yaml b/cinder/templates/secret-rabbitmq.yaml
similarity index 100%
rename from cinder/templates/secret_rabbitmq.yaml
rename to cinder/templates/secret-rabbitmq.yaml
diff --git a/cinder/values_overrides/annotations.yaml b/cinder/values_overrides/annotations.yaml
new file mode 100644
index 0000000000..13c9aa68cd
--- /dev/null
+++ b/cinder/values_overrides/annotations.yaml
@@ -0,0 +1,9 @@
+---
+annotations:
+  pod:
+    default:
+      custom.tld/key: "value"
+      custom.tld/key2: "value2"
+    cinder_api:
+      another.tld/foo: "bar"
+...
diff --git a/releasenotes/notes/cinder.yaml b/releasenotes/notes/cinder.yaml
index a638885e3b..255eb036b8 100644
--- a/releasenotes/notes/cinder.yaml
+++ b/releasenotes/notes/cinder.yaml
@@ -67,4 +67,5 @@ cinder:
   - 0.3.15 Add 2023.2 Ubuntu Jammy overrides
   - 0.3.16 Update Ceph images to Jammy and Reef 18.2.1
   - 0.3.17 Use uWSGI for API service
+  - 0.3.18 Enable custom annotations for Openstack pods
 ...