Open
Description
deployment yaml file
{{ range .Values.deployments }}
---
{{- if .service.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .name }}
spec:
type: {{ .service.type }}
ports:
- port: {{ .service.port }}
targetPort: {{ .service.port }}
selector:
app: {{ .name }}
{{- end }}
{{- if .dep.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .name }}
spec:
replicas: {{ .replicas }}
selector:
matchLabels:
app: {{ .name }}
template:
metadata:
labels:
app: {{ .name }}
spec:
containers:
- name: {{ .name }}
image: {{ .image }}
{{- end }}
{{ end }}
values file
deployments:
- name: dep1
replicas: 2
image: dep1-image:latest
dep:
enabled: false
service:
enabled: false
type: ClusterIP
port: 80
- name: dep2
replicas: 3
image: dep2-image:latest
dep:
enabled: true
service:
enabled: true
type: ClusterIP
port: 80
- name: dep3
replicas: 1
image: dep2-image:latest
dep:
enabled: true
service:
enabled: true
type: ClusterIP
port: 80
Helm template output
---
# Source: deploy/templates/depl.yaml
---
apiVersion: v1
kind: Service
metadata:
name: dep2
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
selector:
app: dep2
apiVersion: apps/v1
kind: Deployment
metadata:
name: dep2
spec:
replicas: 3
selector:
matchLabels:
app: dep2
template:
metadata:
labels:
app: dep2
spec:
containers:
- name: dep2
image: dep2-image:latest
---
# Source: deploy/templates/depl.yaml
apiVersion: v1
kind: Service
metadata:
name: dep3
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
selector:
app: dep3
apiVersion: apps/v1
kind: Deployment
metadata:
name: dep3
spec:
replicas: 1
selector:
matchLabels:
app: dep3
template:
metadata:
labels:
app: dep3
spec:
containers:
- name: dep3
image: dep2-image:latest
as per values file it needs to create deployment with name dep2 and dep3 and a service for dep2 and dep 3 . but it is not working in this pattern. can you please check this.
Metadata
Assignees
Labels
No labels