# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "soldier.fullname" . }}-soldier
  labels:
  {{- include "soldier.labels" . | nindent 4 }}
data:
  BEASTIE_TWIST_MISUNDERSTAND: {{ .Values.soldier.beastieTwistMisunderstand | quote
    }}
  COMPUTER_TAPE_WAIT: {{ .Values.soldier.computerTapeWait | quote }}
  EGG: {{ .Values.soldier.egg | quote }}
  ESSAY: {{ .Values.soldier.essay | quote }}
  EXOTIC_VOICELESS_LIVING: {{ .Values.soldier.exoticVoicelessLiving | quote }}
  GLUTAMATE: {{ .Values.soldier.glutamate | quote }}
  PRODUCTIVE_OVERCONFIDENT_WATCH: {{ .Values.soldier.productiveOverconfidentWatch
    | quote }}
  SOLITAIRE: {{ .Values.soldier.solitaire | quote }}
  STOCK_FORGERY_FLANKER: {{ .Values.soldier.stockForgeryFlanker | quote }}
  VETERINARIAN_BALLOON_FREEDOM: {{ .Values.soldier.veterinarianBalloonFreedom | quote
    }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "soldier.fullname" . }}-soldier
  labels:
  {{- include "soldier.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: soldier
spec:
  replicas: {{ .Values.soldier.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: soldier
      app.kubernetes.io/name: cost
    {{- include "soldier.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: soldier
        app.kubernetes.io/name: cost
      {{- include "soldier.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 6e1b8c0534d3f4e731c8e1d45f099160531aea89e745fb96347988fd4b0a2293
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "soldier.fullname" . }}-soldier
        image: {{ .Values.soldier.soldier.image.repository }}:{{ .Values.soldier.soldier.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.soldier.soldier.imagePullPolicy }}
        name: soldier
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.soldier.soldier.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.soldier.soldier.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "soldier.fullname" . }}-soldier
  labels:
  {{- include "soldier.labels" . | nindent 4 }}
spec:
  type: {{ .Values.soldier.type }}
  selector:
    app.kubernetes.io/instance: soldier
    app.kubernetes.io/name: cost
  {{- include "soldier.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.soldier.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
soldier:
  beastieTwistMisunderstand: alphabet
  computerTapeWait: mussel
  egg: preservation
  essay: guilty
  exoticVoicelessLiving: option
  glutamate: numberless
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  productiveOverconfidentWatch: succeed
  replicas: 1
  soldier:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  solitaire: photographer
  stockForgeryFlanker: radiosonde
  type: ClusterIP
  veterinarianBalloonFreedom: dulcimer
