Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Jupyter] Add RBAC #85

Merged
merged 13 commits into from
Dec 3, 2023
2 changes: 1 addition & 1 deletion charts/mlrun-ce/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
version: 0.6.3-rc5
version: 0.6.3-rc6
name: mlrun-ce
description: MLRUn Open Source Stack
home: https://iguazio.com
Expand Down
4 changes: 2 additions & 2 deletions charts/mlrun-ce/templates/jupyter-notebook/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ spec:
labels:
{{- include "mlrun-ce.jupyter.selectorLabels" . | nindent 8 }}
spec:
{{- if .Values.jupyterNotebook.serviceAccount }}
serviceAccount: {{ .Values.jupyterNotebook.serviceAccount }}
{{- if .Values.jupyterNotebook.serviceAccount.name }}
serviceAccount: {{ .Values.jupyterNotebook.serviceAccount.name }}
{{- end }}
securityContext:
runAsUser: 1000
Expand Down
13 changes: 13 additions & 0 deletions charts/mlrun-ce/templates/jupyter-notebook/role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.jupyterNotebook.enabled -}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: jupyter-role-binding
subjects:
- kind: ServiceAccount
name: {{ .Values.jupyterNotebook.serviceAccount.name }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if .Values.jupyterNotebook.serviceAccount.name is empty? The user may ask to create but not provide a name (by mistake or not). Should we use a default name here in that case?

roleRef:
kind: Role
name: jupyter-role
apiGroup: rbac.authorization.k8s.io
{{- end -}}
51 changes: 51 additions & 0 deletions charts/mlrun-ce/templates/jupyter-notebook/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{- if .Values.jupyterNotebook.enabled -}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: jupyter-role
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- watch
- create
- delete
- apiGroups:
- ""
resources:
- pods/log
verbs:
- get
- list
- apiGroups:
- metrics.k8s.io
resources:
- pods
verbs:
- list
- get
- apiGroups:
- ""
resources:
- services
verbs:
- list
- get
- apiGroups:
- extensions
resources:
- ingresses
verbs:
- list
- get
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{- if .Values.jupyterNotebook.serviceAccount.create -}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.jupyterNotebook.serviceAccount.name }}
{{- end -}}
5 changes: 4 additions & 1 deletion charts/mlrun-ce/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ mlrun:
mode: full

jupyterNotebook:
awsInstall: false
serviceAccount:
create: true
eliyahu77 marked this conversation as resolved.
Show resolved Hide resolved
name: mlrun-jupyter
awsInstall: false
fullnameOverride: mlrun-jupyter
name: jupyter-notebook
enabled: true
Expand Down