Skip to content

Commit

Permalink
Merge pull request #25 from appuio/feat/user-rbac
Browse files Browse the repository at this point in the history
Add user RBAC to default config
  • Loading branch information
glrf authored Jan 31, 2022
2 parents d0458e7 + fb312c6 commit 86b152d
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/deployment/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ spec:
- "--cert-dir=/apiserver.local.config/certificates"
- "--secure-port=9443"
- "--feature-gates=APIPriorityAndFairness=false"
- "--cluster-roles=control-api:organization-viewer,control-api:organization-admin"
- "--username-prefix=appuio#"
volumeMounts:
- name: apiserver-certs
mountPath: /apiserver.local.config/certificates
Expand Down
14 changes: 14 additions & 0 deletions config/user-rbac/basic-user-role.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: control-api:basic-user
rules:
- apiGroups: ["organization.appuio.io"]
resources: ["organizations"]
verbs: ["get", "watch", "list", "patch", "edit", "create"]
- apiGroups: ["rbac.appuio.io"]
resources: ["organizations"]
verbs: ["watch", "list", "create"]
- apiGroups: ["appuio.io"]
resources: ["zones"]
verbs: ["get", "watch", "list"]
12 changes: 12 additions & 0 deletions config/user-rbac/basic-user-rolebinding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: control-api:basic-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: control-api:basic-user
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: system:authenticated
5 changes: 5 additions & 0 deletions config/user-rbac/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resources:
- basic-user-rolebinding.yml
- basic-user-role.yml
- organization-admin-role.yml
- organization-viewer-role.yml
11 changes: 11 additions & 0 deletions config/user-rbac/organization-admin-role.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: control-api:organization-admin
rules:
- apiGroups: ["rbac.appuio.io"]
resources: ["organizations"]
verbs: ["get", "watch", "list", "patch", "edit", "create"]
- apiGroups: ["appuio.io"]
resources: ["organizationmembers"]
verbs: ["get", "watch", "list", "patch", "edit", "create"]
14 changes: 14 additions & 0 deletions config/user-rbac/organization-viewer-role.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: control-api:organization-viewer
rules:
- apiGroups: ["rbac.appuio.io"]
resources: ["organizations"]
verbs: ["get", "watch", "list"]
- apiGroups: ["appuio.io"]
resources: ["organizationmembers"]
verbs: ["get", "watch", "list"]
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["rolebindings"]
verbs: ["get", "watch", "list"]
1 change: 1 addition & 0 deletions local-env/setup-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ kubectl config set-credentials oidc-user \
kubectl config set-context --current --user=oidc-user
kubectl apply -k "${script_dir}/../config/crd/apiextensions.k8s.io/v1"
kubectl apply -k "${script_dir}/../config/deployment"
kubectl apply -k "${script_dir}/../config/user-rbac"

echo =======
echo "Setup finished. To interact with the local dev cluster, set the KUBECONFIG environment variable as follows:"
Expand Down
3 changes: 2 additions & 1 deletion local-env/templates/kind-oidc.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ nodes:
extraArgs:
oidc-issuer-url: ISSUER_KEYCLOAK/auth/realms/REALM
oidc-client-id: local-dev
oidc-username-claim: email
oidc-username-claim: preferred_username
oidc-username-prefix: "appuio#"
oidc-groups-claim: groups

0 comments on commit 86b152d

Please sign in to comment.