# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "underwire.fullname" . }}-underwire
  labels:
  {{- include "underwire.labels" . | nindent 4 }}
data:
  ABNORMALITY: {{ .Values.underwire.abnormality | quote }}
  INSTITUTE: {{ .Values.underwire.institute | quote }}
  LILAC: {{ .Values.underwire.lilac | quote }}
  NIGHTGOWN_WINGMAN_CARPORT: {{ .Values.underwire.nightgownWingmanCarport | quote
    }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "underwire.fullname" . }}-underwire
  labels:
  {{- include "underwire.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: underwire
spec:
  replicas: {{ .Values.underwire.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: underwire
      app.kubernetes.io/name: snake
    {{- include "underwire.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: underwire
        app.kubernetes.io/name: snake
      {{- include "underwire.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 56fe0a968c13c046beb35f8b4aa558a60b3e4b1bb9bfa8dec07b622d2c9f1231
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "underwire.fullname" . }}-underwire
        image: {{ .Values.underwire.underwire.image.repository }}:{{ .Values.underwire.underwire.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.underwire.underwire.imagePullPolicy }}
        name: underwire
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.underwire.underwire.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.underwire.underwire.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "underwire.fullname" . }}-underwire
  labels:
  {{- include "underwire.labels" . | nindent 4 }}
spec:
  type: {{ .Values.underwire.type }}
  selector:
    app.kubernetes.io/instance: underwire
    app.kubernetes.io/name: snake
  {{- include "underwire.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.underwire.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
underwire:
  abnormality: till
  institute: journey
  lilac: hut
  nightgownWingmanCarport: monopoly
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  type: ClusterIP
  underwire:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
