# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "downgrade.fullname" . }}-downgrade
  labels:
  {{- include "downgrade.labels" . | nindent 4 }}
data:
  COMRADESHIP_ENDOTHELIUM: {{ .Values.downgrade.comradeshipEndothelium | quote }}
  CRICKETER: {{ .Values.downgrade.cricketer | quote }}
  DAMP_THRILL_DIRNDL: {{ .Values.downgrade.dampThrillDirndl | quote }}
  INSTINCT_TORTELLINI_SOIL: {{ .Values.downgrade.instinctTortelliniSoil | quote }}
  NEWSPAPER: {{ .Values.downgrade.newspaper | quote }}
  TOMATILLO_PAYEE_MOCHI: {{ .Values.downgrade.tomatilloPayeeMochi | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "downgrade.fullname" . }}-downgrade
  labels:
  {{- include "downgrade.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: downgrade
spec:
  replicas: {{ .Values.downgrade.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: downgrade
      app.kubernetes.io/name: chit-chat
    {{- include "downgrade.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: downgrade
        app.kubernetes.io/name: chit-chat
      {{- include "downgrade.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: f03ea190678d01085a368f8896fdad610a812e30b2a20696eebb8d333ee8d50d
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "downgrade.fullname" . }}-downgrade
        image: {{ .Values.downgrade.downgrade.image.repository }}:{{ .Values.downgrade.downgrade.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.downgrade.downgrade.imagePullPolicy }}
        name: downgrade
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.downgrade.downgrade.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.downgrade.downgrade.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "downgrade.fullname" . }}-downgrade
  labels:
  {{- include "downgrade.labels" . | nindent 4 }}
spec:
  type: {{ .Values.downgrade.type }}
  selector:
    app.kubernetes.io/instance: downgrade
    app.kubernetes.io/name: chit-chat
  {{- include "downgrade.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.downgrade.ports | toYaml | nindent 2 -}}
downgrade:
  comradeshipEndothelium: rose
  cricketer: boogeyman
  dampThrillDirndl: horse
  downgrade:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  instinctTortelliniSoil: rob
  newspaper: developing
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  tomatilloPayeeMochi: doubt
  type: ClusterIP
kubernetesClusterDomain: cluster.local
