# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "terrarium.fullname" . }}-terrarium
  labels:
  {{- include "terrarium.labels" . | nindent 4 }}
data:
  ALLIANCE: {{ .Values.terrarium.alliance | quote }}
  FRAGRANCE_FRONTIER: {{ .Values.terrarium.fragranceFrontier | quote }}
  ILLUSION_SPECIFY: {{ .Values.terrarium.illusionSpecify | quote }}
  PAD_FOREST: {{ .Values.terrarium.padForest | quote }}
  SIMVASTATIN_IGNORANCE: {{ .Values.terrarium.simvastatinIgnorance | quote }}
  UNIQUE_PERIODICAL: {{ .Values.terrarium.uniquePeriodical | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "terrarium.fullname" . }}-terrarium
  labels:
  {{- include "terrarium.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: terrarium
spec:
  replicas: {{ .Values.terrarium.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: terrarium
      app.kubernetes.io/name: stride
    {{- include "terrarium.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: terrarium
        app.kubernetes.io/name: stride
      {{- include "terrarium.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: a24bf8d5e2a96f454a38f559f86381778681c3e5c4f7bf804542e9a9d374b7f9
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "terrarium.fullname" . }}-terrarium
        image: {{ .Values.terrarium.terrarium.image.repository }}:{{ .Values.terrarium.terrarium.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.terrarium.terrarium.imagePullPolicy }}
        name: terrarium
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.terrarium.terrarium.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.terrarium.terrarium.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "terrarium.fullname" . }}-terrarium
  labels:
  {{- include "terrarium.labels" . | nindent 4 }}
spec:
  type: {{ .Values.terrarium.type }}
  selector:
    app.kubernetes.io/instance: terrarium
    app.kubernetes.io/name: stride
  {{- include "terrarium.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.terrarium.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
terrarium:
  alliance: shrimp
  fragranceFrontier: hare
  illusionSpecify: export
  padForest: analgesia
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  simvastatinIgnorance: comfort
  terrarium:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  type: ClusterIP
  uniquePeriodical: boutique
