{{- $serverEnabled := (or (and (ne (.Values.server.enabled | toString) "-") .Values.server.enabled) (and (eq (.Values.server.enabled | toString) "-") .Values.global.enabled)) -}} {{- if (or $serverEnabled .Values.externalServers.enabled) }} {{- if .Values.global.acls.manageSystemACLs }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: {{ template "consul.fullname" . }}-server-acl-init namespace: {{ .Release.Namespace }} labels: app: {{ template "consul.name" . }} chart: {{ template "consul.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} component: server-acl-init rules: - apiGroups: [ "" ] resources: - secrets verbs: - create - get - apiGroups: [ "" ] resources: - serviceaccounts resourceNames: - {{ template "consul.fullname" . }}-auth-method verbs: - get {{- if .Values.global.enablePodSecurityPolicies }} - apiGroups: [ "policy" ] resources: [ "podsecuritypolicies" ] resourceNames: - {{ template "consul.fullname" . }}-server-acl-init verbs: - use {{- end }} {{- end }} {{- end }}