Skip to content

Commit

Permalink
Merge pull request #12 from observatorium/document_permissions
Browse files Browse the repository at this point in the history
docs: document granting privileges
  • Loading branch information
squat authored Feb 10, 2024
2 parents 99d5df0 + 880f0fe commit eb9794c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,7 @@ jobs:
data:
server: "$SERVER"
EOF
cat <<EOF | kubectl apply -f -
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: namespace-provisioner-grant
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- list
EOF
kubectl apply -f manifests/example-grants/pods.yaml
kubectl -n namespace-provisioner set image deployment namespace-provisioner namespace-provisioner=quay.io/observatorium/namespace-provisioner:test
kubectl -n namespace-provisioner rollout status deployment namespace-provisioner --timeout 1m
- name: Test namespace-provisioner
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ Currently, the API only allows clients to authenticate via a bearer token, which

### Privileges

The Namespace Provisioner provides the client with a Kubeconfig to operate the Namespaces it creates.
The privileges given to this Kubeconfig can be controlled by providing the Namespace Provisioner a file containing a Kubernete RBAC Role at run-time with the `--role=<path-to-role>` flag.
The Role contained in the file will be created in every provisioned Namespace and bound to the returned Kubeconfig.
The Namespace Provisioner provides the client with a Kubeconfig to operate the Namespaces it creates and binds a ClusterRole it to give it privileges.
The ClusterRole is bound to the Kubeconfig using a RoleBinding, scoping the permissions down to only the newly created Namespace.
By default, the Namespace Provisioner uses a ClusterRole named `namespace-provisioner-grant`, which grants no permissions to the subject.
To control the permissions granted to the returned Kubeconfig, administrators can edit the `namespace-provisioner-grant` ClusterRole or change the target ClusterRole by specifying a different `--cluster-role=<name>` flag passed to the Namespace Provisioner.

### API Server

Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions manifests/example-grants/pods.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: namespace-provisioner-grant
labels:
app.kubernetes.io/name: namespace-provisioner-grant
app.kubernetes.io/part-of: namespace-provisioner
rules:
- apiGroups:
- ""
resources:
- pods
verbs: ["*"]
9 changes: 9 additions & 0 deletions manifests/namespace-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ metadata:
stringData:
token: PASSWORD
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: namespace-provisioner-grant
labels:
app.kubernetes.io/name: namespace-provisioner-grant
app.kubernetes.io/part-of: namespace-provisioner
rules: []
---
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down

0 comments on commit eb9794c

Please sign in to comment.