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