{{- if .Values.rbac -}} {{- $oc4 := and .Values.openshift (semverCompare ">=1.12-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) -}} {{- $oc3 := and .Values.openshift (not $oc4) (semverCompare ">=1.9-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) -}} {{- if $oc3 }} apiVersion: authorization.openshift.io/v1 {{- else if (semverCompare ">=1.8-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }} apiVersion: rbac.authorization.k8s.io/v1 {{- else }} apiVersion: v1 {{- end }} kind: ClusterRole metadata: name: neuvector-binding-app labels: chart: {{ template "neuvector.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} rules: - apiGroups: - "" resources: - nodes - pods - services - namespaces verbs: - get - list - watch - update --- {{- if $oc3 }} apiVersion: authorization.openshift.io/v1 {{- else if (semverCompare ">=1.8-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }} apiVersion: rbac.authorization.k8s.io/v1 {{- else }} apiVersion: v1 {{- end }} kind: ClusterRole metadata: name: neuvector-binding-rbac labels: chart: {{ template "neuvector.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} rules: {{- if .Values.openshift }} - apiGroups: - image.openshift.io resources: - imagestreams verbs: - get - list - watch {{- end }} - apiGroups: - rbac.authorization.k8s.io resources: - rolebindings - roles - clusterrolebindings - clusterroles verbs: - get - list - watch --- {{- if $oc3 }} apiVersion: authorization.openshift.io/v1 {{- else if (semverCompare ">=1.8-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }} apiVersion: rbac.authorization.k8s.io/v1 {{- else }} apiVersion: v1 {{- end }} kind: ClusterRole metadata: name: neuvector-binding-admission labels: chart: {{ template "neuvector.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} rules: - apiGroups: - admissionregistration.k8s.io resources: - validatingwebhookconfigurations - mutatingwebhookconfigurations verbs: - get - list - watch - create - update - delete --- {{- if $oc4 }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: neuvector-binding-co labels: chart: {{ template "neuvector.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} rules: - apiGroups: - config.openshift.io resources: - clusteroperators verbs: - get - list {{- end }} {{- end }}