# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "juggernaut.fullname" . }}-juggernaut
  labels:
  {{- include "juggernaut.labels" . | nindent 4 }}
data:
  ALGORITHM: {{ .Values.juggernaut.algorithm | quote }}
  BEATING_STEREOTYPED_ASHAMED: {{ .Values.juggernaut.beatingStereotypedAshamed |
    quote }}
  BUFFER_CLUE: {{ .Values.juggernaut.bufferClue | quote }}
  GUACAMOLE: {{ .Values.juggernaut.guacamole | quote }}
  QUINCE_CONVENTION_SLANG: {{ .Values.juggernaut.quinceConventionSlang | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "juggernaut.fullname" . }}-juggernaut
  labels:
  {{- include "juggernaut.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: juggernaut
spec:
  replicas: {{ .Values.juggernaut.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: juggernaut
      app.kubernetes.io/name: toe
    {{- include "juggernaut.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: juggernaut
        app.kubernetes.io/name: toe
      {{- include "juggernaut.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 5b18af75794952dfc1c44ba2af2488df5a179c699b4a0ef51f24e52f53bce185
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "juggernaut.fullname" . }}-juggernaut
        image: {{ .Values.juggernaut.juggernaut.image.repository }}:{{ .Values.juggernaut.juggernaut.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.juggernaut.juggernaut.imagePullPolicy }}
        name: juggernaut
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.juggernaut.juggernaut.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.juggernaut.juggernaut.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "juggernaut.fullname" . }}-juggernaut
  labels:
  {{- include "juggernaut.labels" . | nindent 4 }}
spec:
  type: {{ .Values.juggernaut.type }}
  selector:
    app.kubernetes.io/instance: juggernaut
    app.kubernetes.io/name: toe
  {{- include "juggernaut.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.juggernaut.ports | toYaml | nindent 2 -}}
juggernaut:
  algorithm: obstacle
  beatingStereotypedAshamed: placode
  bufferClue: hunter
  guacamole: smile
  juggernaut:
    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
  quinceConventionSlang: bang
  replicas: 1
  type: ClusterIP
kubernetesClusterDomain: cluster.local
