# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "dragster.fullname" . }}-dragster
  labels:
  {{- include "dragster.labels" . | nindent 4 }}
data:
  DEPENDENT: {{ .Values.dragster.dependent | quote }}
  HARD-HAT_BOG_FAITH: {{ .Values.dragster.hardHatBogFaith | quote }}
  HOMONYM_CRABBY_FRAIL: {{ .Values.dragster.homonymCrabbyFrail | quote }}
  MERCHANT_MINNOW: {{ .Values.dragster.merchantMinnow | quote }}
  NOUN_REPLICATION_JEEP: {{ .Values.dragster.nounReplicationJeep | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "dragster.fullname" . }}-dragster
  labels:
  {{- include "dragster.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: dragster
spec:
  replicas: {{ .Values.dragster.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: dragster
      app.kubernetes.io/name: banjo
    {{- include "dragster.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: dragster
        app.kubernetes.io/name: banjo
      {{- include "dragster.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: f598cbad94f52d55f223a3b284f1191fb3feaceb3b60c53c75f250f7c2a7781b
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "dragster.fullname" . }}-dragster
        image: {{ .Values.dragster.dragster.image.repository }}:{{ .Values.dragster.dragster.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.dragster.dragster.imagePullPolicy }}
        name: dragster
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.dragster.dragster.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.dragster.dragster.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "dragster.fullname" . }}-dragster
  labels:
  {{- include "dragster.labels" . | nindent 4 }}
spec:
  type: {{ .Values.dragster.type }}
  selector:
    app.kubernetes.io/instance: dragster
    app.kubernetes.io/name: banjo
  {{- include "dragster.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.dragster.ports | toYaml | nindent 2 -}}
dragster:
  dependent: armoire
  dragster:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  hardHatBogFaith: clipper
  homonymCrabbyFrail: travel
  merchantMinnow: euphonium
  nounReplicationJeep: morale
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  type: ClusterIP
kubernetesClusterDomain: cluster.local
