{{- if .Values.clients }}{{ if .Values.clients.enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: {{ template "windowsExporter.name" . }} namespace: {{ template "windowsExporter.namespace" . }} labels: {{ include "windowsExporter.labels" . | nindent 4 }} rules: - apiGroups: ['authentication.k8s.io'] resources: ['tokenreviews'] verbs: ['create'] - apiGroups: ['authorization.k8s.io'] resources: ['subjectaccessreviews'] verbs: ['create'] - apiGroups: ['policy'] resources: ['podsecuritypolicies'] verbs: ['use'] resourceNames: ['{{ template "windowsExporter.name" . }}'] --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: {{ template "windowsExporter.name" . }} namespace: {{ template "windowsExporter.namespace" . }} labels: {{ include "windowsExporter.labels" . | nindent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: {{ template "windowsExporter.name" . }} subjects: - kind: ServiceAccount name: {{ template "windowsExporter.name" . }} namespace: {{ .Release.Namespace }} --- apiVersion: v1 kind: ServiceAccount metadata: name: {{ template "windowsExporter.name" . }} namespace: {{ template "windowsExporter.namespace" . }} labels: {{ include "windowsExporter.labels" . | nindent 4 }} {{- if .Values.clients.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.clients.imagePullSecrets | nindent 2 }} {{- end }} --- apiVersion: policy/v1beta1 kind: PodSecurityPolicy metadata: name: {{ template "windowsExporter.name" . }} namespace: {{ template "windowsExporter.namespace" . }} labels: {{ include "windowsExporter.labels" . | nindent 4 }} spec: privileged: false hostNetwork: false hostIPC: false hostPID: false runAsUser: rule: 'RunAsAny' seLinux: rule: 'RunAsAny' supplementalGroups: rule: 'MustRunAs' ranges: - min: 0 max: 65535 fsGroup: rule: 'MustRunAs' ranges: - min: 0 max: 65535 readOnlyRootFilesystem: false volumes: - 'secret' - 'hostPath' allowedHostPaths: - pathPrefix: \\.\pipe\rancher_wins - pathPrefix: \\.\pipe\rancher_wins_proxy - pathPrefix: c:/etc/windows-exporter {{- end }}{{- end }}