Skip to content

Commit

Permalink
feat: add ingressClassName
Browse files Browse the repository at this point in the history
  • Loading branch information
d-mankowski-synerise authored and eshepelyuk committed Nov 30, 2022
1 parent 02b6817 commit 3001ffa
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 4 deletions.
3 changes: 3 additions & 0 deletions templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ metadata:
{{- . | toYaml | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className | quote }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
- hosts:
Expand Down
12 changes: 10 additions & 2 deletions test/linter/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ if [ $? -eq 0 ]; then
exit 1
fi

helm lint . --strict --set 'ingress.className={1,2,3}' --set 'ingress.host=google' --set 'ingress.path=/'
if [ $? -eq 0 ]; then
exit 1
fi

helm lint . --strict --set 'ingress.className=nginx' --set 'ingress.host=google' --set 'ingress.path=/'
if [ $? -ne 0 ]; then
exit 1
fi

helm lint . --strict --set 'ui.extraEnv=false'
if [ $? -eq 0 ]; then
exit 1
Expand All @@ -69,5 +79,3 @@ helm lint . --strict --set 'ui.extraEnv[0].name=qwe' --set 'ui.extraEnv[0].value
if [ $? -ne 0 ]; then
exit -1
fi


2 changes: 1 addition & 1 deletion test/linter/values-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ reconcile:
ingress:
host: "cmak"
path: "/"
className: "nginx"
labels:
my.label: "my.value"

22 changes: 22 additions & 0 deletions test/unit/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,25 @@ tests:
- equal:
path: spec.rules[0].http.paths[0].pathType
value: Prefix
- it: should not render spec.ingressClassName by default
set:
ingress:
host: myhost
path: /
pathType: Prefix
asserts:
- isEmpty:
path: spec.ingressClassName
- it: should render spec.ingressClassName if specified
set:
ingress:
host: myhost
path: /
pathType: Prefix
className: nginx
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.ingressClassName
value: nginx
1 change: 1 addition & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
"path": { "type": "string", "title": "ingress path" },
"pathType": { "type": "string", "title": "ingress pathType", "default": "ImplementationSpecific" },
"tls": { "$ref": "#/definitions/tls" },
"className": { "type": ["null", "string"], "title": "ingress class name", "default": null },
"labels": { "type": "object", "title": "optional ingress labels", "default": {} },
"annotations": { "type": "object", "title": "optional ingress annotations", "default": {} }
}
Expand Down
2 changes: 1 addition & 1 deletion values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ ingress: null
# # ingress
# path: /
# pathType: ImplementationSpecific
# className: nginx
#
# # Enable TLS configuration for the hostname defined at ingress.host
# # secret name will be "${ingress.host.replace(".", "-")}"
Expand All @@ -156,4 +157,3 @@ affinity: {}
nodeSelector: {}

tolerations: []

0 comments on commit 3001ffa

Please sign in to comment.