Skip to content

Commit

Permalink
containerPortYaml to allow exotic port setups
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlocph committed Apr 7, 2021
1 parent 35831ac commit ec98a9d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/onechart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.17.0
version: 0.18.0
4 changes: 4 additions & 0 deletions charts/onechart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ spec:
{{- end }}
{{- end }}
ports:
{{- if not .Values.containerPortYaml }}
- name: http
containerPort: {{ .Values.containerPort }}
protocol: TCP
{{ else }}
{{- toYaml .Values.containerPortYaml | nindent 12 }}
{{- end }}
{{- if .Values.probe.enabled }}
readinessProbe:
httpGet:
Expand Down
44 changes: 44 additions & 0 deletions charts/onechart/tests/deployment_contianer_port_yaml_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
suite: test deployment
templates:
- deployment.yaml
- configmap.yaml
tests:
- it: Should set custom ports
set:
containerPortYaml:
- port: 21
targetPort: ftp
protocol: TCP
name: ftp
- port: 3001
targetPort: passive-1
protocol: TCP
name: passive-1
- port: 3002
targetPort: passive-2
protocol: TCP
name: passive-2
asserts:
- equal:
path: spec.template.spec.containers[0].ports
value:
- port: 21
targetPort: ftp
protocol: TCP
name: ftp
- port: 3001
targetPort: passive-1
protocol: TCP
name: passive-1
- port: 3002
targetPort: passive-2
protocol: TCP
name: passive-2
- it: Should set default port
asserts:
- equal:
path: spec.template.spec.containers[0].ports
value:
- name: http
containerPort: 80
protocol: TCP

0 comments on commit ec98a9d

Please sign in to comment.