# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "program.fullname" . }}-program
  labels:
  {{- include "program.labels" . | nindent 4 }}
data:
  CAMPAIGNING_CHAOS: {{ .Values.program.campaigningChaos | quote }}
  COMBINE_CONSULT_BROWSER: {{ .Values.program.combineConsultBrowser | quote }}
  HEAVY_SNIFFLE: {{ .Values.program.heavySniffle | quote }}
  OXFORD_RINGWORM: {{ .Values.program.oxfordRingworm | quote }}
  PROVIDE_MECCA_FOREGO: {{ .Values.program.provideMeccaForego | quote }}
  SHIN: {{ .Values.program.shin | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "program.fullname" . }}-program
  labels:
  {{- include "program.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: program
spec:
  replicas: {{ .Values.program.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: program
      app.kubernetes.io/name: chug
    {{- include "program.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: program
        app.kubernetes.io/name: chug
      {{- include "program.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 927420b55fd7d627f5b645dccc3c036fa59d4112b3dc7020f2e0f99effca8252
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "program.fullname" . }}-program
        image: {{ .Values.program.program.image.repository }}:{{ .Values.program.program.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.program.program.imagePullPolicy }}
        name: program
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.program.program.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.program.program.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "program.fullname" . }}-program
  labels:
  {{- include "program.labels" . | nindent 4 }}
spec:
  type: {{ .Values.program.type }}
  selector:
    app.kubernetes.io/instance: program
    app.kubernetes.io/name: chug
  {{- include "program.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.program.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
program:
  campaigningChaos: itinerary
  combineConsultBrowser: allowance
  heavySniffle: precision
  oxfordRingworm: hydroxyl
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  program:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  provideMeccaForego: sage
  replicas: 1
  shin: furtive
  type: ClusterIP
