# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "foal.fullname" . }}-foal
  labels:
  {{- include "foal.labels" . | nindent 4 }}
data:
  AUSPICIOUS: {{ .Values.foal.auspicious | quote }}
  DOUGH_MAGNET: {{ .Values.foal.doughMagnet | quote }}
  GAUDY_BEAR: {{ .Values.foal.gaudyBear | quote }}
  HUMOR: {{ .Values.foal.humor | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "foal.fullname" . }}-foal
  labels:
  {{- include "foal.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: foal
spec:
  replicas: {{ .Values.foal.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: foal
      app.kubernetes.io/name: habitat
    {{- include "foal.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: foal
        app.kubernetes.io/name: habitat
      {{- include "foal.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: cc661609aec0d44ae399d36cf7b0e34f60847f4d22fe2e31672a9c24f50d33b4
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "foal.fullname" . }}-foal
        image: {{ .Values.foal.foal.image.repository }}:{{ .Values.foal.foal.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.foal.foal.imagePullPolicy }}
        name: foal
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.foal.foal.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.foal.foal.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "foal.fullname" . }}-foal
  labels:
  {{- include "foal.labels" . | nindent 4 }}
spec:
  type: {{ .Values.foal.type }}
  selector:
    app.kubernetes.io/instance: foal
    app.kubernetes.io/name: habitat
  {{- include "foal.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.foal.ports | toYaml | nindent 2 -}}
foal:
  auspicious: forehead
  doughMagnet: toot
  foal:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  gaudyBear: used
  humor: puzzle
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  type: ClusterIP
kubernetesClusterDomain: cluster.local
