# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "porcupine.fullname" . }}-porcupine
  labels:
  {{- include "porcupine.labels" . | nindent 4 }}
data:
  ADRENALINE: {{ .Values.porcupine.adrenaline | quote }}
  CLOISTERED_LUNCHROOM: {{ .Values.porcupine.cloisteredLunchroom | quote }}
  EVALUATOR: {{ .Values.porcupine.evaluator | quote }}
  FOLLOWING_CELSIUS: {{ .Values.porcupine.followingCelsius | quote }}
  TAPIOCA: {{ .Values.porcupine.tapioca | quote }}
  TIARA_CRISIS: {{ .Values.porcupine.tiaraCrisis | quote }}
  UNDERTAKER_DRAWBRIDGE: {{ .Values.porcupine.undertakerDrawbridge | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "porcupine.fullname" . }}-porcupine
  labels:
  {{- include "porcupine.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: porcupine
spec:
  replicas: {{ .Values.porcupine.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: porcupine
      app.kubernetes.io/name: mallard
    {{- include "porcupine.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: porcupine
        app.kubernetes.io/name: mallard
      {{- include "porcupine.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 9bef6c6d6b81611938d6f47a5f506093f31b9ebbbe3076d677ca406172283774
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "porcupine.fullname" . }}-porcupine
        image: {{ .Values.porcupine.porcupine.image.repository }}:{{ .Values.porcupine.porcupine.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.porcupine.porcupine.imagePullPolicy }}
        name: porcupine
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.porcupine.porcupine.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.porcupine.porcupine.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "porcupine.fullname" . }}-porcupine
  labels:
  {{- include "porcupine.labels" . | nindent 4 }}
spec:
  type: {{ .Values.porcupine.type }}
  selector:
    app.kubernetes.io/instance: porcupine
    app.kubernetes.io/name: mallard
  {{- include "porcupine.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.porcupine.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
porcupine:
  adrenaline: houseboat
  cloisteredLunchroom: hurt
  evaluator: rye
  followingCelsius: kneejerk
  porcupine:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  tapioca: vein
  tiaraCrisis: zombie
  type: ClusterIP
  undertakerDrawbridge: commitment
