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