{{- if and .Values.tls.enabled .Values.tls.certs.selfSigner.enabled }} kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ template "selfcerts.fullname" . }} namespace: {{ .Release.Namespace | quote }} annotations: # This is what defines this resource as a hook. Without this line, the # job is considered part of the release. "helm.sh/hook": pre-install,pre-upgrade "helm.sh/hook-weight": "2" "helm.sh/hook-delete-policy": hook-succeeded,hook-failed labels: helm.sh/chart: {{ template "cockroachdb.chart" . }} app.kubernetes.io/name: {{ template "cockroachdb.name" . }} app.kubernetes.io/instance: {{ .Release.Name | quote }} app.kubernetes.io/managed-by: {{ .Release.Service | quote }} {{- with .Values.labels }} {{- toYaml . | nindent 4 }} {{- end }} rules: - apiGroups: [""] resources: ["secrets"] verbs: ["create", "get", "update", "delete"] - apiGroups: ["apps"] resources: ["statefulsets"] verbs: ["get"] resourceNames: - {{ template "cockroachdb.fullname" . }} - apiGroups: [""] resources: ["pods"] verbs: ["delete", "get"] {{- end }}