# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "whirlpool.fullname" . }}-whirlpool
  labels:
  {{- include "whirlpool.labels" . | nindent 4 }}
data:
  CALM: {{ .Values.whirlpool.calm | quote }}
  LEASH_VINEYARD_TURNOVER: {{ .Values.whirlpool.leashVineyardTurnover | quote }}
  OAK_USAGE: {{ .Values.whirlpool.oakUsage | quote }}
  PATRON_BROOM_BOORISH: {{ .Values.whirlpool.patronBroomBoorish | quote }}
  PLUNGER: {{ .Values.whirlpool.plunger | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "whirlpool.fullname" . }}-whirlpool
  labels:
  {{- include "whirlpool.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: whirlpool
spec:
  replicas: {{ .Values.whirlpool.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: whirlpool
      app.kubernetes.io/name: racing
    {{- include "whirlpool.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: whirlpool
        app.kubernetes.io/name: racing
      {{- include "whirlpool.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 0584512a8085cdab85cc538d9d2681141aa45f75bc0c2e6659db6196de41f78a
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "whirlpool.fullname" . }}-whirlpool
        image: {{ .Values.whirlpool.whirlpool.image.repository }}:{{ .Values.whirlpool.whirlpool.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.whirlpool.whirlpool.imagePullPolicy }}
        name: whirlpool
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.whirlpool.whirlpool.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.whirlpool.whirlpool.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "whirlpool.fullname" . }}-whirlpool
  labels:
  {{- include "whirlpool.labels" . | nindent 4 }}
spec:
  type: {{ .Values.whirlpool.type }}
  selector:
    app.kubernetes.io/instance: whirlpool
    app.kubernetes.io/name: racing
  {{- include "whirlpool.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.whirlpool.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
whirlpool:
  calm: accordion
  leashVineyardTurnover: romance
  oakUsage: captain
  patronBroomBoorish: curiosity
  plunger: poisoning
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  type: ClusterIP
  whirlpool:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
