# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "consequence.fullname" . }}-consequence
  labels:
  {{- include "consequence.labels" . | nindent 4 }}
data:
  ALTAR_TURN: {{ .Values.consequence.altarTurn | quote }}
  TRANSPORT_MUSIC: {{ .Values.consequence.transportMusic | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "consequence.fullname" . }}-consequence
  labels:
  {{- include "consequence.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: consequence
spec:
  replicas: {{ .Values.consequence.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: consequence
      app.kubernetes.io/name: tide
    {{- include "consequence.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: consequence
        app.kubernetes.io/name: tide
      {{- include "consequence.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: f2df1f0a3cc7d80c7d6b085e0b43b5da0caa68717e90d63e822e808c159a1319
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "consequence.fullname" . }}-consequence
        image: {{ .Values.consequence.consequence.image.repository }}:{{ .Values.consequence.consequence.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.consequence.consequence.imagePullPolicy }}
        name: consequence
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.consequence.consequence.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.consequence.consequence.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "consequence.fullname" . }}-consequence
  labels:
  {{- include "consequence.labels" . | nindent 4 }}
spec:
  type: {{ .Values.consequence.type }}
  selector:
    app.kubernetes.io/instance: consequence
    app.kubernetes.io/name: tide
  {{- include "consequence.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.consequence.ports | toYaml | nindent 2 -}}
consequence:
  altarTurn: earthy
  consequence:
    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
  replicas: 1
  transportMusic: armor
  type: ClusterIP
kubernetesClusterDomain: cluster.local
