# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "forgive.fullname" . }}-forgive
  labels:
  {{- include "forgive.labels" . | nindent 4 }}
data:
  CHEESE: {{ .Values.forgive.cheese | quote }}
  EXTINCTION_STUMBLING: {{ .Values.forgive.extinctionStumbling | quote }}
  FLAVOR_MENU: {{ .Values.forgive.flavorMenu | quote }}
  SUBSTANCE: {{ .Values.forgive.substance | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "forgive.fullname" . }}-forgive
  labels:
  {{- include "forgive.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: forgive
spec:
  replicas: {{ .Values.forgive.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: forgive
      app.kubernetes.io/name: flu
    {{- include "forgive.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: forgive
        app.kubernetes.io/name: flu
      {{- include "forgive.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 5aaf6285c4b3e613539e9ef0882f541ec2cdcf0195d7adbc5a4eb12be6a6fe1b
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "forgive.fullname" . }}-forgive
        image: {{ .Values.forgive.forgive.image.repository }}:{{ .Values.forgive.forgive.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.forgive.forgive.imagePullPolicy }}
        name: forgive
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.forgive.forgive.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.forgive.forgive.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "forgive.fullname" . }}-forgive
  labels:
  {{- include "forgive.labels" . | nindent 4 }}
spec:
  type: {{ .Values.forgive.type }}
  selector:
    app.kubernetes.io/instance: forgive
    app.kubernetes.io/name: flu
  {{- include "forgive.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.forgive.ports | toYaml | nindent 2 -}}
forgive:
  cheese: hospitalization
  extinctionStumbling: custody
  flavorMenu: squirrel
  forgive:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  substance: godmother
  type: ClusterIP
kubernetesClusterDomain: cluster.local
