63 lines
2.4 KiB
YAML
63 lines
2.4 KiB
YAML
{{/*
|
||
Job that cleans up artifacts from the previous job-based addon installation
|
||
in preparation for creating addon objects.
|
||
|
||
We only produce the job if addons are enabled but no existing addon resources exist.
|
||
*/}}
|
||
|
||
{{- define "openstack-cluster.addons.migrateScript" -}}
|
||
# Remove all the old kustomize releases where possible
|
||
helm status -n kustomize-releases ccm-openstack && \
|
||
helm delete -n kustomize-releases ccm-openstack
|
||
helm status -n kustomize-releases metrics-server && \
|
||
helm delete -n kustomize-releases metrics-server
|
||
|
||
# The csi-cinder kustomize release contains the Cinder storage class, which we cannot delete
|
||
# if there are volumes associated with it
|
||
# Instead, we move the release to the new namespace, move the storage class into a separate
|
||
# release and annotate the storage class so that it doesn't get removed by the Helm upgrade
|
||
if helm status -n kustomize-releases csi-cinder; then
|
||
helm-move csi-cinder kustomize-releases {{ .Values.addons.openstack.targetNamespace }}
|
||
helm-adopt \
|
||
csi-cinder-storageclass \
|
||
{{ .Values.addons.openstack.targetNamespace }} \
|
||
storageclass/{{ .Values.addons.openstack.csiCinder.storageClass.name }}
|
||
kubectl annotate \
|
||
storageclass/{{ .Values.addons.openstack.csiCinder.storageClass.name }} \
|
||
"helm.sh/resource-policy=keep"
|
||
fi
|
||
|
||
# Adopt resources previously created in post-install scripts into the relevant Helm releases
|
||
helm-adopt \
|
||
cni-calico \
|
||
{{ .Values.addons.cni.calico.release.namespace }} \
|
||
installation/default
|
||
helm-adopt \
|
||
kube-prometheus-stack-dashboards \
|
||
{{ .Values.addons.monitoring.kubePrometheusStack.release.namespace }} \
|
||
configmap/nvidia-dcgm-exporter-dashboard \
|
||
--namespace {{ .Values.addons.monitoring.kubePrometheusStack.release.namespace }}
|
||
helm-adopt \
|
||
loki-stack-dashboards \
|
||
{{ .Values.addons.monitoring.kubePrometheusStack.release.namespace }} \
|
||
configmap/loki-stack-grafana-datasource \
|
||
--namespace {{ .Values.addons.monitoring.kubePrometheusStack.release.namespace }}
|
||
helm-adopt \
|
||
loki-stack-dashboards \
|
||
{{ .Values.addons.monitoring.kubePrometheusStack.release.namespace }} \
|
||
configmap/loki-stack-grafana-dashboard \
|
||
--namespace {{ .Values.addons.monitoring.kubePrometheusStack.release.namespace }}
|
||
{{- end }}
|
||
|
||
{{-
|
||
if and
|
||
.Values.addons.enabled
|
||
(include "openstack-cluster.addons.isMigration" .)
|
||
}}
|
||
{{-
|
||
include
|
||
"openstack-cluster.addons.hookJob"
|
||
(list . "pre-upgrade" "addons-migrate" "openstack-cluster.addons.migrateScript")
|
||
}}
|
||
{{- end }}
|