# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "programming.fullname" . }}-programming
  labels:
  {{- include "programming.labels" . | nindent 4 }}
data:
  COUPON: {{ .Values.programming.coupon | quote }}
  FEE: {{ .Values.programming.fee | quote }}
  HIGH-PITCHED: {{ .Values.programming.highPitched | quote }}
  MOUND_CRAVAT: {{ .Values.programming.moundCravat | quote }}
  SCREAMER_ACCORD_CHIME: {{ .Values.programming.screamerAccordChime | quote }}
  SUMMIT: {{ .Values.programming.summit | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "programming.fullname" . }}-programming
  labels:
  {{- include "programming.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: programming
spec:
  replicas: {{ .Values.programming.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: programming
      app.kubernetes.io/name: delivery
    {{- include "programming.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: programming
        app.kubernetes.io/name: delivery
      {{- include "programming.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: b7b289272d843b868dc9ad5bdf7edf4ea583ee7fa2e7f2743c70eb61645ec198
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "programming.fullname" . }}-programming
        image: {{ .Values.programming.programming.image.repository }}:{{ .Values.programming.programming.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.programming.programming.imagePullPolicy }}
        name: programming
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.programming.programming.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.programming.programming.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "programming.fullname" . }}-programming
  labels:
  {{- include "programming.labels" . | nindent 4 }}
spec:
  type: {{ .Values.programming.type }}
  selector:
    app.kubernetes.io/instance: programming
    app.kubernetes.io/name: delivery
  {{- include "programming.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.programming.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
programming:
  coupon: civilization
  fee: snowplow
  highPitched: launch
  moundCravat: pointless
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  programming:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  replicas: 1
  screamerAccordChime: quartz
  summit: training
  type: ClusterIP
