Skip to content

Commit

Permalink
add clusterrolebinding logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Panaetius committed Nov 16, 2023
1 parent 0dd914b commit 985fd05
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
1 change: 0 additions & 1 deletion helm-chart/amalthea/templates/rbac/_rbac_rules.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
- networking.k8s.io
resources:
- statefulsets
- persistentvolumes
- persistentvolumeclaims
- services
- ingresses
Expand Down
3 changes: 3 additions & 0 deletions helm-chart/amalthea/templates/rbac/rbac-cluster-wide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ rules:
- apiGroups: [""]
resources: [namespaces]
verbs: [list, watch]
- apiGroups: [""]
resources: [persistentvolumes]
verbs: [create,get,list, watch]

# Kopf: admission webhook configuration management.
- apiGroups: [admissionregistration.k8s.io/v1, admissionregistration.k8s.io/v1beta1]
Expand Down
17 changes: 16 additions & 1 deletion helm-chart/amalthea/templates/rbac/rbac-namespaced.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,22 @@ metadata:
{{- include "amalthea.labels" $fullTemplateScope | nindent 4 }}
rules:
{{- include "amalthea.rules" $fullTemplateScope }}

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "amalthea.fullname" $fullTemplateScope }}
namespace: {{ . }}
labels:
{{- include "amalthea.labels" $fullTemplateScope | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "amalthea.serviceAccountName" $fullTemplateScope}}
namespace: {{ $fullTemplateScope.Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Values.scope.clusterRoleName }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
4 changes: 4 additions & 0 deletions helm-chart/amalthea/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ scope:
# 2. Do not define namespaces at all, in which case amalthea
# will only operate in the namespace where the helm chart is deployed.
# namespaces: ["default"]
clusterRoleName: amalthea
# name of the cluster role for PV creation
# only needs to be set if not deployed clusterwide
# the role needs permission to create,get,list,watch PVs

deployCrd: true # whether to deploy the jupyterserver CRD

Expand Down

0 comments on commit 985fd05

Please sign in to comment.