# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "syrup.fullname" . }}-syrup
  labels:
  {{- include "syrup.labels" . | nindent 4 }}
data:
  CD_APE: {{ .Values.syrup.cdApe | quote }}
  FISHMONGER: {{ .Values.syrup.fishmonger | quote }}
  POLYESTER: {{ .Values.syrup.polyester | quote }}
  RELY: {{ .Values.syrup.rely | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "syrup.fullname" . }}-syrup
  labels:
  {{- include "syrup.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: syrup
spec:
  replicas: {{ .Values.syrup.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: syrup
      app.kubernetes.io/name: treatment
    {{- include "syrup.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: syrup
        app.kubernetes.io/name: treatment
      {{- include "syrup.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: b7e36d877950458643dbffd6ba9114ad36fe21d8bc1b9b870e399db973c46291
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "syrup.fullname" . }}-syrup
        image: {{ .Values.syrup.syrup.image.repository }}:{{ .Values.syrup.syrup.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.syrup.syrup.imagePullPolicy }}
        name: syrup
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.syrup.syrup.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.syrup.syrup.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "syrup.fullname" . }}-syrup
  labels:
  {{- include "syrup.labels" . | nindent 4 }}
spec:
  type: {{ .Values.syrup.type }}
  selector:
    app.kubernetes.io/instance: syrup
    app.kubernetes.io/name: treatment
  {{- include "syrup.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.syrup.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
syrup:
  cdApe: chop
  fishmonger: larva
  polyester: footstool
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  rely: archaeology
  replicas: 1
  syrup:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  type: ClusterIP
