Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions helm/coder/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ coder:
# - update
# - watch

# coder.serviceAccount.workspaceNamespaces -- Grant this service account permissions
Copy link
Member

Choose a reason for hiding this comment

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

Above we have workspacePerms, enableDeployments and extraRules. I think these should be duplicated into workspaceNamespaces to support the case of having no additional permissions in the deployment namespace, but extra permissions in the workspace namespaces.

# to manage Coder workspaces in specific namespaces without using ClusterRoles.
# When enabled, Roles and RoleBindings will be created in each listed namespace
# binding to this service account in the release namespace.
workspaceNamespaces:
enabled: false
namespaces: []
Comment on lines +118 to +120
Copy link
Member

Choose a reason for hiding this comment

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

enabled seems unnecessary since an empty list would denote the same thing.

# - dev
# - staging

# coder.serviceAccount.annotations -- The Coder service account annotations.
annotations: {}
# coder.serviceAccount.name -- The service account name
Expand Down
72 changes: 71 additions & 1 deletion helm/libcoder/templates/_rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,74 @@ roleRef:
kind: Role
name: {{ .Values.coder.serviceAccount.name }}-workspace-perms
{{- end }}
{{- end -}}

{{- with .Values.coder.serviceAccount.workspaceNamespaces }}
{{- if .enabled }}
{{- range $ns := .namespaces }}
{{- if and $ns (ne $ns $.Release.Namespace) }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ $.Values.coder.serviceAccount.name }}-workspace-perms
namespace: {{ $ns }}
rules:
- apiGroups: [""]
resources: ["pods"]
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
{{- if $.Values.coder.serviceAccount.enableDeployments }}
- apiGroups:
- apps
resources:
- deployments
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
{{- end }}
{{- with $.Values.coder.serviceAccount.extraRules }}
{{ toYaml . | nindent 2 }}
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ $.Values.coder.serviceAccount.name | quote }}
namespace: {{ $ns }}
subjects:
- kind: ServiceAccount
name: {{ $.Values.coder.serviceAccount.name | quote }}
namespace: {{ $.Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ $.Values.coder.serviceAccount.name }}-workspace-perms
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}
Loading