# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "competition.fullname" . }}-competition
  labels:
  {{- include "competition.labels" . | nindent 4 }}
data:
  ABIDING_MATURE_GADGET: {{ .Values.competition.abidingMatureGadget | quote }}
  APPETITE_SORDID: {{ .Values.competition.appetiteSordid | quote }}
  BURN-OUT_TOBACCO_SUGAR: {{ .Values.competition.burnOutTobaccoSugar | quote }}
  SUPREME: {{ .Values.competition.supreme | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "competition.fullname" . }}-competition
  labels:
  {{- include "competition.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: competition
spec:
  replicas: {{ .Values.competition.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: competition
      app.kubernetes.io/name: ferryboat
    {{- include "competition.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: competition
        app.kubernetes.io/name: ferryboat
      {{- include "competition.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 4e6dcfd300e582e1dea87b498a168f88e8fc13f8c9974b6bc08576ad2f405e30
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "competition.fullname" . }}-competition
        image: {{ .Values.competition.competition.image.repository }}:{{ .Values.competition.competition.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.competition.competition.imagePullPolicy }}
        name: competition
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.competition.competition.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.competition.competition.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "competition.fullname" . }}-competition
  labels:
  {{- include "competition.labels" . | nindent 4 }}
spec:
  type: {{ .Values.competition.type }}
  selector:
    app.kubernetes.io/instance: competition
    app.kubernetes.io/name: ferryboat
  {{- include "competition.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.competition.ports | toYaml | nindent 2 -}}
competition:
  abidingMatureGadget: oasis
  appetiteSordid: compassionate
  burnOutTobaccoSugar: dark
  competition:
    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
  supreme: disagree
  type: ClusterIP
kubernetesClusterDomain: cluster.local
