[rancher-prom2teams] Move role+rolebinding for PSPs to psp.yaml

pull/2370/head
Arvind Iyengar 2023-01-27 12:07:55 -08:00
parent d8c28a415e
commit 14fc295077
No known key found for this signature in database
GPG Key ID: A8DD9BFD6C811498
3 changed files with 30 additions and 32 deletions

View File

@ -28,4 +28,34 @@ spec:
volumes:
- 'configMap'
- 'secret'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "prom2teams.fullname" . }}-psp
namespace: {{ include "prom2teams.namespace" . }}
labels: {{ include "prom2teams.labels" . | nindent 4 }}
rules:
- apiGroups:
- policy
resourceNames:
- {{ include "prom2teams.fullname" . }}-psp
resources:
- podsecuritypolicies
verbs:
- use
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "prom2teams.fullname" . }}-psp
namespace: {{ include "prom2teams.namespace" . }}
labels: {{ include "prom2teams.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "prom2teams.fullname" . }}-psp
subjects:
- kind: ServiceAccount
name: {{ include "prom2teams.fullname" . }}
{{- end }}

View File

@ -1,17 +0,0 @@
{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy" }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "prom2teams.fullname" . }}-psp
namespace: {{ include "prom2teams.namespace" . }}
labels: {{ include "prom2teams.labels" . | nindent 4 }}
rules:
- apiGroups:
- policy
resourceNames:
- {{ include "prom2teams.fullname" . }}-psp
resources:
- podsecuritypolicies
verbs:
- use
{{- end }}

View File

@ -1,15 +0,0 @@
{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy" }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "prom2teams.fullname" . }}-psp
namespace: {{ include "prom2teams.namespace" . }}
labels: {{ include "prom2teams.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "prom2teams.fullname" . }}-psp
subjects:
- kind: ServiceAccount
name: {{ include "prom2teams.fullname" . }}
{{- end }}