# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "dueling.fullname" . }}-dueling
  labels:
  {{- include "dueling.labels" . | nindent 4 }}
data:
  CRECHE: {{ .Values.dueling.creche | quote }}
  DRINKING_LIZARD: {{ .Values.dueling.drinkingLizard | quote }}
  SWIM_SCARY: {{ .Values.dueling.swimScary | quote }}
  WICKED_ENTREE_ANDROID: {{ .Values.dueling.wickedEntreeAndroid | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "dueling.fullname" . }}-dueling
  labels:
  {{- include "dueling.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: dueling
spec:
  replicas: {{ .Values.dueling.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: dueling
      app.kubernetes.io/name: crumb
    {{- include "dueling.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: dueling
        app.kubernetes.io/name: crumb
      {{- include "dueling.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: a6897c3f477de80399f85fb580c09dffe27f25bebe04e5aee846435025266773
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "dueling.fullname" . }}-dueling
        image: {{ .Values.dueling.dueling.image.repository }}:{{ .Values.dueling.dueling.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.dueling.dueling.imagePullPolicy }}
        name: dueling
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.dueling.dueling.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.dueling.dueling.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "dueling.fullname" . }}-dueling
  labels:
  {{- include "dueling.labels" . | nindent 4 }}
spec:
  type: {{ .Values.dueling.type }}
  selector:
    app.kubernetes.io/instance: dueling
    app.kubernetes.io/name: crumb
  {{- include "dueling.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.dueling.ports | toYaml | nindent 2 -}}
dueling:
  creche: reform
  drinkingLizard: institute
  dueling:
    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
  swimScary: dough
  type: ClusterIP
  wickedEntreeAndroid: sofa
kubernetesClusterDomain: cluster.local
