# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "cannibal.fullname" . }}-cannibal
  labels:
  {{- include "cannibal.labels" . | nindent 4 }}
data:
  ALIVE: {{ .Values.cannibal.alive | quote }}
  ARRAY: {{ .Values.cannibal.array | quote }}
  PRIOR: {{ .Values.cannibal.prior | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "cannibal.fullname" . }}-cannibal
  labels:
  {{- include "cannibal.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: cannibal
spec:
  replicas: {{ .Values.cannibal.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: cannibal
      app.kubernetes.io/name: adverb
    {{- include "cannibal.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: cannibal
        app.kubernetes.io/name: adverb
      {{- include "cannibal.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 27f0c4715e7d54bf8dcb01b9a66251ac3c1670685bc1e23c1c0af4995e4e607e
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "cannibal.fullname" . }}-cannibal
        image: {{ .Values.cannibal.cannibal.image.repository }}:{{ .Values.cannibal.cannibal.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.cannibal.cannibal.imagePullPolicy }}
        name: cannibal
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.cannibal.cannibal.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.cannibal.cannibal.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "cannibal.fullname" . }}-cannibal
  labels:
  {{- include "cannibal.labels" . | nindent 4 }}
spec:
  type: {{ .Values.cannibal.type }}
  selector:
    app.kubernetes.io/instance: cannibal
    app.kubernetes.io/name: adverb
  {{- include "cannibal.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.cannibal.ports | toYaml | nindent 2 -}}
cannibal:
  alive: git
  array: slippery
  cannibal:
    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
  prior: castanet
  replicas: 1
  type: ClusterIP
kubernetesClusterDomain: cluster.local
