# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "dud.fullname" . }}-dud
  labels:
  {{- include "dud.labels" . | nindent 4 }}
data:
  BAFFLEMENT: {{ .Values.dud.bafflement | quote }}
  DILAPIDATION_VIOLENCE_REBELLION: {{ .Values.dud.dilapidationViolenceRebellion |
    quote }}
  KNOCK: {{ .Values.dud.knock | quote }}
  LOOSE: {{ .Values.dud.loose | quote }}
  SILKWORM: {{ .Values.dud.silkworm | quote }}
  TRANSACTION: {{ .Values.dud.transaction | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "dud.fullname" . }}-dud
  labels:
  {{- include "dud.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: dud
spec:
  replicas: {{ .Values.dud.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: dud
      app.kubernetes.io/name: vinyl
    {{- include "dud.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: dud
        app.kubernetes.io/name: vinyl
      {{- include "dud.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 516f56faa83306bdbea7a073e453e6584d991cb855105decd8e6cbf770b0155f
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "dud.fullname" . }}-dud
        image: {{ .Values.dud.dud.image.repository }}:{{ .Values.dud.dud.image.tag | default
          .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.dud.dud.imagePullPolicy }}
        name: dud
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.dud.dud.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.dud.dud.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "dud.fullname" . }}-dud
  labels:
  {{- include "dud.labels" . | nindent 4 }}
spec:
  type: {{ .Values.dud.type }}
  selector:
    app.kubernetes.io/instance: dud
    app.kubernetes.io/name: vinyl
  {{- include "dud.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.dud.ports | toYaml | nindent 2 -}}
dud:
  bafflement: restaurant
  dilapidationViolenceRebellion: invite
  dud:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  knock: bird
  loose: spider
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  silkworm: nature
  transaction: vanity
  type: ClusterIP
kubernetesClusterDomain: cluster.local
