yannh / kubeconform

A FAST Kubernetes manifests validator, with support for Custom Resources!
Apache License 2.0
2.07k stars 116 forks source link

Kubeconform errors out with DestinationRule, cannot find ':' #257

Open esn89 opened 6 months ago

esn89 commented 6 months ago

I have the follow DestinationRule from Istio:

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: test
  namespace: '{{ .Values.namespace }}'
spec:
  host: test.{{ .Values.namespace }}.svc.cluster.local
  trafficPolicy:
    connectionPool:
      http:
        http2MaxRequests: {{ .Values.requests }}
        maxRetries: {{ .Values.retries }}
      tcp:
        maxConnections: {{ .Values.tcpmaxconnections }}
    loadBalancer:
      simple: RANDOM
      localityLbSetting:
        enabled: {{ .Values.enabled }}
    {{- if .Values.yes }}
    outlierDetection:
      baseEjectionTime: {{ .Values.outlierbaseejectiontime }}
      consecutiveErrors: {{ .Values.outlierconsecutiveerrors }}
      interval: {{ .Values.outlierinterval }}
    {{- end }}
    tls:
      mode: ISTIO_MUTUAL

I am using schema from here: https://github.com/datreeio/CRDs-catalog/blob/main/networking.istio.io/destinationrule_v1alpha3.json

./kubeconform -schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/networking.istio.io/destinationrule_v1alpha3.json' -verbose -summary -strict templates/dr.yaml 
templates/dr.yaml - failed validation: error unmarshalling resource: error converting YAML to JSON: yaml: line 20: could not find expected ':'
Summary: 1 resource found in 1 file - Valid: 0, Invalid: 0, Errors: 1, Skipped: 0

That shouldn't happen though as helm lint says it is fine.