# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "forever.fullname" . }}-forever
  labels:
  {{- include "forever.labels" . | nindent 4 }}
data:
  ORGANIZATION: {{ .Values.forever.organization | quote }}
  PRODUCE_ROUNDABOUT: {{ .Values.forever.produceRoundabout | quote }}
  SCULPTING_NIGHT: {{ .Values.forever.sculptingNight | quote }}
  SPEAKERPHONE_SKI_GUESTBOOK: {{ .Values.forever.speakerphoneSkiGuestbook | quote
    }}
  STRENGTHEN_NATIVE: {{ .Values.forever.strengthenNative | quote }}
  TATTLER_CHEMOTAXIS_APRON: {{ .Values.forever.tattlerChemotaxisApron | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "forever.fullname" . }}-forever
  labels:
  {{- include "forever.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: forever
spec:
  replicas: {{ .Values.forever.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: forever
      app.kubernetes.io/name: synonymous
    {{- include "forever.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: forever
        app.kubernetes.io/name: synonymous
      {{- include "forever.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: b83a75336504da1acb287617bb5c8e537315e5bf499d1e3d2f756cf76bcd1200
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "forever.fullname" . }}-forever
        image: {{ .Values.forever.forever.image.repository }}:{{ .Values.forever.forever.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.forever.forever.imagePullPolicy }}
        name: forever
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.forever.forever.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.forever.forever.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "forever.fullname" . }}-forever
  labels:
  {{- include "forever.labels" . | nindent 4 }}
spec:
  type: {{ .Values.forever.type }}
  selector:
    app.kubernetes.io/instance: forever
    app.kubernetes.io/name: synonymous
  {{- include "forever.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.forever.ports | toYaml | nindent 2 -}}
forever:
  forever:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  organization: witch
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  produceRoundabout: homeless
  replicas: 1
  sculptingNight: modem
  speakerphoneSkiGuestbook: half-brother
  strengthenNative: perch
  tattlerChemotaxisApron: grill
  type: ClusterIP
kubernetesClusterDomain: cluster.local
