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