I am trying to iterate the values from values.yaml to service.yaml by using Range function in helm. The values are not same in all services so i am facing issue so please help me.
Values.yaml
service1:
name: nginx
protocol: TCP
type: ClusterIP
port: 8080
service2:
protocol: TCP
port: 9000
type: ClusterIP
service3:
name: nginx
protocol: TCP
port: 8080
userstore: 1233
store: abcstore
type: ClusterIP
I need output like this in service.yaml
Service.yaml
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.metadata.name }}
namespace: {{ .Release.Namespace }}
spec:
selector:
app: {{ .Values.metadata.name }}
ports:
- name: nginx
protocol: TCP
port: 8080
- name: userstore
port: 1233
type: ClusterIP
- name: nginx
protocol: TCP
type: ClusterIP
port: 8080
...continue
Thanks in advance