Skip to content

Commit

Permalink
fix(ingress): implement pathType customization
Browse files Browse the repository at this point in the history
  • Loading branch information
jack1902 authored and eshepelyuk committed Jan 21, 2022
1 parent 6c56aa3 commit c19a21f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
7 changes: 5 additions & 2 deletions templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ spec:
http:
paths:
- path: {{ .Values.ingress.path | quote }}
pathType: {{ .Values.ingress.pathType | default "ImplementationSpecific" | quote }}
backend:
serviceName: {{ include "cmak.name" . | quote }}
servicePort: {{ .Values.ui.port }}
service:
name: {{ include "cmak.name" . | quote }}
port:
number: {{ .Values.ui.port }}
{{- end }}
4 changes: 4 additions & 0 deletions test/linter/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ if [ $? -eq 0 ]; then
exit 1
fi

helm lint . --strict --set 'ingress.pathType=true'
if [ $? -eq 0 ]; then
exit 1
fi

31 changes: 31 additions & 0 deletions test/unit/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
suite: ingress
templates:
- ingress.yaml
tests:
- it: should not render by defaul
asserts:
- hasDocuments:
count: 0
- it: should use pathType ImplementaionSpecific by default
set:
ingress:
host: myhost
path: /
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.rules[0].http.paths[0].pathType
value: ImplementationSpecific
- it: should use pathType ImplementaionSpecific by default
set:
ingress:
host: myhost
path: /
pathType: Prefix
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.rules[0].http.paths[0].pathType
value: Prefix
1 change: 1 addition & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"properties": {
"host": { "type": "string", "title": "ingress host" },
"path": { "type": "string", "title": "ingress path" },
"pathType": { "type": "string", "title": "ingress pathType", "default": "ImplementationSpecific" },
"tls": { "$ref": "#/definitions/tls" },
"labels": { "type": "object", "title": "optional ingress labels", "default": {} },
"annotations": { "type": "object", "title": "optional ingress annotations", "default": {} }
Expand Down
1 change: 1 addition & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ ingress: null
#
# # ingress path
# path: /
# pathType: ImplementationSpecific
#
# # Enable TLS configuration for the hostname defined at ingress.host
# # secret name will be "${ingress.host.replace(".", "-")}"
Expand Down

0 comments on commit c19a21f

Please sign in to comment.