# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "inexpensive.fullname" . }}-inexpensive
  labels:
  {{- include "inexpensive.labels" . | nindent 4 }}
data:
  CANTEEN: {{ .Values.inexpensive.canteen | quote }}
  ECUMENIST_GRAPEFRUIT: {{ .Values.inexpensive.ecumenistGrapefruit | quote }}
  PORK_JACKAL: {{ .Values.inexpensive.porkJackal | quote }}
  ZOO: {{ .Values.inexpensive.zoo | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "inexpensive.fullname" . }}-inexpensive
  labels:
  {{- include "inexpensive.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: inexpensive
spec:
  replicas: {{ .Values.inexpensive.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: inexpensive
      app.kubernetes.io/name: microlending
    {{- include "inexpensive.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: inexpensive
        app.kubernetes.io/name: microlending
      {{- include "inexpensive.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: cb5f5938b3d62181fb9fd31902f27e35188958f71253973b47ab79cc12be340f
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "inexpensive.fullname" . }}-inexpensive
        image: {{ .Values.inexpensive.inexpensive.image.repository }}:{{ .Values.inexpensive.inexpensive.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.inexpensive.inexpensive.imagePullPolicy }}
        name: inexpensive
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.inexpensive.inexpensive.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.inexpensive.inexpensive.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "inexpensive.fullname" . }}-inexpensive
  labels:
  {{- include "inexpensive.labels" . | nindent 4 }}
spec:
  type: {{ .Values.inexpensive.type }}
  selector:
    app.kubernetes.io/instance: inexpensive
    app.kubernetes.io/name: microlending
  {{- include "inexpensive.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.inexpensive.ports | toYaml | nindent 2 -}}
inexpensive:
  canteen: bizarre
  ecumenistGrapefruit: tumbler
  inexpensive:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  porkJackal: sick
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  type: ClusterIP
  zoo: shoelace
kubernetesClusterDomain: cluster.local
