# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "elephant.fullname" . }}-elephant
  labels:
  {{- include "elephant.labels" . | nindent 4 }}
data:
  CRINOLINE: {{ .Values.elephant.crinoline | quote }}
  EXULTANT: {{ .Values.elephant.exultant | quote }}
  FIBROBLAST_NORMALISATION_CATEGORY: {{ .Values.elephant.fibroblastNormalisationCategory
    | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "elephant.fullname" . }}-elephant
  labels:
  {{- include "elephant.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: elephant
spec:
  replicas: {{ .Values.elephant.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: elephant
      app.kubernetes.io/name: flat
    {{- include "elephant.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: elephant
        app.kubernetes.io/name: flat
      {{- include "elephant.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: ac291d45fec407f4f324db04a7bd0380e366f2c57c37a38673eb0e47bcdea2cf
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "elephant.fullname" . }}-elephant
        image: {{ .Values.elephant.elephant.image.repository }}:{{ .Values.elephant.elephant.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.elephant.elephant.imagePullPolicy }}
        name: elephant
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.elephant.elephant.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.elephant.elephant.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "elephant.fullname" . }}-elephant
  labels:
  {{- include "elephant.labels" . | nindent 4 }}
spec:
  type: {{ .Values.elephant.type }}
  selector:
    app.kubernetes.io/instance: elephant
    app.kubernetes.io/name: flat
  {{- include "elephant.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.elephant.ports | toYaml | nindent 2 -}}
elephant:
  crinoline: winner
  elephant:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  exultant: frustration
  fibroblastNormalisationCategory: hashtag
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  type: ClusterIP
kubernetesClusterDomain: cluster.local
