# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "courthouse.fullname" . }}-courthouse
  labels:
  {{- include "courthouse.labels" . | nindent 4 }}
data:
  CHAMPION_ROUTINE_SHRILL: {{ .Values.courthouse.championRoutineShrill | quote }}
  FUNCTIONAL_CLOTHING_DRAWBRIDGE: {{ .Values.courthouse.functionalClothingDrawbridge
    | quote }}
  GENOCIDE_ACHIEVER: {{ .Values.courthouse.genocideAchiever | quote }}
  MOUND_ASTERISK: {{ .Values.courthouse.moundAsterisk | quote }}
  OBSTACLE_DEVICE_PATCH: {{ .Values.courthouse.obstacleDevicePatch | quote }}
  PEPPERONI_RISK: {{ .Values.courthouse.pepperoniRisk | quote }}
  RECIPROCITY: {{ .Values.courthouse.reciprocity | quote }}
  STRESS: {{ .Values.courthouse.stress | quote }}
  SURVIVAL: {{ .Values.courthouse.survival | quote }}
  TIMER: {{ .Values.courthouse.timer | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "courthouse.fullname" . }}-courthouse
  labels:
  {{- include "courthouse.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: courthouse
spec:
  replicas: {{ .Values.courthouse.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: courthouse
      app.kubernetes.io/name: premeditation
    {{- include "courthouse.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: courthouse
        app.kubernetes.io/name: premeditation
      {{- include "courthouse.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 82301417784430002366cb6840e16aba2c3226710d38f3cd0fbcb6de07d5134d
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "courthouse.fullname" . }}-courthouse
        image: {{ .Values.courthouse.courthouse.image.repository }}:{{ .Values.courthouse.courthouse.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.courthouse.courthouse.imagePullPolicy }}
        name: courthouse
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.courthouse.courthouse.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.courthouse.courthouse.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "courthouse.fullname" . }}-courthouse
  labels:
  {{- include "courthouse.labels" . | nindent 4 }}
spec:
  type: {{ .Values.courthouse.type }}
  selector:
    app.kubernetes.io/instance: courthouse
    app.kubernetes.io/name: premeditation
  {{- include "courthouse.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.courthouse.ports | toYaml | nindent 2 -}}
courthouse:
  championRoutineShrill: panoramic
  courthouse:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  functionalClothingDrawbridge: tin
  genocideAchiever: catcher
  moundAsterisk: gearshift
  obstacleDevicePatch: afternoon
  pepperoniRisk: cranky
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  reciprocity: bathtub
  replicas: 1
  stress: curriculum
  survival: priest
  timer: route
  type: ClusterIP
kubernetesClusterDomain: cluster.local
