{{- if .Values.backup.enabled }} apiVersion: v1 kind: ServiceAccount metadata: name: {{ template "jenkins.fullname" . }}-backup namespace: {{ template "jenkins.namespace" . }} labels: "app.kubernetes.io/name": '{{ template "jenkins.name" .}}' "helm.sh/chart": "{{ .Chart.Name }}-{{ .Chart.Version }}" "app.kubernetes.io/managed-by": "{{ .Release.Service }}" "app.kubernetes.io/instance": "{{ .Release.Name }}" "app.kubernetes.io/component": "{{ .Values.master.componentName }}" --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: {{ template "jenkins.fullname" . }}-backup namespace: {{ template "jenkins.namespace" . }} labels: "app.kubernetes.io/name": '{{ template "jenkins.name" .}}' "helm.sh/chart": "{{ .Chart.Name }}-{{ .Chart.Version }}" "app.kubernetes.io/managed-by": "{{ .Release.Service }}" "app.kubernetes.io/instance": "{{ .Release.Name }}" "app.kubernetes.io/component": "{{ .Values.master.componentName }}" rules: - apiGroups: [""] resources: ["pods", "pods/log"] verbs: ["get", "list"] - apiGroups: [""] resources: ["pods/exec"] verbs: ["create"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: {{ template "jenkins.fullname" . }}-backup namespace: {{ template "jenkins.namespace" . }} labels: "app.kubernetes.io/name": '{{ template "jenkins.name" .}}' "helm.sh/chart": "{{ .Chart.Name }}-{{ .Chart.Version }}" "app.kubernetes.io/managed-by": "{{ .Release.Service }}" "app.kubernetes.io/instance": "{{ .Release.Name }}" "app.kubernetes.io/component": "{{ .Values.master.componentName }}" roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: {{ template "jenkins.fullname" . }}-backup subjects: - kind: ServiceAccount name: {{ template "jenkins.fullname" . }}-backup namespace: {{ template "jenkins.namespace" . }} {{- end }}