# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "recipe.fullname" . }}-recipe
  labels:
  {{- include "recipe.labels" . | nindent 4 }}
data:
  ACADEMICS: {{ .Values.recipe.academics | quote }}
  CRINOLINE_CONSIDERATION: {{ .Values.recipe.crinolineConsideration | quote }}
  FACT_SPOT_GUITARIST: {{ .Values.recipe.factSpotGuitarist | quote }}
  MARKETING_SOFTDRINK_RUIN: {{ .Values.recipe.marketingSoftdrinkRuin | quote }}
  TECHNIQUE: {{ .Values.recipe.technique | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "recipe.fullname" . }}-recipe
  labels:
  {{- include "recipe.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: recipe
spec:
  replicas: {{ .Values.recipe.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: recipe
      app.kubernetes.io/name: questionnaire
    {{- include "recipe.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: recipe
        app.kubernetes.io/name: questionnaire
      {{- include "recipe.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 6158c14eac96811d7f3f5306204092c1368ff346721c51ac0659b3e1573b1f28
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "recipe.fullname" . }}-recipe
        image: {{ .Values.recipe.recipe.image.repository }}:{{ .Values.recipe.recipe.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.recipe.recipe.imagePullPolicy }}
        name: recipe
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.recipe.recipe.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.recipe.recipe.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "recipe.fullname" . }}-recipe
  labels:
  {{- include "recipe.labels" . | nindent 4 }}
spec:
  type: {{ .Values.recipe.type }}
  selector:
    app.kubernetes.io/instance: recipe
    app.kubernetes.io/name: questionnaire
  {{- include "recipe.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.recipe.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
recipe:
  academics: screenwriting
  crinolineConsideration: anywhere
  factSpotGuitarist: stuff
  marketingSoftdrinkRuin: wind-chime
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  recipe:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  replicas: 1
  technique: ruby
  type: ClusterIP
