From 66fa48f04d926848a37f5fbb7689cf4b114cb3ba Mon Sep 17 00:00:00 2001 From: Pedro Henrique Linhares Date: Tue, 6 Apr 2021 21:45:28 -0300 Subject: [PATCH] Update helm charts config maps after sx-dx migration with new CEPH monitors This commit adds annotations that allows config maps to be recreated after ceph monitor IP changes due to DX migration so that existing StorageClasses can get a reference to the correct monitor. StorageClasses and provisioners are recreated during platform-integ-apps auto re-apply. Story: 2008587 Task: 42242 Signed-off-by: Pedro Linhares Depends-On: https://review.opendev.org/c/starlingx/stx-puppet/+/783727 Change-Id: I9cedc70326e92796f03520deed7f0857e119257f --- .../templates/configmap-ceph-etc.yaml | 30 +++++++++++++++++++ .../helm-charts/ceph-pools-audit/values.yaml | 5 ++-- .../templates/config-provisioner.yaml | 7 +++-- .../templates/pre-install-check-ceph.yaml | 9 ++++-- 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 stx-platform-helm/stx-platform-helm/helm-charts/ceph-pools-audit/templates/configmap-ceph-etc.yaml diff --git a/stx-platform-helm/stx-platform-helm/helm-charts/ceph-pools-audit/templates/configmap-ceph-etc.yaml b/stx-platform-helm/stx-platform-helm/helm-charts/ceph-pools-audit/templates/configmap-ceph-etc.yaml new file mode 100644 index 0000000..1cdcc35 --- /dev/null +++ b/stx-platform-helm/stx-platform-helm/helm-charts/ceph-pools-audit/templates/configmap-ceph-etc.yaml @@ -0,0 +1,30 @@ +{{/* +# +# Copyright (c) 2021 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +*/}} + +{{- if .Values.manifests.configmap_ceph_conf }} +{{- $envAll := . }} +{{- $ceph := $envAll.Values.conf.ceph }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ $envAll.Values.ceph_client.configmap }} + namespace: {{ $envAll.Release.namespace }} + labels: + app: ceph-pools-audit + annotations: + "helm.sh/hook": "pre-upgrade, pre-install" + "helm.sh/hook-delete-policy": "before-hook-creation" +data: + ceph.conf: | + [global] + auth_supported = none + {{ $monitors := $ceph.monitors }}{{ range $index, $element := $monitors}} + [mon.{{- $index }}] + mon_addr = {{ $element }} + {{- end }} +{{- end }} diff --git a/stx-platform-helm/stx-platform-helm/helm-charts/ceph-pools-audit/values.yaml b/stx-platform-helm/stx-platform-helm/helm-charts/ceph-pools-audit/values.yaml index 62b6b96..fbbae8b 100644 --- a/stx-platform-helm/stx-platform-helm/helm-charts/ceph-pools-audit/values.yaml +++ b/stx-platform-helm/stx-platform-helm/helm-charts/ceph-pools-audit/values.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2019 Wind River Systems, Inc. +# Copyright (c) 2019-2021 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -13,7 +13,7 @@ labels: name: ceph-pools-audit ceph_client: - configmap: ceph-etc + configmap: ceph-etc-pools-audit conf: ceph: @@ -68,3 +68,4 @@ affinity: {} manifests: job_ceph_pools_audit: true configmap_bin: true + configmap_ceph_conf: true diff --git a/stx-platform-helm/stx-platform-helm/helm-charts/cephfs-provisioner/templates/config-provisioner.yaml b/stx-platform-helm/stx-platform-helm/helm-charts/cephfs-provisioner/templates/config-provisioner.yaml index 0a1c763..dd8880d 100644 --- a/stx-platform-helm/stx-platform-helm/helm-charts/cephfs-provisioner/templates/config-provisioner.yaml +++ b/stx-platform-helm/stx-platform-helm/helm-charts/cephfs-provisioner/templates/config-provisioner.yaml @@ -1,6 +1,6 @@ {{/* # -# Copyright (c) 2020 Wind River Systems, Inc. +# Copyright (c) 2020-2021 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -15,6 +15,9 @@ kind: ConfigMap metadata: name: ceph-config-file namespace: {{ $defaults.cephFSNamespace }} + annotations: + "helm.sh/hook": "pre-upgrade, pre-install" + "helm.sh/hook-delete-policy": "before-hook-creation" data: ceph.conf: | {{ tuple "conf/_ceph-conf.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} @@ -92,4 +95,4 @@ spec: {{- if .Values.global.nodeSelector }} nodeSelector: {{ .Values.global.nodeSelector | toYaml | trim | indent 8 }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/stx-platform-helm/stx-platform-helm/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml b/stx-platform-helm/stx-platform-helm/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml index ec986b7..f57bec2 100644 --- a/stx-platform-helm/stx-platform-helm/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml +++ b/stx-platform-helm/stx-platform-helm/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml @@ -1,6 +1,6 @@ {{/* # -# Copyright (c) 2018 Wind River Systems, Inc. +# Copyright (c) 2018-2021 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -14,9 +14,11 @@ apiVersion: v1 kind: ConfigMap metadata: - creationTimestamp: 2016-02-18T19:14:38Z name: config-{{- $root.Values.global.name }} namespace: {{ $root.Release.Namespace }} + annotations: + "helm.sh/hook": "pre-upgrade, pre-install" + "helm.sh/hook-delete-policy": "before-hook-creation" data: ceph.conf: | {{ $monitors := $defaults.monitors }}{{ range $index, $element := $monitors}} @@ -202,6 +204,9 @@ kind: ConfigMap metadata: name: ceph-etc namespace: {{ $root.Release.Namespace }} + annotations: + "helm.sh/hook": "pre-upgrade, pre-install" + "helm.sh/hook-delete-policy": "before-hook-creation" data: ceph.conf: | [global]