# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "preservation.fullname" . }}-preservation
  labels:
  {{- include "preservation.labels" . | nindent 4 }}
data:
  LED: {{ .Values.preservation.led | quote }}
  MAGGOT: {{ .Values.preservation.maggot | quote }}
  PROMPT: {{ .Values.preservation.prompt | quote }}
  RACISM_ZANY_COMPREHENSION: {{ .Values.preservation.racismZanyComprehension | quote
    }}
  RIPE: {{ .Values.preservation.ripe | quote }}
  THORN_GAFFE: {{ .Values.preservation.thornGaffe | quote }}
  TUTU: {{ .Values.preservation.tutu | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "preservation.fullname" . }}-preservation
  labels:
  {{- include "preservation.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: preservation
spec:
  replicas: {{ .Values.preservation.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: preservation
      app.kubernetes.io/name: classmate
    {{- include "preservation.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: preservation
        app.kubernetes.io/name: classmate
      {{- include "preservation.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 250483bcd3b99f6b4d97a62f3019aacdf262ee711258eb9c637c4652026e5dc1
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "preservation.fullname" . }}-preservation
        image: {{ .Values.preservation.preservation.image.repository }}:{{ .Values.preservation.preservation.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.preservation.preservation.imagePullPolicy }}
        name: preservation
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.preservation.preservation.resources | nindent 10
          }}
        securityContext: {{- toYaml .Values.preservation.preservation.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "preservation.fullname" . }}-preservation
  labels:
  {{- include "preservation.labels" . | nindent 4 }}
spec:
  type: {{ .Values.preservation.type }}
  selector:
    app.kubernetes.io/instance: preservation
    app.kubernetes.io/name: classmate
  {{- include "preservation.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.preservation.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
preservation:
  led: avocado
  maggot: competitor
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  preservation:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  prompt: workforce
  racismZanyComprehension: sympathy
  replicas: 1
  ripe: plough
  thornGaffe: inhibitor
  tutu: friction
  type: ClusterIP
