# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "metronome.fullname" . }}-metronome
  labels:
  {{- include "metronome.labels" . | nindent 4 }}
data:
  CIVILISATION_MILLISECOND: {{ .Values.metronome.civilisationMillisecond | quote
    }}
  COMPETENCE: {{ .Values.metronome.competence | quote }}
  EXPERTISE: {{ .Values.metronome.expertise | quote }}
  LOAD_SHADOW_INHIBITION: {{ .Values.metronome.loadShadowInhibition | quote }}
  MADAM_GATHERING: {{ .Values.metronome.madamGathering | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "metronome.fullname" . }}-metronome
  labels:
  {{- include "metronome.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: metronome
spec:
  replicas: {{ .Values.metronome.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: metronome
      app.kubernetes.io/name: linguistics
    {{- include "metronome.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: metronome
        app.kubernetes.io/name: linguistics
      {{- include "metronome.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: a0356d099be1e5def99d3f1e2eff7fb2c0c679dbb387f4cc7f961cc85e9c3bd2
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "metronome.fullname" . }}-metronome
        image: {{ .Values.metronome.metronome.image.repository }}:{{ .Values.metronome.metronome.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.metronome.metronome.imagePullPolicy }}
        name: metronome
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.metronome.metronome.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.metronome.metronome.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "metronome.fullname" . }}-metronome
  labels:
  {{- include "metronome.labels" . | nindent 4 }}
spec:
  type: {{ .Values.metronome.type }}
  selector:
    app.kubernetes.io/instance: metronome
    app.kubernetes.io/name: linguistics
  {{- include "metronome.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.metronome.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
metronome:
  civilisationMillisecond: corduroy
  competence: reveal
  expertise: moustache
  loadShadowInhibition: cape
  madamGathering: unadvised
  metronome:
    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
  type: ClusterIP
