{{- $serverEnabled := (or (and (ne (.Values.server.enabled | toString) "-") .Values.server.enabled) (and (eq (.Values.server.enabled | toString) "-") .Values.global.enabled)) -}} {{- if (and .Values.global.adminPartitions.enabled (not $serverEnabled)) }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: {{ template "consul.fullname" . }}-partition-init namespace: {{ .Release.Namespace }} labels: app: {{ template "consul.name" . }} chart: {{ template "consul.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} component: partition-init annotations: "helm.sh/hook": pre-install,pre-upgrade "helm.sh/hook-delete-policy": before-hook-creation rules: - apiGroups: [""] resources: - secrets verbs: - create - get {{- if .Values.connectInject.enabled }} - apiGroups: [""] resources: - serviceaccounts resourceNames: - {{ template "consul.fullname" . }}-connect-injector verbs: - get {{- end }} {{- if .Values.global.enablePodSecurityPolicies }} - apiGroups: ["policy"] resources: ["podsecuritypolicies"] resourceNames: - {{ template "consul.fullname" . }}-partition-init verbs: - use {{- end }} {{- end }}