# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "cobbler.fullname" . }}-cobbler
  labels:
  {{- include "cobbler.labels" . | nindent 4 }}
data:
  ANTECHAMBER_NEWSSTAND_SHOULDER: {{ .Values.cobbler.antechamberNewsstandShoulder
    | quote }}
  CAPER_CUCKOO: {{ .Values.cobbler.caperCuckoo | quote }}
  CARPET_FUR: {{ .Values.cobbler.carpetFur | quote }}
  DOWNGRADE_PINOT: {{ .Values.cobbler.downgradePinot | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "cobbler.fullname" . }}-cobbler
  labels:
  {{- include "cobbler.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: cobbler
spec:
  replicas: {{ .Values.cobbler.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: cobbler
      app.kubernetes.io/name: wring
    {{- include "cobbler.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: cobbler
        app.kubernetes.io/name: wring
      {{- include "cobbler.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 3af7cd7954824ece69cd2d28c898797dbf49ed50e5fa7282be9996b223a3c78f
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "cobbler.fullname" . }}-cobbler
        image: {{ .Values.cobbler.cobbler.image.repository }}:{{ .Values.cobbler.cobbler.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.cobbler.cobbler.imagePullPolicy }}
        name: cobbler
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.cobbler.cobbler.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.cobbler.cobbler.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "cobbler.fullname" . }}-cobbler
  labels:
  {{- include "cobbler.labels" . | nindent 4 }}
spec:
  type: {{ .Values.cobbler.type }}
  selector:
    app.kubernetes.io/instance: cobbler
    app.kubernetes.io/name: wring
  {{- include "cobbler.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.cobbler.ports | toYaml | nindent 2 -}}
cobbler:
  antechamberNewsstandShoulder: freon
  caperCuckoo: pumpernickel
  carpetFur: canvas
  cobbler:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  downgradePinot: post
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  type: ClusterIP
kubernetesClusterDomain: cluster.local
