# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "tow-truck.fullname" . }}-tow-truck
  labels:
  {{- include "tow-truck.labels" . | nindent 4 }}
data:
  CORRUPTION: {{ .Values.towTruck.corruption | quote }}
  ECHIDNA: {{ .Values.towTruck.echidna | quote }}
  FOAL: {{ .Values.towTruck.foal | quote }}
  MAJESTIC: {{ .Values.towTruck.majestic | quote }}
  MEASURE_BLIZZARD: {{ .Values.towTruck.measureBlizzard | quote }}
  POEM_CHURCH_BOOGEYMAN: {{ .Values.towTruck.poemChurchBoogeyman | quote }}
  TURNING: {{ .Values.towTruck.turning | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "tow-truck.fullname" . }}-tow-truck
  labels:
  {{- include "tow-truck.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: tow-truck
spec:
  replicas: {{ .Values.towTruck.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: tow-truck
      app.kubernetes.io/name: uptight
    {{- include "tow-truck.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: tow-truck
        app.kubernetes.io/name: uptight
      {{- include "tow-truck.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 979a24a30b0c5e30c3d420f994da13f9566e2067dee2ce96153309703b6c0401
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "tow-truck.fullname" . }}-tow-truck
        image: {{ .Values.towTruck.towTruck.image.repository }}:{{ .Values.towTruck.towTruck.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.towTruck.towTruck.imagePullPolicy }}
        name: tow-truck
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.towTruck.towTruck.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.towTruck.towTruck.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "tow-truck.fullname" . }}-tow-truck
  labels:
  {{- include "tow-truck.labels" . | nindent 4 }}
spec:
  type: {{ .Values.towTruck.type }}
  selector:
    app.kubernetes.io/instance: tow-truck
    app.kubernetes.io/name: uptight
  {{- include "tow-truck.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.towTruck.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
towTruck:
  corruption: succeed
  echidna: silo
  foal: chastity
  majestic: surname
  measureBlizzard: poem
  poemChurchBoogeyman: processor
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  towTruck:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  turning: jewel
  type: ClusterIP
