I have this kind of template file in helm:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: {{.Values.app.name}}-global-route
namespace: {{.Release.Namespace}}
spec:
hosts:
- "{{.Values.app.name}}-global.{{.Release.Namespace}}.svc.cluster.local"
gateways:
- {{.Values.app.name}}-gateway
- mesh
http:
# 1st priority, to route specific end-user to canary service
- route:
- destination:
host: "{{.Values.app.name}}-global.{{.Release.Namespace}}.svc.cluster.local"
subset: canary
match: {{.Values.infra.trafficRoute.canaryCondition}}
And I want to expose the values.yaml like below:
# default values supplied for templates/* files
app:
name: java-maven-app
infra:
trafficRoute:
canaryCondition:
- headers:
end-user:
exact: apratama
key:
exact: agung
So, basically what I want to achieve is to let end-user (the one who use my helm chart) customize the canary condition. The condition itself is depends on istio's match data structure (which can be nested and complex values).
I tried above with helm upgrade --install command, but somehow I got this error:
Error: UPGRADE FAILED: YAML parse error on java-maven-app-infra/templates/global-service.yaml: error converting YAML to JSON: yaml: line 17: found unexpected ':'
make: *** [deploy-infra] Error 1
However, when I comment out this line:
match: {{.Values.infra.trafficRoute.canaryCondition}}
it works without error.
Any advice?