# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "sunshine.fullname" . }}-sunshine
  labels:
  {{- include "sunshine.labels" . | nindent 4 }}
data:
  ANNOYED: {{ .Values.sunshine.annoyed | quote }}
  CHANGEABLE_SERIAL: {{ .Values.sunshine.changeableSerial | quote }}
  DEFIANT_WHITE_CABANA: {{ .Values.sunshine.defiantWhiteCabana | quote }}
  FLIPPED-OUT_CD_HOMOSEXUAL: {{ .Values.sunshine.flippedOutCdHomosexual | quote }}
  HINT_BROW: {{ .Values.sunshine.hintBrow | quote }}
  HUG_LUXURIANT: {{ .Values.sunshine.hugLuxuriant | quote }}
  KOHLRABI_POET: {{ .Values.sunshine.kohlrabiPoet | quote }}
  PRIEST: {{ .Values.sunshine.priest | quote }}
  PSEUDOSCIENCE_NUMERIC: {{ .Values.sunshine.pseudoscienceNumeric | quote }}
  RUCKUS_SOFTDRINK_LET: {{ .Values.sunshine.ruckusSoftdrinkLet | quote }}
  SUNLAMP: {{ .Values.sunshine.sunlamp | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "sunshine.fullname" . }}-sunshine
  labels:
  {{- include "sunshine.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: sunshine
spec:
  replicas: {{ .Values.sunshine.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: sunshine
      app.kubernetes.io/name: haircut
    {{- include "sunshine.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: sunshine
        app.kubernetes.io/name: haircut
      {{- include "sunshine.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 54169e7e93d862736c75535014e5ce282c493215ce60acc637af89d31b2b8245
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "sunshine.fullname" . }}-sunshine
        image: {{ .Values.sunshine.sunshine.image.repository }}:{{ .Values.sunshine.sunshine.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.sunshine.sunshine.imagePullPolicy }}
        name: sunshine
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.sunshine.sunshine.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.sunshine.sunshine.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "sunshine.fullname" . }}-sunshine
  labels:
  {{- include "sunshine.labels" . | nindent 4 }}
spec:
  type: {{ .Values.sunshine.type }}
  selector:
    app.kubernetes.io/instance: sunshine
    app.kubernetes.io/name: haircut
  {{- include "sunshine.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.sunshine.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
sunshine:
  annoyed: tested
  changeableSerial: music-making
  defiantWhiteCabana: granola
  flippedOutCdHomosexual: approach
  hintBrow: casement
  hugLuxuriant: heaven
  kohlrabiPoet: feel
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  priest: reminder
  pseudoscienceNumeric: chicory
  replicas: 1
  ruckusSoftdrinkLet: fixture
  sunlamp: transform
  sunshine:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  type: ClusterIP
