# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "possible.fullname" . }}-possible
  labels:
  {{- include "possible.labels" . | nindent 4 }}
data:
  COVER_BOLT: {{ .Values.possible.coverBolt | quote }}
  DIRECTIVE: {{ .Values.possible.directive | quote }}
  LOAN: {{ .Values.possible.loan | quote }}
  NETWORK: {{ .Values.possible.network | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "possible.fullname" . }}-possible
  labels:
  {{- include "possible.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: possible
spec:
  replicas: {{ .Values.possible.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: possible
      app.kubernetes.io/name: slipper
    {{- include "possible.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: possible
        app.kubernetes.io/name: slipper
      {{- include "possible.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 9e56bfc30ec00c4a4202a96cf1114f91890696e5afe2a9a94f08482ded29b390
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "possible.fullname" . }}-possible
        image: {{ .Values.possible.possible.image.repository }}:{{ .Values.possible.possible.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.possible.possible.imagePullPolicy }}
        name: possible
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.possible.possible.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.possible.possible.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "possible.fullname" . }}-possible
  labels:
  {{- include "possible.labels" . | nindent 4 }}
spec:
  type: {{ .Values.possible.type }}
  selector:
    app.kubernetes.io/instance: possible
    app.kubernetes.io/name: slipper
  {{- include "possible.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.possible.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
possible:
  coverBolt: bloomer
  directive: sprinkles
  loan: compress
  network: parrot
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  possible:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  replicas: 1
  type: ClusterIP
