Skip to content

feat(helm/provisioner): support deploying multiple provisioners in same namespace #15637

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

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat(helm/provisioner): add support for coder.serviceAccount.disableC…
…reate
  • Loading branch information
johnstcn committed Nov 24, 2024
commit b8713243a978a82488a0f16a0a43ddf130a92edf
2 changes: 1 addition & 1 deletion helm/coder/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ coder:
annotations: {}
# coder.serviceAccount.name -- The service account name
name: coder
# coder.serviceAccount.name -- Whether to create the service account or use existing service account
# coder.serviceAccount.disableCreate -- Whether to create the service account or use existing service account.
Copy link
Member Author

Choose a reason for hiding this comment

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

self review: drive-by typo fix

disableCreate: false

# coder.securityContext -- Fields related to the container's security
Expand Down
2 changes: 2 additions & 0 deletions helm/provisioner/templates/coder.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
{{- if not .Values.coder.serviceAccount.disableCreate }}
{{ include "libcoder.serviceaccount" (list . "coder.serviceaccount") }}
{{- end }}
Comment on lines +2 to +4
Copy link
Member Author

Choose a reason for hiding this comment

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

self-review: this was added for helm/coder in #14817 but not ported over here.

I'm not sure if it would be better to do it in libcoder, folks don't seem to look in there much.


---
{{ include "libcoder.deployment" (list . "coder.deployment") }}
4 changes: 4 additions & 0 deletions helm/provisioner/tests/chart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ var testCases = []testCase{
name: "extra_templates",
expectedError: "",
},
{
name: "sa_disabled",
expectedError: "",
},
}

type testCase struct {
Expand Down
67 changes: 67 additions & 0 deletions helm/provisioner/tests/testdata/sa_disabled.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
# Source: coder-provisioner/templates/coder.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations: {}
labels:
app.kubernetes.io/instance: release-name
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: coder-provisioner
app.kubernetes.io/part-of: coder-provisioner
app.kubernetes.io/version: 0.1.0
helm.sh/chart: coder-provisioner-0.1.0
name: coder-provisioner
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: release-name
app.kubernetes.io/name: coder-provisioner
template:
metadata:
annotations: {}
labels:
app.kubernetes.io/instance: release-name
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: coder-provisioner
app.kubernetes.io/part-of: coder-provisioner
app.kubernetes.io/version: 0.1.0
helm.sh/chart: coder-provisioner-0.1.0
spec:
containers:
- args:
- provisionerd
- start
command:
- /opt/coder
env:
- name: CODER_PROMETHEUS_ADDRESS
value: 0.0.0.0:2112
- name: CODER_PROVISIONER_DAEMON_PSK
valueFrom:
secretKeyRef:
key: psk
name: coder-provisioner-psk
- name: CODER_URL
value: http://coder.default.svc.cluster.local
image: ghcr.io/coder/coder:latest
imagePullPolicy: IfNotPresent
lifecycle: {}
name: coder
ports: null
resources: {}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: null
runAsGroup: 1000
runAsNonRoot: true
runAsUser: 1000
seccompProfile:
type: RuntimeDefault
volumeMounts: []
restartPolicy: Always
serviceAccountName: coder-provisioner
terminationGracePeriodSeconds: 600
volumes: []
6 changes: 6 additions & 0 deletions helm/provisioner/tests/testdata/sa_disabled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coder:
image:
tag: latest
serviceAccount:
workspacePerms: false
disableCreate: true
2 changes: 2 additions & 0 deletions helm/provisioner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ coder:
annotations: {}
# coder.serviceAccount.name -- The service account name
name: coder-provisioner
# coder.serviceAccount.disableCreate -- Whether to create the service account or use existing service account.
disableCreate: false

# coder.securityContext -- Fields related to the container's security
# context (as opposed to the pod). Some fields are also present in the pod
Expand Down