I have a use case similar to this post: How can I update a .yml file, ignoring preexisting Jinja syntax, using Python?
I tried to follow the answers given in that but none of those working for my YAML syntax. Following is my YAML:
kind: Service
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
service: {{ .Chart.Name }}
spec:
{{- if eq .Values.global.node.networkIpVersion "ipv6" }}
ipFamily: IPv6
{{- end }}
type: ClusterIP
ports:
- name: http2-8080
protocol: TCP
port: 8080
targetPort: 8080
selector:
app: {{ .Chart.Name }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}-traffic
labels:
app: {{ .Chart.Name }}
service: {{ .Chart.Name }}-traffic
spec:
ports:
- name: http-2112
port: {{ .Values.global.monitor.prometheusExporter.trafficListenPort }}
protocol: TCP
targetPort: 2112
selector:
app: {{ .Chart.Name }}
Another thing is my YAML has more than one template in it.
My use case is more for Node JS but as I couldn't find any solution in that language so I turned to Python.