# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "circumstance.fullname" . }}-circumstance
  labels:
  {{- include "circumstance.labels" . | nindent 4 }}
data:
  SLIDER_SELLING_CRAZY: {{ .Values.circumstance.sliderSellingCrazy | quote }}
  SYNOD: {{ .Values.circumstance.synod | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "circumstance.fullname" . }}-circumstance
  labels:
  {{- include "circumstance.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: circumstance
spec:
  replicas: {{ .Values.circumstance.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: circumstance
      app.kubernetes.io/name: mincemeat
    {{- include "circumstance.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: circumstance
        app.kubernetes.io/name: mincemeat
      {{- include "circumstance.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: cd7c615461f554ac4a905bf733610b4c62dc9c58342839ed3fe1cb25186e92f0
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "circumstance.fullname" . }}-circumstance
        image: {{ .Values.circumstance.circumstance.image.repository }}:{{ .Values.circumstance.circumstance.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.circumstance.circumstance.imagePullPolicy }}
        name: circumstance
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.circumstance.circumstance.resources | nindent 10
          }}
        securityContext: {{- toYaml .Values.circumstance.circumstance.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "circumstance.fullname" . }}-circumstance
  labels:
  {{- include "circumstance.labels" . | nindent 4 }}
spec:
  type: {{ .Values.circumstance.type }}
  selector:
    app.kubernetes.io/instance: circumstance
    app.kubernetes.io/name: mincemeat
  {{- include "circumstance.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.circumstance.ports | toYaml | nindent 2 -}}
circumstance:
  circumstance:
    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
  sliderSellingCrazy: netbook
  synod: driving
  type: ClusterIP
kubernetesClusterDomain: cluster.local
