# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "potty.fullname" . }}-potty
  labels:
  {{- include "potty.labels" . | nindent 4 }}
data:
  DECISIVE_ATTRIBUTE_SATISFACTION: {{ .Values.potty.decisiveAttributeSatisfaction
    | quote }}
  ELM_SPORK: {{ .Values.potty.elmSpork | quote }}
  GUARD: {{ .Values.potty.guard | quote }}
  SKIN: {{ .Values.potty.skin | quote }}
  STRATEGY: {{ .Values.potty.strategy | quote }}
  WINGMAN_NATION_ATRIUM: {{ .Values.potty.wingmanNationAtrium | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "potty.fullname" . }}-potty
  labels:
  {{- include "potty.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: potty
spec:
  replicas: {{ .Values.potty.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: potty
      app.kubernetes.io/name: maddening
    {{- include "potty.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: potty
        app.kubernetes.io/name: maddening
      {{- include "potty.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 3736eef876d2aaec552502db6d51e277d80f92ae54f8eb434e9261209d47341d
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "potty.fullname" . }}-potty
        image: {{ .Values.potty.potty.image.repository }}:{{ .Values.potty.potty.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.potty.potty.imagePullPolicy }}
        name: potty
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.potty.potty.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.potty.potty.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "potty.fullname" . }}-potty
  labels:
  {{- include "potty.labels" . | nindent 4 }}
spec:
  type: {{ .Values.potty.type }}
  selector:
    app.kubernetes.io/instance: potty
    app.kubernetes.io/name: maddening
  {{- include "potty.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.potty.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
potty:
  decisiveAttributeSatisfaction: caribou
  elmSpork: diversity
  guard: input
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  potty:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  replicas: 1
  skin: wagon
  strategy: sleepiness
  type: ClusterIP
  wingmanNationAtrium: piety
