# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "metaphor.fullname" . }}-metaphor
  labels:
  {{- include "metaphor.labels" . | nindent 4 }}
data:
  BLUEBERRY: {{ .Values.metaphor.blueberry | quote }}
  DEPARTURE_FIELD_LEAVER: {{ .Values.metaphor.departureFieldLeaver | quote }}
  PEANUT_VISUAL: {{ .Values.metaphor.peanutVisual | quote }}
  PENNANT_WILD: {{ .Values.metaphor.pennantWild | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "metaphor.fullname" . }}-metaphor
  labels:
  {{- include "metaphor.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: metaphor
spec:
  replicas: {{ .Values.metaphor.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: metaphor
      app.kubernetes.io/name: mister
    {{- include "metaphor.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: metaphor
        app.kubernetes.io/name: mister
      {{- include "metaphor.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: c78093aaf801c597eed17d87d8328eacde340449674064e8f066463d6338933d
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "metaphor.fullname" . }}-metaphor
        image: {{ .Values.metaphor.metaphor.image.repository }}:{{ .Values.metaphor.metaphor.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.metaphor.metaphor.imagePullPolicy }}
        name: metaphor
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.metaphor.metaphor.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.metaphor.metaphor.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "metaphor.fullname" . }}-metaphor
  labels:
  {{- include "metaphor.labels" . | nindent 4 }}
spec:
  type: {{ .Values.metaphor.type }}
  selector:
    app.kubernetes.io/instance: metaphor
    app.kubernetes.io/name: mister
  {{- include "metaphor.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.metaphor.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
metaphor:
  blueberry: harmonica
  departureFieldLeaver: foamy
  metaphor:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  peanutVisual: hosiery
  pennantWild: upward
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  type: ClusterIP
