# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "printer.fullname" . }}-printer
  labels:
  {{- include "printer.labels" . | nindent 4 }}
data:
  CONGREGATION: {{ .Values.printer.congregation | quote }}
  CROSS-CONTAMINATION_HIP: {{ .Values.printer.crossContaminationHip | quote }}
  GRAFT_SCIENCE: {{ .Values.printer.graftScience | quote }}
  GRAVITAS_PATCH_THEME: {{ .Values.printer.gravitasPatchTheme | quote }}
  MACAROON_FENCING_CHAMPION: {{ .Values.printer.macaroonFencingChampion | quote }}
  SCHOLAR_POOR: {{ .Values.printer.scholarPoor | quote }}
  SUPPER: {{ .Values.printer.supper | quote }}
  TWEET_CASTLE: {{ .Values.printer.tweetCastle | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "printer.fullname" . }}-printer
  labels:
  {{- include "printer.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: printer
spec:
  replicas: {{ .Values.printer.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: printer
      app.kubernetes.io/name: howard
    {{- include "printer.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: printer
        app.kubernetes.io/name: howard
      {{- include "printer.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 2f07f5b77b1776be2f9592389963872a612e12518bd15a4881a1f2a076f066e1
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "printer.fullname" . }}-printer
        image: {{ .Values.printer.printer.image.repository }}:{{ .Values.printer.printer.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.printer.printer.imagePullPolicy }}
        name: printer
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.printer.printer.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.printer.printer.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "printer.fullname" . }}-printer
  labels:
  {{- include "printer.labels" . | nindent 4 }}
spec:
  type: {{ .Values.printer.type }}
  selector:
    app.kubernetes.io/instance: printer
    app.kubernetes.io/name: howard
  {{- include "printer.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.printer.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
printer:
  congregation: ivory
  crossContaminationHip: leopard
  graftScience: earnings
  gravitasPatchTheme: code
  macaroonFencingChampion: spy
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  printer:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  replicas: 1
  scholarPoor: liner
  supper: father-in-law
  tweetCastle: tragedy
  type: ClusterIP
