# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "arrangement.fullname" . }}-arrangement
  labels:
  {{- include "arrangement.labels" . | nindent 4 }}
data:
  ABAFT: {{ .Values.arrangement.abaft | quote }}
  BOIL: {{ .Values.arrangement.boil | quote }}
  SHADE: {{ .Values.arrangement.shade | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "arrangement.fullname" . }}-arrangement
  labels:
  {{- include "arrangement.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: arrangement
spec:
  replicas: {{ .Values.arrangement.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: arrangement
      app.kubernetes.io/name: crate
    {{- include "arrangement.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: arrangement
        app.kubernetes.io/name: crate
      {{- include "arrangement.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 4826699bc4c9a88457dd5c20c439d2cf7f126c304a798368ecb2f7dace76fe9d
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "arrangement.fullname" . }}-arrangement
        image: {{ .Values.arrangement.arrangement.image.repository }}:{{ .Values.arrangement.arrangement.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.arrangement.arrangement.imagePullPolicy }}
        name: arrangement
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.arrangement.arrangement.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.arrangement.arrangement.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "arrangement.fullname" . }}-arrangement
  labels:
  {{- include "arrangement.labels" . | nindent 4 }}
spec:
  type: {{ .Values.arrangement.type }}
  selector:
    app.kubernetes.io/instance: arrangement
    app.kubernetes.io/name: crate
  {{- include "arrangement.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.arrangement.ports | toYaml | nindent 2 -}}
arrangement:
  abaft: leprosy
  arrangement:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  boil: gene
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  shade: broccoli
  type: ClusterIP
kubernetesClusterDomain: cluster.local
