# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "counsellor.fullname" . }}-counsellor
  labels:
  {{- include "counsellor.labels" . | nindent 4 }}
data:
  CARAVAN: {{ .Values.counsellor.caravan | quote }}
  ENCOURAGE: {{ .Values.counsellor.encourage | quote }}
  HAY_TOAD_GARRULOUS: {{ .Values.counsellor.hayToadGarrulous | quote }}
  HOBBY_GROUPER_RAYON: {{ .Values.counsellor.hobbyGrouperRayon | quote }}
  OBTAIN_LONGBOAT_INTERPRETER: {{ .Values.counsellor.obtainLongboatInterpreter |
    quote }}
  PSEUDOSCIENCE_ATOM: {{ .Values.counsellor.pseudoscienceAtom | quote }}
  SPECIFY_TESTIMONY: {{ .Values.counsellor.specifyTestimony | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "counsellor.fullname" . }}-counsellor
  labels:
  {{- include "counsellor.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: counsellor
spec:
  replicas: {{ .Values.counsellor.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: counsellor
      app.kubernetes.io/name: happiness
    {{- include "counsellor.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: counsellor
        app.kubernetes.io/name: happiness
      {{- include "counsellor.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 3ae9ff29140abfc6fb9366078268fbefcfb50396a955272993c9e6e786500bdf
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "counsellor.fullname" . }}-counsellor
        image: {{ .Values.counsellor.counsellor.image.repository }}:{{ .Values.counsellor.counsellor.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.counsellor.counsellor.imagePullPolicy }}
        name: counsellor
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.counsellor.counsellor.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.counsellor.counsellor.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "counsellor.fullname" . }}-counsellor
  labels:
  {{- include "counsellor.labels" . | nindent 4 }}
spec:
  type: {{ .Values.counsellor.type }}
  selector:
    app.kubernetes.io/instance: counsellor
    app.kubernetes.io/name: happiness
  {{- include "counsellor.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.counsellor.ports | toYaml | nindent 2 -}}
counsellor:
  caravan: frighten
  counsellor:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  encourage: fate
  hayToadGarrulous: glasses
  hobbyGrouperRayon: wampum
  obtainLongboatInterpreter: pug
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  pseudoscienceAtom: entrepreneur
  replicas: 1
  specifyTestimony: status
  type: ClusterIP
kubernetesClusterDomain: cluster.local
