2020-08-25 01:07:34 +00:00
|
|
|
#! Copyright 2020 VMware, Inc.
|
|
|
|
#! SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2020-07-17 21:42:02 +00:00
|
|
|
#@ load("@ytt:data", "data")
|
|
|
|
|
2020-08-09 17:04:05 +00:00
|
|
|
#! Give permission to various cluster-scoped objects
|
2020-07-17 21:42:02 +00:00
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: ClusterRole
|
|
|
|
metadata:
|
|
|
|
name: #@ data.values.app_name + "-aggregated-api-server-cluster-role"
|
|
|
|
rules:
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: [namespaces]
|
|
|
|
verbs: [get, list, watch]
|
|
|
|
- apiGroups: [apiregistration.k8s.io]
|
|
|
|
resources: [apiservices]
|
|
|
|
verbs: [create, get, list, patch, update, watch]
|
2020-07-23 15:05:21 +00:00
|
|
|
- apiGroups: [admissionregistration.k8s.io]
|
|
|
|
resources: [validatingwebhookconfigurations, mutatingwebhookconfigurations]
|
|
|
|
verbs: [get, list, watch]
|
2020-07-17 21:42:02 +00:00
|
|
|
---
|
|
|
|
kind: ClusterRoleBinding
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: #@ data.values.app_name + "-aggregated-api-server-cluster-role-binding"
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: #@ data.values.app_name + "-service-account"
|
|
|
|
namespace: #@ data.values.namespace
|
|
|
|
roleRef:
|
|
|
|
kind: ClusterRole
|
|
|
|
name: #@ data.values.app_name + "-aggregated-api-server-cluster-role"
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
2020-08-09 17:04:05 +00:00
|
|
|
|
|
|
|
#! Give permission to various objects within the app's own namespace
|
2020-07-17 21:42:02 +00:00
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: Role
|
|
|
|
metadata:
|
|
|
|
name: #@ data.values.app_name + "-aggregated-api-server-role"
|
|
|
|
namespace: #@ data.values.namespace
|
|
|
|
rules:
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: [services]
|
|
|
|
verbs: [create, get, list, patch, update, watch]
|
2020-08-09 17:04:05 +00:00
|
|
|
- apiGroups: [""]
|
|
|
|
resources: [secrets]
|
2020-08-19 20:15:45 +00:00
|
|
|
verbs: [create, get, list, patch, update, watch, delete]
|
2020-09-09 18:11:16 +00:00
|
|
|
- apiGroups: [crd.pinniped.dev, idp.pinniped.dev]
|
|
|
|
resources: ["*"]
|
2020-07-31 16:08:07 +00:00
|
|
|
verbs: [create, get, list, update, watch]
|
2020-07-17 21:42:02 +00:00
|
|
|
---
|
|
|
|
kind: RoleBinding
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: #@ data.values.app_name + "-aggregated-api-server-role-binding"
|
|
|
|
namespace: #@ data.values.namespace
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: #@ data.values.app_name + "-service-account"
|
|
|
|
namespace: #@ data.values.namespace
|
|
|
|
roleRef:
|
|
|
|
kind: Role
|
|
|
|
name: #@ data.values.app_name + "-aggregated-api-server-role"
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
2020-08-09 17:04:05 +00:00
|
|
|
|
2020-08-19 18:21:07 +00:00
|
|
|
#! Give permission to list pods and pod exec in the kube-system namespace so we can find the API server's private key
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: Role
|
|
|
|
metadata:
|
|
|
|
name: #@ data.values.app_name + "-kube-system-pod-exec-role"
|
|
|
|
namespace: kube-system
|
|
|
|
rules:
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: [pods]
|
|
|
|
verbs: [get, list]
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: [pods/exec]
|
|
|
|
verbs: [create]
|
|
|
|
---
|
|
|
|
kind: RoleBinding
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: #@ data.values.app_name + "-kube-system-pod-exec-role-binding"
|
|
|
|
namespace: kube-system
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: #@ data.values.app_name + "-service-account"
|
|
|
|
namespace: #@ data.values.namespace
|
|
|
|
roleRef:
|
|
|
|
kind: Role
|
|
|
|
name: #@ data.values.app_name + "-kube-system-pod-exec-role"
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
|
2020-08-14 14:11:14 +00:00
|
|
|
#! Allow both authenticated and unauthenticated CredentialRequests (i.e. allow all requests)
|
2020-07-23 15:05:21 +00:00
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: ClusterRole
|
|
|
|
metadata:
|
2020-08-14 14:11:14 +00:00
|
|
|
name: #@ data.values.app_name + "-credentialrequests-cluster-role"
|
2020-07-23 15:05:21 +00:00
|
|
|
rules:
|
2020-08-20 17:54:15 +00:00
|
|
|
- apiGroups: [pinniped.dev]
|
2020-08-14 14:11:14 +00:00
|
|
|
resources: [credentialrequests]
|
2020-07-23 15:05:21 +00:00
|
|
|
verbs: [create]
|
|
|
|
---
|
|
|
|
kind: ClusterRoleBinding
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
2020-08-14 14:11:14 +00:00
|
|
|
name: #@ data.values.app_name + "-credentialrequests-cluster-role-binding"
|
2020-07-23 15:05:21 +00:00
|
|
|
subjects:
|
|
|
|
- kind: Group
|
|
|
|
name: system:authenticated
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
- kind: Group
|
|
|
|
name: system:unauthenticated
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
roleRef:
|
|
|
|
kind: ClusterRole
|
2020-08-14 14:11:14 +00:00
|
|
|
name: #@ data.values.app_name + "-credentialrequests-cluster-role"
|
2020-07-23 15:05:21 +00:00
|
|
|
apiGroup: rbac.authorization.k8s.io
|
2020-08-09 17:04:05 +00:00
|
|
|
|
|
|
|
#! Give permissions for subjectaccessreviews, tokenreview that is needed by aggregated api servers
|
2020-07-23 15:05:21 +00:00
|
|
|
---
|
|
|
|
kind: ClusterRoleBinding
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: #@ data.values.app_name + "-service-account-cluster-role-binding"
|
|
|
|
namespace: #@ data.values.namespace
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: #@ data.values.app_name + "-service-account"
|
|
|
|
namespace: #@ data.values.namespace
|
|
|
|
roleRef:
|
|
|
|
kind: ClusterRole
|
|
|
|
name: system:auth-delegator
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
2020-08-09 17:04:05 +00:00
|
|
|
|
|
|
|
#! Give permissions for a special configmap of CA bundles that is needed by aggregated api servers
|
2020-07-23 15:05:21 +00:00
|
|
|
---
|
|
|
|
kind: RoleBinding
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: #@ data.values.app_name + "-extension-apiserver-authentication-reader-role-binding"
|
|
|
|
namespace: kube-system
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: #@ data.values.app_name + "-service-account"
|
|
|
|
namespace: #@ data.values.namespace
|
|
|
|
roleRef:
|
|
|
|
kind: Role
|
|
|
|
name: extension-apiserver-authentication-reader
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
2020-08-09 17:04:05 +00:00
|
|
|
|
|
|
|
#! Give permission to list and watch ConfigMaps in kube-public
|
2020-07-31 16:08:07 +00:00
|
|
|
---
|
|
|
|
kind: Role
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: #@ data.values.app_name + "-cluster-info-lister-watcher-role"
|
|
|
|
namespace: kube-public
|
|
|
|
rules:
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: [configmaps]
|
2020-07-31 21:35:20 +00:00
|
|
|
verbs: [list, watch]
|
2020-07-31 16:08:07 +00:00
|
|
|
---
|
|
|
|
kind: RoleBinding
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: #@ data.values.app_name + "-cluster-info-lister-watcher-role-binding"
|
|
|
|
namespace: kube-public
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: #@ data.values.app_name + "-service-account"
|
|
|
|
namespace: #@ data.values.namespace
|
|
|
|
roleRef:
|
|
|
|
kind: Role
|
|
|
|
name: #@ data.values.app_name + "-cluster-info-lister-watcher-role"
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|