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

Onyxia service account #31

Open
alexisdondon opened this issue Apr 15, 2022 · 2 comments · May be fixed by #32
Open

Onyxia service account #31

alexisdondon opened this issue Apr 15, 2022 · 2 comments · May be fixed by #32

Comments

@alexisdondon
Copy link
Contributor

To let onyxia run with less security privilege in the cluster, we should try to change service account part of the chart to take profit ot this PR on onyxia-api InseeFrLab/onyxia-api#74

@alexisdondon
Copy link
Contributor Author

alexisdondon commented Apr 15, 2022

I will make a PR that suggest this change

{{- if .Values.serviceAccount.create -}}
{{- if .Values.serviceAccount.clusterAdmin -}}
apiVersion: [rbac.authorization.k8s.io/v1](http://rbac.authorization.k8s.io/v1)
kind: ClusterRoleBinding
metadata:
  name: {{ include "onyxia.fullname" . }}
  labels:
    {{- include "onyxia.api.labels" . | nindent 4 }}
roleRef:
  apiGroup: [rbac.authorization.k8s.io](http://rbac.authorization.k8s.io/)
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: {{ include "onyxia.api.serviceAccountName" . }}
  namespace: {{ .Release.Namespace }}
{{- end -}}
{{- if .Values.serviceAccount.clusterMinPrivilege -}}
---
apiVersion: [rbac.authorization.k8s.io/v1](http://rbac.authorization.k8s.io/v1)
kind: ClusterRole
metadata:
  name: clusterMinPrivilegeRole
rules:
- apiGroups: [""]
  resources: ["namespaces"]
  verbs: ["get", "list", "create"]
- apiGroups: ["[rbac.authorization.k8s.io](http://rbac.authorization.k8s.io/)"]
  resources: ["rolebindings"]
  verbs: ["create"]
- apiGroups: ["[rbac.authorization.k8s.io](http://rbac.authorization.k8s.io/)"]
  resources: ["clusterroles"]
  verbs: ["bind"]
  resourceNames: ["admin","edit","view"]
---
apiVersion: [rbac.authorization.k8s.io/v1](http://rbac.authorization.k8s.io/v1)
kind: ClusterRoleBinding
metadata:
  name: {{ include "onyxia.fullname" . }}
  labels:
    {{- include "onyxia.api.labels" . | nindent 4 }}
roleRef:
  apiGroup: [rbac.authorization.k8s.io](http://rbac.authorization.k8s.io/)
  kind: ClusterRole
  name: clusterMinPrivilegeRole
subjects:
- kind: ServiceAccount
  name: {{ include "onyxia.api.serviceAccountName" . }}
  namespace: {{ .Release.Namespace }}
{{- end -}}
{{- end -}}

@alexisdondon alexisdondon linked a pull request Apr 15, 2022 that will close this issue
@alexisdondon
Copy link
Contributor Author

alexisdondon commented Apr 15, 2022

this PR try to fix this #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant