Closed Jenil2910 closed 6 years ago
We also ran into this issue when using an optional helm template like the following:
{{- if .Values.ingress.enabled -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-chart
spec:
rules:
- host: my-host
http:
paths:
- path: /
backend:
serviceName: my-service
servicePort: https
{{- end }}
When .Values.ingress.enabled
equals true
we get:
---
# Source: my-chart/templates/ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-ingress
spec:
rules:
- host: my-host
http:
paths:
- path: /
backend:
serviceName: my-service
servicePort: https
When it equals false
:
---
# Source: my-chart/templates/ingress.yaml
Combining this with kubeval and setting ingress.enabled to false...
$ helm template my-chart --set ingress.enabled=false -x templates/ingress.yaml | kubeval
Actual output:
1 error occurred:
* Missing a kind key
Expected output with an exit code of 0:
The document stdin is empty
When .Values.ingress.enabled
is true
it works as expected:
$ helm template my-chart --set ingress.enabled=true -x templates/ingress.yaml | kubeval
The document stdin contains a valid Ingress
Duplicate of https://github.com/garethr/kubeval/pull/61 ?
File: example.yaml
Log:
EDIT: inner '#' causes no problem.