upgrade operator crd when upgrading chart
Signed-off-by: calvin <wen.chen@daocloud.io>
This commit is contained in:
parent
6fae04eb24
commit
7b6c87d244
|
@ -14,8 +14,16 @@ Return the proper karmada operator image name
|
|||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names
|
||||
return the proper docker image registry secret names
|
||||
*/}}
|
||||
{{- define "karmada.operator.imagePullSecrets" -}}
|
||||
{{ include "common.images.pullSecrets" (dict "images" (list .Values.operator.image) "global" .Values.global) }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper kubectl image name
|
||||
*/}}
|
||||
{{- define "karmada.kubectl.image" -}}
|
||||
{{ include "common.images.image" (dict "imageRoot" .Values.kubectl.image "global" .Values.global) }}
|
||||
{{- end -}}
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{{- if .Values.installCRDs }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-post-manifests
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
helm.sh/hook: post-install,post-upgrade
|
||||
helm.sh/hook-weight: "1"
|
||||
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
|
||||
data:
|
||||
crds-configmaps.yaml: |-
|
||||
{{ range $path, $bytes := .Files.Glob (printf "crds/*")}}
|
||||
{{- $.Files.Get $path | nindent 8 }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
{{- if .Values.installCRDs }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-post-hook-install-crds
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
helm.sh/hook: post-install,post-upgrade
|
||||
helm.sh/hook-weight: "2"
|
||||
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
labels:
|
||||
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||||
spec:
|
||||
serviceAccountName: {{ .Release.Name }}-post-hook-job
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: install-crds
|
||||
image: {{ include "karmada.kubectl.image" . }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
workingDir: /crds
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
bash <<'EOF'
|
||||
set -ex
|
||||
kubectl apply --server-side -f /crds --force-conflicts
|
||||
EOF
|
||||
volumeMounts:
|
||||
- name: crds
|
||||
mountPath: /crds
|
||||
volumes:
|
||||
- name: crds
|
||||
configMap:
|
||||
name: {{ .Release.Name }}-post-manifests
|
||||
{{- end -}}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
|
||||
{{- if .Values.installCRDs }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-post-hook-job
|
||||
annotations:
|
||||
helm.sh/hook: post-install,post-upgrade
|
||||
helm.sh/hook-weight: "-5"
|
||||
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
|
||||
rules:
|
||||
- apiGroups: ['apiextensions.k8s.io']
|
||||
resources: ['customresourcedefinitions']
|
||||
verbs: ["get", "watch", "list", "create", "update", "patch", "delete"]
|
||||
- nonResourceURLs: ['*']
|
||||
verbs: ["get"]
|
||||
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-post-hook-job
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,post-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: {{ .Release.Name }}-post-hook-job
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Release.Name }}-post-hook-job
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end -}}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{{- if .Values.installCRDs }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-post-hook-job
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
helm.sh/hook: post-install,post-upgrade
|
||||
helm.sh/hook-weight: "-5"
|
||||
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
|
||||
{{- end -}}
|
||||
|
|
@ -11,6 +11,22 @@ global:
|
|||
## - myRegistryKeySecretName
|
||||
imagePullSecrets: []
|
||||
|
||||
## @param installCRDs define flag whether to install CRD resources
|
||||
##
|
||||
installCRDs: true
|
||||
|
||||
kubectl:
|
||||
## @param image.registry karmada kubectl image registry
|
||||
## @param image.repository karmada kubectl image repository
|
||||
## @param image.tag karmada kubectl image tag (immutable tags are recommended)
|
||||
##
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/kubectl
|
||||
tag: latest
|
||||
## Specify a imagePullPolicy, defaults to 'IfNotPresent'
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
## operator manager config
|
||||
operator:
|
||||
## @param operator.labels
|
||||
|
|
Loading…
Reference in New Issue