# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "casualty.fullname" . }}-casualty
  labels:
  {{- include "casualty.labels" . | nindent 4 }}
data:
  GYRO_POSTAGE: {{ .Values.casualty.gyroPostage | quote }}
  INPUT_SCRIPTURE: {{ .Values.casualty.inputScripture | quote }}
  PRINT_MYSTERIOUS_EXCELLENCE: {{ .Values.casualty.printMysteriousExcellence | quote
    }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "casualty.fullname" . }}-casualty
  labels:
  {{- include "casualty.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: casualty
spec:
  replicas: {{ .Values.casualty.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: casualty
      app.kubernetes.io/name: connection
    {{- include "casualty.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: casualty
        app.kubernetes.io/name: connection
      {{- include "casualty.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: fc8fabccad7b6d292af9af21c8f57b6fb8a1aac14a0090db12f026c42333b0f2
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "casualty.fullname" . }}-casualty
        image: {{ .Values.casualty.casualty.image.repository }}:{{ .Values.casualty.casualty.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.casualty.casualty.imagePullPolicy }}
        name: casualty
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.casualty.casualty.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.casualty.casualty.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "casualty.fullname" . }}-casualty
  labels:
  {{- include "casualty.labels" . | nindent 4 }}
spec:
  type: {{ .Values.casualty.type }}
  selector:
    app.kubernetes.io/instance: casualty
    app.kubernetes.io/name: connection
  {{- include "casualty.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.casualty.ports | toYaml | nindent 2 -}}
casualty:
  casualty:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  gyroPostage: anchovy
  inputScripture: pitching
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  printMysteriousExcellence: stopsign
  replicas: 1
  type: ClusterIP
kubernetesClusterDomain: cluster.local
