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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data:

EXECUTOR_KUBERNETES_NODE_NAME: "{{ .Values.executor.kubernetesJob.node.name }}"
EXECUTOR_KUBERNETES_NODE_SELECTOR: "{{ .Values.executor.kubernetesJob.node.selector }}"
EXECUTOR_KUBERNETES_NODE_TOLERATIONS: "{{ .Values.executor.kubernetesJob.node.tolerations }}"
EXECUTOR_KUBERNETES_NODE_TOLERATIONS: {{ if kindIs "string" .Values.executor.kubernetesJob.node.tolerations }}{{ .Values.executor.kubernetesJob.node.tolerations | quote }}{{ else }}{{ .Values.executor.kubernetesJob.node.tolerations | toJson | quote }}{{ end }}
EXECUTOR_KUBERNETES_NODE_REQUIRED_AFFINITY_MATCH_EXPRESSIONS: "{{ .Values.executor.kubernetesJob.node.requiredAffinityMatchExpressions }}"
EXECUTOR_KUBERNETES_NODE_REQUIRED_AFFINITY_MATCH_FIELDS: "{{ .Values.executor.kubernetesJob.node.requiredAffinityMatchFields }}"

Expand Down
40 changes: 40 additions & 0 deletions charts/sourcegraph-executor/k8s/tests/executor_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,43 @@ tests:
path: spec.template.spec.securityContext.runAsUser
- isNull:
path: spec.template.spec.securityContext.runAsGroup

- it: should JSON-encode kubernetesJob.node.tolerations when given a YAML list (issue #349)
template: executor.ConfigMap.yaml
set:
executor:
queueName: "test"
kubernetesJob:
node:
tolerations:
- key: foo
operator: Equal
value: bar
effect: NoSchedule
asserts:
- equal:
path: data.EXECUTOR_KUBERNETES_NODE_TOLERATIONS
value: '[{"effect":"NoSchedule","key":"foo","operator":"Equal","value":"bar"}]'

- it: should pass through kubernetesJob.node.tolerations when given a pre-encoded JSON string
template: executor.ConfigMap.yaml
set:
executor:
queueName: "test"
kubernetesJob:
node:
tolerations: '[{"key":"foo","operator":"Equal","value":"bar","effect":"NoSchedule"}]'
asserts:
- equal:
path: data.EXECUTOR_KUBERNETES_NODE_TOLERATIONS
value: '[{"key":"foo","operator":"Equal","value":"bar","effect":"NoSchedule"}]'

- it: should render default kubernetesJob.node.tolerations as empty string
template: executor.ConfigMap.yaml
set:
executor:
queueName: "test"
asserts:
- equal:
path: data.EXECUTOR_KUBERNETES_NODE_TOLERATIONS
value: ""
1 change: 1 addition & 0 deletions scripts/ci/helm-unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ helm plugin install https://github.com/helm-unittest/helm-unittest --version "$H

### Run the helm tests
helm unittest -q charts/sourcegraph
helm unittest -q charts/sourcegraph-executor/k8s