|
| 1 | +{{/* |
| 2 | +Copyright 2024 The Kubeflow authors. |
| 3 | + |
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | + |
| 8 | + https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + |
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/}} |
| 16 | + |
| 17 | +{{- if .Values.hook.upgradeCrd }} |
| 18 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 19 | +kind: ClusterRole |
| 20 | +metadata: |
| 21 | + name: {{ include "spark-operator.hook.clusterRoleName" . }} |
| 22 | + namespace: {{ .Release.Namespace }} |
| 23 | + labels: |
| 24 | + {{- include "spark-operator.hook.labels" . | nindent 4 }} |
| 25 | + annotations: |
| 26 | + helm.sh/hook: pre-install,pre-upgrade |
| 27 | + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded,hook-failed |
| 28 | + helm.sh/hook-weight: "2" |
| 29 | +rules: |
| 30 | +- apiGroups: |
| 31 | + - apiextensions.k8s.io |
| 32 | + resources: |
| 33 | + - customresourcedefinitions |
| 34 | + resourceNames: |
| 35 | + - sparkapplications.sparkoperator.k8s.io |
| 36 | + - scheduledsparkapplications.sparkoperator.k8s.io |
| 37 | + verbs: |
| 38 | + - get |
| 39 | + - update |
| 40 | +--- |
| 41 | + |
| 42 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 43 | +kind: ClusterRoleBinding |
| 44 | +metadata: |
| 45 | + name: {{ include "spark-operator.hook.clusterRoleBindingName" . }} |
| 46 | + namespace: {{ .Release.Namespace }} |
| 47 | + labels: |
| 48 | + {{- include "spark-operator.hook.labels" . | nindent 4 }} |
| 49 | + annotations: |
| 50 | + helm.sh/hook: pre-install,pre-upgrade |
| 51 | + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded,hook-failed |
| 52 | + helm.sh/hook-weight: "2" |
| 53 | +subjects: |
| 54 | +- kind: ServiceAccount |
| 55 | + name: {{ include "spark-operator.hook.serviceAccountName" . }} |
| 56 | + namespace: {{ .Release.Namespace }} |
| 57 | +roleRef: |
| 58 | + apiGroup: rbac.authorization.k8s.io |
| 59 | + kind: ClusterRole |
| 60 | + name: {{ include "spark-operator.hook.clusterRoleName" . }} |
| 61 | +{{- end }} |
0 commit comments