# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "diner.fullname" . }}-diner
  labels:
  {{- include "diner.labels" . | nindent 4 }}
data:
  DRESSER_PLEDGE_DUE: {{ .Values.diner.dresserPledgeDue | quote }}
  PENICILLIN_GOVERNMENT_FRIGHT: {{ .Values.diner.penicillinGovernmentFright | quote
    }}
  STUDENT_MAIL: {{ .Values.diner.studentMail | quote }}
  TENET: {{ .Values.diner.tenet | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "diner.fullname" . }}-diner
  labels:
  {{- include "diner.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: diner
spec:
  replicas: {{ .Values.diner.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: diner
      app.kubernetes.io/name: gruesome
    {{- include "diner.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: diner
        app.kubernetes.io/name: gruesome
      {{- include "diner.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 5f5c53bc0da89dd7a90e752e38f16b307d71d5be4d119b128b0588e6effa3334
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "diner.fullname" . }}-diner
        image: {{ .Values.diner.diner.image.repository }}:{{ .Values.diner.diner.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.diner.diner.imagePullPolicy }}
        name: diner
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.diner.diner.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.diner.diner.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "diner.fullname" . }}-diner
  labels:
  {{- include "diner.labels" . | nindent 4 }}
spec:
  type: {{ .Values.diner.type }}
  selector:
    app.kubernetes.io/instance: diner
    app.kubernetes.io/name: gruesome
  {{- include "diner.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.diner.ports | toYaml | nindent 2 -}}
diner:
  diner:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  dresserPledgeDue: cost
  penicillinGovernmentFright: coordinate
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  studentMail: elm
  tenet: punishment
  type: ClusterIP
kubernetesClusterDomain: cluster.local
