# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "forager.fullname" . }}-forager
  labels:
  {{- include "forager.labels" . | nindent 4 }}
data:
  BONFIRE_RANK: {{ .Values.forager.bonfireRank | quote }}
  CREW_SHY_NETBALL: {{ .Values.forager.crewShyNetball | quote }}
  DAWN_PANCREAS: {{ .Values.forager.dawnPancreas | quote }}
  RIDDLE: {{ .Values.forager.riddle | quote }}
  THING: {{ .Values.forager.thing | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "forager.fullname" . }}-forager
  labels:
  {{- include "forager.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: forager
spec:
  replicas: {{ .Values.forager.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: forager
      app.kubernetes.io/name: handsomely
    {{- include "forager.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: forager
        app.kubernetes.io/name: handsomely
      {{- include "forager.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 3877f98cffca881976f4614e25985df8d6e8c34fe0e14293625ae478bb4443c4
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "forager.fullname" . }}-forager
        image: {{ .Values.forager.forager.image.repository }}:{{ .Values.forager.forager.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.forager.forager.imagePullPolicy }}
        name: forager
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.forager.forager.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.forager.forager.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "forager.fullname" . }}-forager
  labels:
  {{- include "forager.labels" . | nindent 4 }}
spec:
  type: {{ .Values.forager.type }}
  selector:
    app.kubernetes.io/instance: forager
    app.kubernetes.io/name: handsomely
  {{- include "forager.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.forager.ports | toYaml | nindent 2 -}}
forager:
  bonfireRank: clover
  crewShyNetball: raincoat
  dawnPancreas: republican
  forager:
    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
  riddle: aluminium
  thing: tandem
  type: ClusterIP
kubernetesClusterDomain: cluster.local
