# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "construct.fullname" . }}-construct
  labels:
  {{- include "construct.labels" . | nindent 4 }}
data:
  COLLAPSE: {{ .Values.construct.collapse | quote }}
  ENTREPRENEUR_KNITTING: {{ .Values.construct.entrepreneurKnitting | quote }}
  LETTER_EXECUTION: {{ .Values.construct.letterExecution | quote }}
  MAGNITUDE_SING: {{ .Values.construct.magnitudeSing | quote }}
  PERMIT_RIOT: {{ .Values.construct.permitRiot | quote }}
  TOURNAMENT_QUICK_OPPONENT: {{ .Values.construct.tournamentQuickOpponent | quote
    }}
  TRICK_PENNANT: {{ .Values.construct.trickPennant | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "construct.fullname" . }}-construct
  labels:
  {{- include "construct.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: construct
spec:
  replicas: {{ .Values.construct.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: construct
      app.kubernetes.io/name: sunflower
    {{- include "construct.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: construct
        app.kubernetes.io/name: sunflower
      {{- include "construct.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 2344d8031e2d05ada05119fd78eb3c6a1d831e8c76005fb90921816afa3eec26
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "construct.fullname" . }}-construct
        image: {{ .Values.construct.construct.image.repository }}:{{ .Values.construct.construct.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.construct.construct.imagePullPolicy }}
        name: construct
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.construct.construct.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.construct.construct.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "construct.fullname" . }}-construct
  labels:
  {{- include "construct.labels" . | nindent 4 }}
spec:
  type: {{ .Values.construct.type }}
  selector:
    app.kubernetes.io/instance: construct
    app.kubernetes.io/name: sunflower
  {{- include "construct.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.construct.ports | toYaml | nindent 2 -}}
construct:
  collapse: sherry
  construct:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  entrepreneurKnitting: force
  letterExecution: wasabi
  magnitudeSing: candle
  permitRiot: barracks
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  tournamentQuickOpponent: animated
  trickPennant: bafflement
  type: ClusterIP
kubernetesClusterDomain: cluster.local
