# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "pocketbook.fullname" . }}-pocketbook
  labels:
  {{- include "pocketbook.labels" . | nindent 4 }}
data:
  DIADEM: {{ .Values.pocketbook.diadem | quote }}
  EXASPERATION: {{ .Values.pocketbook.exasperation | quote }}
  SAVORY: {{ .Values.pocketbook.savory | quote }}
  TEEN_STORY: {{ .Values.pocketbook.teenStory | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "pocketbook.fullname" . }}-pocketbook
  labels:
  {{- include "pocketbook.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: pocketbook
spec:
  replicas: {{ .Values.pocketbook.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: pocketbook
      app.kubernetes.io/name: plaintiff
    {{- include "pocketbook.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: pocketbook
        app.kubernetes.io/name: plaintiff
      {{- include "pocketbook.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: d2e34c3e8e451f89ade84e458df0cd88d542347c4f3f70e2a804a33bc019af2b
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "pocketbook.fullname" . }}-pocketbook
        image: {{ .Values.pocketbook.pocketbook.image.repository }}:{{ .Values.pocketbook.pocketbook.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.pocketbook.pocketbook.imagePullPolicy }}
        name: pocketbook
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.pocketbook.pocketbook.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.pocketbook.pocketbook.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "pocketbook.fullname" . }}-pocketbook
  labels:
  {{- include "pocketbook.labels" . | nindent 4 }}
spec:
  type: {{ .Values.pocketbook.type }}
  selector:
    app.kubernetes.io/instance: pocketbook
    app.kubernetes.io/name: plaintiff
  {{- include "pocketbook.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.pocketbook.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
pocketbook:
  diadem: method
  exasperation: buddy
  pocketbook:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  savory: step-father
  teenStory: deployment
  type: ClusterIP
