# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "achiever.fullname" . }}-achiever
  labels:
  {{- include "achiever.labels" . | nindent 4 }}
data:
  DUFFEL_BLADE_MARIONBERRY: {{ .Values.achiever.duffelBladeMarionberry | quote }}
  LAMB_PLATFORM_ARMY: {{ .Values.achiever.lambPlatformArmy | quote }}
  PILAF_TERIYAKI_GALE: {{ .Values.achiever.pilafTeriyakiGale | quote }}
  TEEPEE_THEOLOGY: {{ .Values.achiever.teepeeTheology | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "achiever.fullname" . }}-achiever
  labels:
  {{- include "achiever.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: achiever
spec:
  replicas: {{ .Values.achiever.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: achiever
      app.kubernetes.io/name: end
    {{- include "achiever.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: achiever
        app.kubernetes.io/name: end
      {{- include "achiever.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 3a2a8f433f495433ae34d11bb98e5b683af2dc4268a0a248d05ee3bcd8eeb2ae
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "achiever.fullname" . }}-achiever
        image: {{ .Values.achiever.achiever.image.repository }}:{{ .Values.achiever.achiever.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.achiever.achiever.imagePullPolicy }}
        name: achiever
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.achiever.achiever.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.achiever.achiever.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "achiever.fullname" . }}-achiever
  labels:
  {{- include "achiever.labels" . | nindent 4 }}
spec:
  type: {{ .Values.achiever.type }}
  selector:
    app.kubernetes.io/instance: achiever
    app.kubernetes.io/name: end
  {{- include "achiever.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.achiever.ports | toYaml | nindent 2 -}}
achiever:
  achiever:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  duffelBladeMarionberry: wildebeest
  lambPlatformArmy: slit
  pilafTeriyakiGale: copy
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  teepeeTheology: alphabet
  type: ClusterIP
kubernetesClusterDomain: cluster.local
