diff --git a/charts/kommander-operator/templates/pre_upgrade_kommandercore_hook.yaml b/charts/kommander-operator/templates/pre_upgrade_kommandercore_hook.yaml deleted file mode 100644 index 6b3ba83e8..000000000 --- a/charts/kommander-operator/templates/pre_upgrade_kommandercore_hook.yaml +++ /dev/null @@ -1,121 +0,0 @@ ---- -# TODO: remove this job in 2.8 -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ .Chart.Name }}-pre-upgrade - namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/hook": pre-upgrade - "helm.sh/hook-weight": "-5" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: {{ .Chart.Name }}-pre-upgrade - annotations: - "helm.sh/hook": pre-upgrade - "helm.sh/hook-weight": "-5" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded -rules: - - apiGroups: - - dkp.d2iq.io - - helm.toolkit.fluxcd.io - resources: - - kommandercores - - helmreleases - verbs: - - get - - list - - watch - - apiGroups: - - dkp.d2iq.io - resources: - - kommandercores - - kommandercores/status - verbs: - - patch - - update ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: {{ .Chart.Name }}-pre-upgrade - annotations: - "helm.sh/hook": pre-upgrade - "helm.sh/hook-weight": "-5" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: {{ .Chart.Name }}-pre-upgrade -subjects: - - kind: ServiceAccount - name: {{ .Chart.Name }}-pre-upgrade - namespace: {{ .Release.Namespace }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Chart.Name }}-pre-upgrade - namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/hook": pre-upgrade - "helm.sh/hook-weight": "-5" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded -data: - pre_process_kcore.sh: |- - #!/bin/bash - set -eo pipefail - - kcore_status=$(kubectl get kommandercore kommander-core -o jsonpath='{.status}') - # do nothing if the .status field is already populated - if [ -n "$kcore_status" ]; then - exit 0 - fi - - # get the version of kommander before upgrade - KOMMANDER_VERSION_PREUPGRADE=$(kubectl get helmrelease -n kommander kommander -o jsonpath='{.status.lastAppliedRevision}') - cat < kcore_patch.yaml - apiVersion: dkp.d2iq.io/v1alpha1 - kind: KommanderCore - metadata: - name: kommander-core - status: - version: $KOMMANDER_VERSION_PREUPGRADE - EOF - - kubectl patch kommandercore kommander-core --subresource='status' --type='merge' --patch-file kcore_patch.yaml ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ .Chart.Name }}-pre-upgrade - namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/hook": pre-upgrade - "helm.sh/hook-weight": "0" - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded -spec: - template: - spec: - serviceAccountName: {{ .Chart.Name }}-pre-upgrade - {{- if .Values.priorityClassName }} - priorityClassName: "{{ .Values.priorityClassName }}" - {{- end }} - containers: - - name: {{ .Chart.Name }}-pre-upgrade - image: "{{ .Values.kubetools.image.repository | default "mesosphere/kommander2-kubetools" }}:{{ .Values.kubetools.image.tag }}" - command: ["/bin/bash","-c"] - args: ["/bin/scripts/pre_process_kcore.sh"] - volumeMounts: - - name: script - mountPath: /bin/scripts - volumes: - - name: script - configMap: - defaultMode: 0770 - name: {{ .Chart.Name }}-pre-upgrade - restartPolicy: OnFailure ----