# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "civilisation.fullname" . }}-civilisation
  labels:
  {{- include "civilisation.labels" . | nindent 4 }}
data:
  COWARDLY_BLUE_MELT: {{ .Values.civilisation.cowardlyBlueMelt | quote }}
  REFLECTION: {{ .Values.civilisation.reflection | quote }}
  SHRUG: {{ .Values.civilisation.shrug | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "civilisation.fullname" . }}-civilisation
  labels:
  {{- include "civilisation.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: civilisation
spec:
  replicas: {{ .Values.civilisation.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: civilisation
      app.kubernetes.io/name: upward
    {{- include "civilisation.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: civilisation
        app.kubernetes.io/name: upward
      {{- include "civilisation.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: ff4e0c6ed1978f36d087660a8e225c632c8d73d7e37c166416988d7e81be0acf
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "civilisation.fullname" . }}-civilisation
        image: {{ .Values.civilisation.civilisation.image.repository }}:{{ .Values.civilisation.civilisation.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.civilisation.civilisation.imagePullPolicy }}
        name: civilisation
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.civilisation.civilisation.resources | nindent 10
          }}
        securityContext: {{- toYaml .Values.civilisation.civilisation.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "civilisation.fullname" . }}-civilisation
  labels:
  {{- include "civilisation.labels" . | nindent 4 }}
spec:
  type: {{ .Values.civilisation.type }}
  selector:
    app.kubernetes.io/instance: civilisation
    app.kubernetes.io/name: upward
  {{- include "civilisation.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.civilisation.ports | toYaml | nindent 2 -}}
civilisation:
  civilisation:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  cowardlyBlueMelt: phosphate
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  reflection: warming
  replicas: 1
  shrug: habitat
  type: ClusterIP
kubernetesClusterDomain: cluster.local
