# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "socks.fullname" . }}-socks
  labels:
  {{- include "socks.labels" . | nindent 4 }}
data:
  DIMENSION_JUG_EMBASSY: {{ .Values.socks.dimensionJugEmbassy | quote }}
  GUNPOWDER_HATCHET: {{ .Values.socks.gunpowderHatchet | quote }}
  KINDNESS_SIMILARITY_FESTIVAL: {{ .Values.socks.kindnessSimilarityFestival | quote
    }}
  RUMOR_HUMANITY: {{ .Values.socks.rumorHumanity | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "socks.fullname" . }}-socks
  labels:
  {{- include "socks.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: socks
spec:
  replicas: {{ .Values.socks.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: socks
      app.kubernetes.io/name: knock
    {{- include "socks.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: socks
        app.kubernetes.io/name: knock
      {{- include "socks.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 70f75903fc98ce5b4b22b132fab8847648bbd8364df551146ed234612d36522b
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "socks.fullname" . }}-socks
        image: {{ .Values.socks.socks.image.repository }}:{{ .Values.socks.socks.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.socks.socks.imagePullPolicy }}
        name: socks
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.socks.socks.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.socks.socks.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "socks.fullname" . }}-socks
  labels:
  {{- include "socks.labels" . | nindent 4 }}
spec:
  type: {{ .Values.socks.type }}
  selector:
    app.kubernetes.io/instance: socks
    app.kubernetes.io/name: knock
  {{- include "socks.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.socks.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
socks:
  dimensionJugEmbassy: drummer
  gunpowderHatchet: loss
  kindnessSimilarityFestival: libido
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  rumorHumanity: elderberry
  socks:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  type: ClusterIP
