# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "decoder.fullname" . }}-decoder
  labels:
  {{- include "decoder.labels" . | nindent 4 }}
data:
  AIR: {{ .Values.decoder.air | quote }}
  INNATE_REBELLIOUS: {{ .Values.decoder.innateRebellious | quote }}
  LINK_LOPSIDED: {{ .Values.decoder.linkLopsided | quote }}
  PENNANT: {{ .Values.decoder.pennant | quote }}
  PHILANTHROPY: {{ .Values.decoder.philanthropy | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "decoder.fullname" . }}-decoder
  labels:
  {{- include "decoder.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: decoder
spec:
  replicas: {{ .Values.decoder.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: decoder
      app.kubernetes.io/name: exterior
    {{- include "decoder.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: decoder
        app.kubernetes.io/name: exterior
      {{- include "decoder.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: e61f0874ced77f4d30451d9857888ef203b7f10459ffb6fca052dc2f35cdae7f
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "decoder.fullname" . }}-decoder
        image: {{ .Values.decoder.decoder.image.repository }}:{{ .Values.decoder.decoder.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.decoder.decoder.imagePullPolicy }}
        name: decoder
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.decoder.decoder.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.decoder.decoder.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "decoder.fullname" . }}-decoder
  labels:
  {{- include "decoder.labels" . | nindent 4 }}
spec:
  type: {{ .Values.decoder.type }}
  selector:
    app.kubernetes.io/instance: decoder
    app.kubernetes.io/name: exterior
  {{- include "decoder.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.decoder.ports | toYaml | nindent 2 -}}
decoder:
  air: harald
  decoder:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  innateRebellious: moonshine
  linkLopsided: journal
  pennant: vine
  philanthropy: equipment
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  type: ClusterIP
kubernetesClusterDomain: cluster.local
