# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "spinach.fullname" . }}-spinach
  labels:
  {{- include "spinach.labels" . | nindent 4 }}
data:
  CEREAL: {{ .Values.spinach.cereal | quote }}
  DECONGESTANT: {{ .Values.spinach.decongestant | quote }}
  EMU: {{ .Values.spinach.emu | quote }}
  FEARLESS: {{ .Values.spinach.fearless | quote }}
  KIMONO_INTELLECT: {{ .Values.spinach.kimonoIntellect | quote }}
  PASSIVE: {{ .Values.spinach.passive | quote }}
  TREASURE_VOLUME: {{ .Values.spinach.treasureVolume | quote }}
  ULTIMATUM: {{ .Values.spinach.ultimatum | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "spinach.fullname" . }}-spinach
  labels:
  {{- include "spinach.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: spinach
spec:
  replicas: {{ .Values.spinach.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: spinach
      app.kubernetes.io/name: misunderstand
    {{- include "spinach.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: spinach
        app.kubernetes.io/name: misunderstand
      {{- include "spinach.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: a64305ff18cd356a000ff38f8060ade834df28c1dde84bd15b7644d28d3f65b6
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "spinach.fullname" . }}-spinach
        image: {{ .Values.spinach.spinach.image.repository }}:{{ .Values.spinach.spinach.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.spinach.spinach.imagePullPolicy }}
        name: spinach
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.spinach.spinach.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.spinach.spinach.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "spinach.fullname" . }}-spinach
  labels:
  {{- include "spinach.labels" . | nindent 4 }}
spec:
  type: {{ .Values.spinach.type }}
  selector:
    app.kubernetes.io/instance: spinach
    app.kubernetes.io/name: misunderstand
  {{- include "spinach.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.spinach.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
spinach:
  cereal: analyze
  decongestant: missile
  emu: screening
  fearless: bargain
  kimonoIntellect: wait
  passive: idea
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  spinach:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  treasureVolume: tongue
  type: ClusterIP
  ultimatum: lawsuit
