# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "condition.fullname" . }}-condition
  labels:
  {{- include "condition.labels" . | nindent 4 }}
data:
  ATTITUDE: {{ .Values.condition.attitude | quote }}
  CHRONICLE_SCENARIO_EFFICIENCY: {{ .Values.condition.chronicleScenarioEfficiency
    | quote }}
  MOCCASINS: {{ .Values.condition.moccasins | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "condition.fullname" . }}-condition
  labels:
  {{- include "condition.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: condition
spec:
  replicas: {{ .Values.condition.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: condition
      app.kubernetes.io/name: jumbled
    {{- include "condition.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: condition
        app.kubernetes.io/name: jumbled
      {{- include "condition.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: d8374d58ec4f8474120eac7541943ad9af4d79aaa05ab138d24fadaec45505c4
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "condition.fullname" . }}-condition
        image: {{ .Values.condition.condition.image.repository }}:{{ .Values.condition.condition.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.condition.condition.imagePullPolicy }}
        name: condition
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.condition.condition.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.condition.condition.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "condition.fullname" . }}-condition
  labels:
  {{- include "condition.labels" . | nindent 4 }}
spec:
  type: {{ .Values.condition.type }}
  selector:
    app.kubernetes.io/instance: condition
    app.kubernetes.io/name: jumbled
  {{- include "condition.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.condition.ports | toYaml | nindent 2 -}}
condition:
  attitude: uppity
  chronicleScenarioEfficiency: thirst
  condition:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  moccasins: ladder
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  type: ClusterIP
kubernetesClusterDomain: cluster.local
