Skip to main content
added 18 characters in body
Source Link
igiannak
  • 220
  • 2
  • 11

Identical resources that have just such small differences are subject to templates.
In Kubernetes, helm is one tool that can help you solve the issue.
Create a helm chart that will deploy the needed deployment and template the fields relate to the sports.
Place a for loop and iterate over the list of sports provided in the values.yaml.
Example of the idea:

# values.yaml
sports:
  - baseball
  - football
  - soccer
  - tennis
   
# templates/pod.yaml
{{- range .Values.sports }}
apiVersion: v1
kind: Pod
metadata:
  name: {{ . }}-pod
spec:
  containers:
  - name: {{ . }}-container
    image: my-image
    env:
    - name: SPORT
      value: {{ . }}
{{- end}}

Identical resources that have just such small differences are subject to templates.
In Kubernetes, helm is one tool that can help you solve the issue.
Create a helm chart that will deploy the needed deployment and template the fields relate to the sports.
Place a for loop and iterate over the list of sports provided in the values.yaml.
Example of the idea:

# values.yaml
sports:
  - baseball
  - football
  - soccer
  - tennis
    
{{- range .Values.sports }}
apiVersion: v1
kind: Pod
metadata:
  name: {{ . }}-pod
spec:
  containers:
  - name: {{ . }}-container
    image: my-image
    env:
    - name: SPORT
      value: {{ . }}
{{- end}}

Identical resources that have just such small differences are subject to templates.
In Kubernetes, helm is one tool that can help you solve the issue.
Create a helm chart that will deploy the needed deployment and template the fields relate to the sports.
Place a for loop and iterate over the list of sports provided in the values.yaml.
Example of the idea:

# values.yaml
sports:
  - baseball
  - football
  - soccer
  - tennis

# templates/pod.yaml
{{- range .Values.sports }}
apiVersion: v1
kind: Pod
metadata:
  name: {{ . }}-pod
spec:
  containers:
  - name: {{ . }}-container
    image: my-image
    env:
    - name: SPORT
      value: {{ . }}
{{- end}}
Source Link
igiannak
  • 220
  • 2
  • 11

Identical resources that have just such small differences are subject to templates.
In Kubernetes, helm is one tool that can help you solve the issue.
Create a helm chart that will deploy the needed deployment and template the fields relate to the sports.
Place a for loop and iterate over the list of sports provided in the values.yaml.
Example of the idea:

# values.yaml
sports:
  - baseball
  - football
  - soccer
  - tennis
    
{{- range .Values.sports }}
apiVersion: v1
kind: Pod
metadata:
  name: {{ . }}-pod
spec:
  containers:
  - name: {{ . }}-container
    image: my-image
    env:
    - name: SPORT
      value: {{ . }}
{{- end}}