Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: keep globale resources #8447

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions deploy/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,10 @@ Define default storage class name, if cloud provider is known, specify a default
{{- .Values.image.registry }}
{{- end}}
{{- end}}


{{- define "kubeblocks.keepResource" }}
{{- if .Values.keepGlobalResources }}
helm.sh/resource-policy: keep
{{- end}}
{{- end}}
3 changes: 2 additions & 1 deletion deploy/helm/templates/backuprepo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-backuprepo
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
{{- if .Values.backupRepo.default }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
{{- if .Values.backupRepo.default }}
dataprotection.kubeblocks.io/is-default-repo: "true"
{{- end }}
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-backuppolicytemplate-editor-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- apps.kubeblocks.io
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/rbac/apps_cluster_editor_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-cluster-editor-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- apps.kubeblocks.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-clusterdefinition-editor-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- apps.kubeblocks.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-configconstraint-editor-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- apps.kubeblocks.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-metrics-reader
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- nonResourceURLs:
- "/metrics"
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/rbac/auth_proxy_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-proxy-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- authentication.k8s.io
Expand Down
4 changes: 4 additions & 0 deletions deploy/helm/templates/rbac/cluster_pod_required_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: kubeblocks-cluster-pod-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
aggregationRule:
clusterRoleSelectors:
- matchLabels:
Expand Down Expand Up @@ -71,6 +73,8 @@ metadata:
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
app.kubernetes.io/required-by: pod
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- ""
Expand Down
7 changes: 7 additions & 0 deletions deploy/helm/templates/rbac/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
aggregationRule:
clusterRoleSelectors:
- matchLabels:
Expand All @@ -15,6 +17,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-manager-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
{{- $doInclude := false }}
{{- range $i, $line := .Files.Lines "config/rbac/role.yaml" }}
Expand All @@ -31,6 +35,8 @@ metadata:
name: {{ include "dataprotection.workerClusterRoleName" . }}
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
# need to run "kubectl patch backup" inside a worker pod to update the status
- apiGroups:
Expand Down Expand Up @@ -60,6 +66,7 @@ metadata:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": pre-upgrade
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- apiextensions.k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-backup-editor-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- dataprotection.kubeblocks.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-backuppolicy-editor-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- dataprotection.kubeblocks.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: {{ include "dataprotection.execWorkerRoleName" . }}
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-restore-editor-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- dataprotection.kubeblocks.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: ClusterRole
metadata:
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
name: {{ include "kubeblocks.fullname" . }}-nodecountscaler-editor-role
rules:
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-editor-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- extensions.kubeblocks.io
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/rbac/leader_election_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-leader-election-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- ""
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/rbac/rbac_manager_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: {{ include "kubeblocks.fullname" . }}-rbac-manager-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
rules:
- apiGroups:
- ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: ClusterRole
metadata:
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
name: {{ include "kubeblocks.fullname" . }}-instanceset-editor-role
rules:
- apiGroups:
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/storageprovider/cos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: cos
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
spec:
csiDriverName: ru.yandex.s3.csi
csiDriverSecretTemplate: |
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/storageprovider/ftp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: ftp
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
spec:
datasafedConfigTemplate: |
[storage]
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/storageprovider/gcs-s3comp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: gcs-s3comp
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
spec:
csiDriverName: ru.yandex.s3.csi
csiDriverSecretTemplate: |
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/storageprovider/minio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: minio
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
spec:
csiDriverName: ru.yandex.s3.csi
csiDriverSecretTemplate: |
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/storageprovider/nfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: nfs
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
spec:
csiDriverName: nfs.csi.k8s.io

Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/storageprovider/obs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
name: obs
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
spec:
csiDriverName: ru.yandex.s3.csi
csiDriverSecretTemplate: |
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/storageprovider/oss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: oss
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
spec:
csiDriverName: ru.yandex.s3.csi
csiDriverSecretTemplate: |
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/storageprovider/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: pvc
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
spec:
persistentVolumeClaimTemplate: |
spec:
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/storageprovider/s3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: s3
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
annotations:
{{- include "kubeblocks.keepResource" . | nindent 4 }}
spec:
csiDriverName: ru.yandex.s3.csi
csiDriverSecretTemplate: |
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ addonController:
## @param keepAddons - keep Addon CR objects when delete this chart.
keepAddons: true

keepGlobalResources: false

## @param addonChartLocationBase - KubeBlocks official addon's chart location base, to be released in an air-gapped environment.
## if url has prefix "file://", KubeBlocks will use the helm charts copied from the addonChartsImage.
##
Expand Down
Loading