# Permissions needed to run the tests

---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
  name: jenkins
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: jenkins
subjects:
- kind: ServiceAccount
  name: jenkins
  namespace: kubernetes-plugin

---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: kubernetes-plugin-test
rules:
- apiGroups: [""]
  resources: ["namespaces"]
  verbs: ["get"]
- apiGroups: [""]
  resources: ["secrets"]
  verbs: ["create","update"]

---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
  name: kubernetes-plugin-test
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: kubernetes-plugin-test
subjects:
- kind: ServiceAccount
  name: jenkins
  namespace: kubernetes-plugin

# Permissions needed to run the tests

---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
  name: jenkins
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: jenkins
subjects:
- kind: ServiceAccount
  name: jenkins
  namespace: kubernetes-plugin

---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: kubernetes-plugin-test
rules:
- apiGroups: [""]
  resources: ["namespaces"]
  verbs: ["get"]
- apiGroups: [""]
  resources: ["secrets"]
  verbs: ["create","update"]
- apiGroups: [""]
  resources: ["deploy"] # KubernetesPipelineTest#cascadingDelete
  verbs: ["create","delete","get","list","patch","update","watch"]
- apiGroups: [""]
  resources: ["persistentvolumeclaims"] # KubernetesPipelineTest#dynamicPVC
  verbs: ["create","delete","get","list","patch","update","watch"]

---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
  name: kubernetes-plugin-test
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: kubernetes-plugin-test
subjects:
- kind: ServiceAccount
  name: jenkins
  namespace: kubernetes-plugin

Add missing privileges for running tests
Add missing privileges for running tests
