# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "berserk.fullname" . }}-berserk
  labels:
  {{- include "berserk.labels" . | nindent 4 }}
data:
  COUNTESS_LIEU: {{ .Values.berserk.countessLieu | quote }}
  DILL_PRINT: {{ .Values.berserk.dillPrint | quote }}
  LUTE_SLEEPING: {{ .Values.berserk.luteSleeping | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "berserk.fullname" . }}-berserk
  labels:
  {{- include "berserk.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: berserk
spec:
  replicas: {{ .Values.berserk.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: berserk
      app.kubernetes.io/name: jar
    {{- include "berserk.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: berserk
        app.kubernetes.io/name: jar
      {{- include "berserk.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 64122d6f5aaf6f07ccd176f5195b95c81fb8d8e12f47e31a13fffc096f98a13d
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "berserk.fullname" . }}-berserk
        image: {{ .Values.berserk.berserk.image.repository }}:{{ .Values.berserk.berserk.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.berserk.berserk.imagePullPolicy }}
        name: berserk
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.berserk.berserk.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.berserk.berserk.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "berserk.fullname" . }}-berserk
  labels:
  {{- include "berserk.labels" . | nindent 4 }}
spec:
  type: {{ .Values.berserk.type }}
  selector:
    app.kubernetes.io/instance: berserk
    app.kubernetes.io/name: jar
  {{- include "berserk.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.berserk.ports | toYaml | nindent 2 -}}
berserk:
  berserk:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  countessLieu: parsnip
  dillPrint: discretion
  luteSleeping: dueling
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  type: ClusterIP
kubernetesClusterDomain: cluster.local
