# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "piquant.fullname" . }}-piquant
  labels:
  {{- include "piquant.labels" . | nindent 4 }}
data:
  FICTION_DAILY: {{ .Values.piquant.fictionDaily | quote }}
  MAMMOTH: {{ .Values.piquant.mammoth | quote }}
  MOAN: {{ .Values.piquant.moan | quote }}
  PROSECUTOR_INFLUX: {{ .Values.piquant.prosecutorInflux | quote }}
  SUSTAINMENT: {{ .Values.piquant.sustainment | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "piquant.fullname" . }}-piquant
  labels:
  {{- include "piquant.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: piquant
spec:
  replicas: {{ .Values.piquant.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: piquant
      app.kubernetes.io/name: oleo
    {{- include "piquant.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: piquant
        app.kubernetes.io/name: oleo
      {{- include "piquant.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 16198acea50e86f28d6ff6e4223426ecabfe9833060fc2c17d53ca9452f9311e
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "piquant.fullname" . }}-piquant
        image: {{ .Values.piquant.piquant.image.repository }}:{{ .Values.piquant.piquant.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.piquant.piquant.imagePullPolicy }}
        name: piquant
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.piquant.piquant.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.piquant.piquant.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "piquant.fullname" . }}-piquant
  labels:
  {{- include "piquant.labels" . | nindent 4 }}
spec:
  type: {{ .Values.piquant.type }}
  selector:
    app.kubernetes.io/instance: piquant
    app.kubernetes.io/name: oleo
  {{- include "piquant.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.piquant.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
piquant:
  fictionDaily: mussel
  mammoth: tutu
  moan: amber
  piquant:
    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
  prosecutorInflux: building
  replicas: 1
  sustainment: quiver
  type: ClusterIP
