From c6b56f454406c834280848ffcb308f61aae77f73 Mon Sep 17 00:00:00 2001
From: Cole Walker <cole.walker@windriver.com>
Date: Wed, 10 Apr 2024 15:01:11 -0400
Subject: [PATCH] Add checksum to roll daemonset when configmap changes

Add a checksum annotation to the ptp-notification daemonset so that
updates to the config map will result in the daemonset pods to be
restarted.

Update helm chart version to 2.0.2

Test-plan:
Pass: Verify package build and install
Pass: Verify that a new package version with altered config maps
correctly restart pods
Pass: Verify application removal

Story: 2011090
Task: 49852

Depends-on: https://review.opendev.org/c/starlingx/ptp-notification-armada-app/+/915379

Signed-off-by: Cole Walker <cole.walker@windriver.com>
Change-Id: I11b767997ab207cffa68a214f7e7aa16ebd32e9a
---
 .../ptp-notification-helm/ptp-notification/Chart.yaml          | 2 +-
 .../ptp-notification/templates/daemonset.yaml                  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/Chart.yaml b/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/Chart.yaml
index 8b16b63..6f855d9 100644
--- a/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/Chart.yaml
+++ b/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/Chart.yaml
@@ -7,4 +7,4 @@ apiVersion: v1
 appVersion: "2.0"
 description: A Helm chart to deploy PTP Notification Service
 name: ptp-notification
-version: 2.0.1
+version: 2.0.2
diff --git a/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/daemonset.yaml b/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/daemonset.yaml
index cc8eeea..688b97a 100644
--- a/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/daemonset.yaml
+++ b/helm-charts/custom/ptp-notification-helm/ptp-notification-helm/ptp-notification/templates/daemonset.yaml
@@ -26,7 +26,8 @@ spec:
         release: {{ .Release.Name }}
         app.starlingx.io/component: {{ ternary "application" "platform" .Values.labels.isApplication}}
       annotations: {
-        configchecksum: {{ toYaml .Values.labels | sha256sum | trunc 63 }}
+        configchecksum: {{ toYaml .Values.labels | sha256sum | trunc 63 }},
+        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum | trunk 63}}
       }
     spec:
       imagePullSecrets: