Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Add nodeSelector implementation and tests to kubernetes helm deployme…
Browse files Browse the repository at this point in the history
…nt. (#4252)

* Add nodeSelector template and tests

Add nodeSelector template to the helm deployment:
- deployment.yaml
- database.yaml
- config-init.yaml

Add tests to validate nodeSelector template to
- deployment_test.yaml

Create tests to validate nodeSelector template to
- database_test.yaml
- config_init_test.yaml

* Add c&p fix and another nodeSelector test

Add fix for c&p bug to
- database.yaml
- deployment.yaml

Add test to validate nodeSelector template to
- config_init_test.yaml

Add test config to
- database-test.yaml
- deployment-test.yaml

* Remove test

Remove test to validate nodeSelector template to
    - config_init_test.yaml
  • Loading branch information
macevil committed May 6, 2020
1 parent c90b07e commit 577bc5e
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deploy/kubernetes/console/templates/config-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ spec:
{{ toYaml .Values.console.podExtraLabels | nindent 8 }}
{{- end }}
spec:
{{- if .Values.configInit }}
nodeSelector:
{{ toYaml .Values.configInit.nodeSelector | indent 8 }}
{{- end }}
containers:
- env:
- name: "STRATOS_VOLUME_MIGRATION"
Expand Down Expand Up @@ -170,6 +174,10 @@ spec:
app.kubernetes.io/version: "{{ .Chart.AppVersion }}"
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
spec:
{{- if .Values.configInit }}
nodeSelector:
{{ toYaml .Values.configInit.nodeSelector | indent 8 }}
{{- end }}
containers:
- env:
- name: "NAMESPACE"
Expand Down
4 changes: 4 additions & 0 deletions deploy/kubernetes/console/templates/database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ spec:
{{ toYaml .Values.console.podExtraLabels | nindent 8 }}
{{- end}}
spec:
{{- if .Values.mariadb }}
nodeSelector:
{{ toYaml .Values.mariadb.nodeSelector | indent 8 }}
{{- end }}
containers:
- name: mariadb
image: {{.Values.kube.registry.hostname}}/{{.Values.kube.organization}}/{{.Values.images.mariadb}}:{{.Values.consoleVersion}}
Expand Down
4 changes: 4 additions & 0 deletions deploy/kubernetes/console/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ spec:
{{ toYaml .Values.console.podExtraLabels | indent 8 }}
{{- end }}
spec:
{{- if .Values.console }}
nodeSelector:
{{ toYaml .Values.console.nodeSelector | indent 8 }}
{{- end }}
containers:
- image: {{.Values.kube.registry.hostname}}/{{.Values.kube.organization}}/{{.Values.images.console}}:{{.Values.consoleVersion}}
imagePullPolicy: {{.Values.imagePullPolicy}}
Expand Down
12 changes: 12 additions & 0 deletions deploy/kubernetes/console/tests/config_init_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
suite: test stratos configInit
templates:
- config-init.yaml
tests:
- it: should set kubernetes.io/arch if configInit.nodeSelector.kubernetes.io/arch is set
set:
configInit.nodeSelector.kubernetes.io/arch: amd64
asserts:
- equal:
path: spec.template.spec.nodeSelector.kubernetes.io/arch
value: amd64
documentIndex: 3
12 changes: 12 additions & 0 deletions deploy/kubernetes/console/tests/database-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
suite: test stratos database
templates:
- database.yaml
tests:
- it: should set kubernetes.io/arch if mariadb.nodeSelector.kubernetes.io/arch is set
set:
mariadb.nodeSelector.kubernetes.io/arch: amd64
asserts:
- equal:
path: spec.template.spec.nodeSelector.kubernetes.io/arch
value: amd64
documentIndex: 0
8 changes: 8 additions & 0 deletions deploy/kubernetes/console/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,11 @@ tests:
content:
name: AUTO_REG_CF_URL
value: https://autoreg.test.com
- it: should set kubernetes.io/arch if console.nodeSelector.kubernetes.io/arch is set
set:
console.nodeSelector.kubernetes.io/arch: amd64
asserts:
- equal:
path: spec.template.spec.nodeSelector.kubernetes.io/arch
value: amd64
documentIndex: 0

0 comments on commit 577bc5e

Please sign in to comment.