[CPS] Fix statefulset upgrade 94/128394/2
authorBruno Sakoto <bruno.sakoto@bell.ca>
Fri, 8 Apr 2022 10:27:06 +0000 (06:27 -0400)
committerLukasz Rajewski <lukasz.rajewski@orange.com>
Mon, 11 Apr 2022 15:04:12 +0000 (15:04 +0000)
Remove helm chart label from timescaledb statefulset fields for which
updates are forbidden

Issue-ID: CPS-857
Change-Id: I024ef0cd8c23c477e1d43a1a4ee9c5d6d1743f3b
Signed-off-by: Bruno Sakoto <bruno.sakoto@bell.ca>
kubernetes/common/common/templates/_labels.tpl
kubernetes/common/common/templates/_storage.tpl
kubernetes/common/timescaledb/templates/statefulset.yaml

index da8f00f..993fb7d 100644 (file)
@@ -1,5 +1,6 @@
 {{/*
 # Copyright © 2019 Orange
+# Modifications Copyright (C) 2022 Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -25,7 +26,9 @@ The function takes several arguments (inside a dictionary):
 {{- define "common.labels" -}}
 {{- $dot := default . .dot -}}
 app.kubernetes.io/name: {{ include "common.name" $dot }}
+{{ if not .ignoreHelmChart }}
 helm.sh/chart: {{ include "common.chart" $dot }}
+{{- end }}
 app.kubernetes.io/instance: {{ include "common.release" $dot }}
 app.kubernetes.io/managed-by: {{ $dot.Release.Service }}
 {{ if .labels }}
@@ -67,7 +70,7 @@ app.kubernetes.io/instance: {{ include "common.release" $dot }}
 {{- $annotations := default (dict) .annotations -}}
 name: {{ include "common.fullname" (dict "suffix" $suffix "dot" $dot )}}
 namespace: {{ include "common.namespace" $dot }}
-labels: {{- include "common.labels" (dict "labels" $labels "dot" $dot ) | nindent 2 }}
+labels: {{- include "common.labels" (dict "labels" $labels "ignoreHelmChart" .ignoreHelmChart "dot" $dot ) | nindent 2 }}
 {{- if $annotations }}
 annotations:  {{- include "common.tplValue" (dict "value" $annotations "context" $dot) | nindent 2}}
 {{- end }}
@@ -97,6 +100,6 @@ matchLabels: {{- include "common.matchLabels" (dict "matchLabels" $matchLabels "
 {{- if $dot.Values.podAnnotations }}
 annotations: {{- include "common.tplValue" (dict "value" $dot.Values.podAnnotations "context" $dot) | nindent 2 }}
 {{- end }}
-labels: {{- include "common.labels" (dict "labels" $labels "dot" $dot) | nindent 2 }}
+labels: {{- include "common.labels" (dict "labels" $labels "ignoreHelmChart" .ignoreHelmChart "dot" $dot) | nindent 2 }}
 name: {{ include "common.name" $dot }}
 {{- end -}}
index 2114d67..a7819be 100644 (file)
@@ -1,5 +1,6 @@
 {{/*
 # Copyright © 2019 Amdocs, Bell Canada, Orange
+# Modifications Copyright (C) 2022 Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -281,7 +282,7 @@ apiVersion: v1
 {{- $persistenceInfos := default $dot.Values.persistence .persistenceInfos -}}
 {{- $suffix := default "data" .suffix -}}
 {{- $metadata_suffix := ternary "" $suffix (eq $suffix "data") -}}
-metadata: {{- include "common.resourceMetadata" (dict "dot" $dot "suffix" $metadata_suffix "annotations" $persistenceInfos.annotations) | nindent 2 }}
+metadata: {{- include "common.resourceMetadata" (dict "dot" $dot "suffix" $metadata_suffix "annotations" $persistenceInfos.annotations "ignoreHelmChart" .ignoreHelmChart) | nindent 2 }}
 spec:
   accessModes:
   - {{ $persistenceInfos.accessMode }}
index a3d942f..2e83c5b 100644 (file)
@@ -1,6 +1,6 @@
 {{/*
 # ============LICENSE_START=======================================================
-#  Copyright (c) 2021 Bell Canada.
+#  Copyright (c) 2021-2022 Bell Canada.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@ spec:
   selector: {{- include "common.selectors" . | nindent 4 }}
   serviceName: {{ include "common.servicename" . }}
   template:
-    metadata: {{- include "common.templateMetadata" . | nindent 6 }}
+    metadata: {{- include "common.templateMetadata" (dict "ignoreHelmChart" true "dot" . ) | nindent 6 }}
     spec:
       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }}
       {{ include "common.podSecurityContext" . | indent 10 | trim}}
@@ -99,5 +99,5 @@ spec:
   {{- end }}
  {{if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
   volumeClaimTemplates:
-    - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "data" "persistenceInfos" .Values.persistence) | indent 6 | trim }}
+    - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "data" "persistenceInfos" .Values.persistence "ignoreHelmChart" true) | indent 6 | trim }}
 {{- end }}