# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "savings.fullname" . }}-savings
  labels:
  {{- include "savings.labels" . | nindent 4 }}
data:
  BAIL_GUARANTEE: {{ .Values.savings.bailGuarantee | quote }}
  CLEARING_COMPLEXITY_INNOCENT: {{ .Values.savings.clearingComplexityInnocent | quote
    }}
  COLISEUM_PASSPORT: {{ .Values.savings.coliseumPassport | quote }}
  FLEDGLING_BONDSMAN: {{ .Values.savings.fledglingBondsman | quote }}
  ROAST: {{ .Values.savings.roast | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "savings.fullname" . }}-savings
  labels:
  {{- include "savings.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: savings
spec:
  replicas: {{ .Values.savings.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: savings
      app.kubernetes.io/name: educate
    {{- include "savings.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: savings
        app.kubernetes.io/name: educate
      {{- include "savings.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: b2ce0cc5b4afe0068307100f5bec45c388932eb9174d894beed58ecad923bce7
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "savings.fullname" . }}-savings
        image: {{ .Values.savings.savings.image.repository }}:{{ .Values.savings.savings.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.savings.savings.imagePullPolicy }}
        name: savings
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.savings.savings.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.savings.savings.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "savings.fullname" . }}-savings
  labels:
  {{- include "savings.labels" . | nindent 4 }}
spec:
  type: {{ .Values.savings.type }}
  selector:
    app.kubernetes.io/instance: savings
    app.kubernetes.io/name: educate
  {{- include "savings.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.savings.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
savings:
  bailGuarantee: caliber
  clearingComplexityInnocent: probation
  coliseumPassport: sovereignty
  fledglingBondsman: discovery
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  roast: marble
  savings:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  type: ClusterIP
