# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "discretion.fullname" . }}-discretion
  labels:
  {{- include "discretion.labels" . | nindent 4 }}
data:
  ALDER_MAGICAL_CROW: {{ .Values.discretion.alderMagicalCrow | quote }}
  BORROW_INCUBATION: {{ .Values.discretion.borrowIncubation | quote }}
  BUZZARD_PRESCRIPTION: {{ .Values.discretion.buzzardPrescription | quote }}
  CYMBAL_NESTLING: {{ .Values.discretion.cymbalNestling | quote }}
  KNICKERS_SCRUB_TAXI: {{ .Values.discretion.knickersScrubTaxi | quote }}
  TIMING_HIERARCHY: {{ .Values.discretion.timingHierarchy | quote }}
  WARDEN_SLIMY_TERRORIST: {{ .Values.discretion.wardenSlimyTerrorist | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "discretion.fullname" . }}-discretion
  labels:
  {{- include "discretion.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: discretion
spec:
  replicas: {{ .Values.discretion.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: discretion
      app.kubernetes.io/name: smock
    {{- include "discretion.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: discretion
        app.kubernetes.io/name: smock
      {{- include "discretion.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 2602181806d01407cb9b4f31881f1385d0a42f22047826258fd8d0fb30746b70
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "discretion.fullname" . }}-discretion
        image: {{ .Values.discretion.discretion.image.repository }}:{{ .Values.discretion.discretion.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.discretion.discretion.imagePullPolicy }}
        name: discretion
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.discretion.discretion.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.discretion.discretion.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "discretion.fullname" . }}-discretion
  labels:
  {{- include "discretion.labels" . | nindent 4 }}
spec:
  type: {{ .Values.discretion.type }}
  selector:
    app.kubernetes.io/instance: discretion
    app.kubernetes.io/name: smock
  {{- include "discretion.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.discretion.ports | toYaml | nindent 2 -}}
discretion:
  alderMagicalCrow: carry
  borrowIncubation: auction
  buzzardPrescription: pannier
  cymbalNestling: message
  discretion:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  knickersScrubTaxi: teapot
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  timingHierarchy: eclipse
  type: ClusterIP
  wardenSlimyTerrorist: lumber
kubernetesClusterDomain: cluster.local
