# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "shelf.fullname" . }}-shelf
  labels:
  {{- include "shelf.labels" . | nindent 4 }}
data:
  ANGUISH_MOCHI: {{ .Values.shelf.anguishMochi | quote }}
  FLARE_LLAMA: {{ .Values.shelf.flareLlama | quote }}
  INGREDIENT_AGE_ODD: {{ .Values.shelf.ingredientAgeOdd | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "shelf.fullname" . }}-shelf
  labels:
  {{- include "shelf.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: shelf
spec:
  replicas: {{ .Values.shelf.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: shelf
      app.kubernetes.io/name: trapdoor
    {{- include "shelf.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: shelf
        app.kubernetes.io/name: trapdoor
      {{- include "shelf.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: e3f31b2e01b0e1954f0e5abba59a8393bdd15b6d33c38cc6b3e3e7dcfdb10a25
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "shelf.fullname" . }}-shelf
        image: {{ .Values.shelf.shelf.image.repository }}:{{ .Values.shelf.shelf.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.shelf.shelf.imagePullPolicy }}
        name: shelf
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.shelf.shelf.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.shelf.shelf.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "shelf.fullname" . }}-shelf
  labels:
  {{- include "shelf.labels" . | nindent 4 }}
spec:
  type: {{ .Values.shelf.type }}
  selector:
    app.kubernetes.io/instance: shelf
    app.kubernetes.io/name: trapdoor
  {{- include "shelf.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.shelf.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
shelf:
  anguishMochi: wash
  flareLlama: mattress
  ingredientAgeOdd: charset
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  shelf:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  type: ClusterIP
