# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "webpage.fullname" . }}-webpage
  labels:
  {{- include "webpage.labels" . | nindent 4 }}
data:
  DIAL: {{ .Values.webpage.dial | quote }}
  MARKETING: {{ .Values.webpage.marketing | quote }}
  SKILL: {{ .Values.webpage.skill | quote }}
  SUSPECT_CRUISE_ZIPPER: {{ .Values.webpage.suspectCruiseZipper | quote }}
  TEMP: {{ .Values.webpage.temp | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "webpage.fullname" . }}-webpage
  labels:
  {{- include "webpage.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: webpage
spec:
  replicas: {{ .Values.webpage.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: webpage
      app.kubernetes.io/name: wrench
    {{- include "webpage.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: webpage
        app.kubernetes.io/name: wrench
      {{- include "webpage.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 9d915498ae1d34320f035eff94978a2a2b8efd5420f31e0b2307430ee12d3264
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "webpage.fullname" . }}-webpage
        image: {{ .Values.webpage.webpage.image.repository }}:{{ .Values.webpage.webpage.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.webpage.webpage.imagePullPolicy }}
        name: webpage
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.webpage.webpage.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.webpage.webpage.containerSecurityContext |
          nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "webpage.fullname" . }}-webpage
  labels:
  {{- include "webpage.labels" . | nindent 4 }}
spec:
  type: {{ .Values.webpage.type }}
  selector:
    app.kubernetes.io/instance: webpage
    app.kubernetes.io/name: wrench
  {{- include "webpage.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.webpage.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
webpage:
  dial: relief
  marketing: freckle
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  skill: sweep
  suspectCruiseZipper: compliance
  temp: carabao
  type: ClusterIP
  webpage:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
