{{- $functionNs := default .Release.Namespace .Values.functionNamespace }} {{- if eq .Values.operator.create false }} --- apiVersion: v1 kind: ServiceAccount metadata: labels: app: {{ template "openfaas.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} component: faas-controller heritage: {{ .Release.Service }} release: {{ .Release.Name }} name: {{ .Release.Name }}-controller namespace: {{ .Release.Namespace | quote }} {{- if .Values.rbac }} {{- if .Values.clusterRole }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: app: {{ template "openfaas.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} component: faas-controller heritage: {{ .Release.Service }} release: {{ .Release.Name }} name: {{ .Release.Name }}-controller namespace: {{ $functionNs | quote }} rules: - apiGroups: - "" resources: - services verbs: - get - list - watch - create - delete - update - apiGroups: - extensions - apps resources: - deployments verbs: - get - list - watch - create - delete - update - apiGroups: - "" resources: - secrets verbs: - get - list - watch - create - update - patch - delete - apiGroups: - "" resources: - pods - pods/log - namespaces - endpoints verbs: - get - list - watch - apiGroups: - "openfaas.com" resources: - "profiles" verbs: - "get" - "list" - "watch" --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: labels: app: {{ template "openfaas.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} component: faas-controller heritage: {{ .Release.Service }} release: {{ .Release.Name }} name: {{ .Release.Name }}-controller namespace: {{ $functionNs | quote }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: {{ .Release.Name }}-controller subjects: - kind: ServiceAccount name: {{ .Release.Name }}-controller namespace: {{ .Release.Namespace | quote }} {{- else }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: labels: app: {{ template "openfaas.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} component: faas-controller heritage: {{ .Release.Service }} release: {{ .Release.Name }} name: {{ .Release.Name }}-controller namespace: {{ $functionNs | quote }} rules: - apiGroups: - "" resources: - services verbs: - get - list - watch - create - delete - update - apiGroups: - extensions - apps resources: - deployments verbs: - get - list - watch - create - delete - update - apiGroups: - "" resources: - secrets verbs: - get - list - watch - create - update - patch - delete - apiGroups: - "" resources: - pods - pods/log - namespaces - endpoints verbs: - get - list - watch --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: labels: app: {{ template "openfaas.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} component: faas-controller heritage: {{ .Release.Service }} release: {{ .Release.Name }} name: {{ .Release.Name }}-controller namespace: {{ $functionNs | quote }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: {{ .Release.Name }}-controller subjects: - kind: ServiceAccount name: {{ .Release.Name }}-controller namespace: {{ .Release.Namespace | quote }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: labels: app: {{ template "openfaas.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} component: faas-controller heritage: {{ .Release.Service }} release: {{ .Release.Name }} name: {{ .Release.Name }}-profiles namespace: {{ .Release.Namespace | quote }} rules: - apiGroups: - "openfaas.com" resources: - "profiles" verbs: - "get" - "list" - "watch" --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: labels: app: {{ template "openfaas.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} component: faas-controller heritage: {{ .Release.Service }} release: {{ .Release.Name }} name: {{ .Release.Name }}-profiles namespace: {{ .Release.Namespace | quote }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: {{ .Release.Name }}-profiles subjects: - kind: ServiceAccount name: {{ .Release.Name }}-controller namespace: {{ .Release.Namespace | quote }} {{- end }} {{- end }} {{- end }}