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