# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "protocol.fullname" . }}-protocol
  labels:
  {{- include "protocol.labels" . | nindent 4 }}
data:
  ALIGHT_TRACT_MOBSTER: {{ .Values.protocol.alightTractMobster | quote }}
  DIFFERENT: {{ .Values.protocol.different | quote }}
  FANG_MINT_SURFACE: {{ .Values.protocol.fangMintSurface | quote }}
  HEMP_CLOSURE: {{ .Values.protocol.hempClosure | quote }}
  INITIALIZE_JOY_YOGURT: {{ .Values.protocol.initializeJoyYogurt | quote }}
  MATTOCK_ASSOCIATE: {{ .Values.protocol.mattockAssociate | quote }}
  PARAGRAPH_DIBBLE: {{ .Values.protocol.paragraphDibble | quote }}
  PERMISSIBLE: {{ .Values.protocol.permissible | quote }}
  ROBUST_PUPIL_NOON: {{ .Values.protocol.robustPupilNoon | quote }}
  SEED_GALLON: {{ .Values.protocol.seedGallon | quote }}
  SHELL_FISH_BEAM: {{ .Values.protocol.shellFishBeam | quote }}
  VETERAN_LETTER: {{ .Values.protocol.veteranLetter | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "protocol.fullname" . }}-protocol
  labels:
  {{- include "protocol.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: protocol
spec:
  replicas: {{ .Values.protocol.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: protocol
      app.kubernetes.io/name: component
    {{- include "protocol.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: protocol
        app.kubernetes.io/name: component
      {{- include "protocol.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 84b0847ebac52e8be31ee7b6a63e84ce9dc6541d8122cf6c7e3078e16fbd6f1a
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "protocol.fullname" . }}-protocol
        image: {{ .Values.protocol.protocol.image.repository }}:{{ .Values.protocol.protocol.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.protocol.protocol.imagePullPolicy }}
        name: protocol
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.protocol.protocol.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.protocol.protocol.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "protocol.fullname" . }}-protocol
  labels:
  {{- include "protocol.labels" . | nindent 4 }}
spec:
  type: {{ .Values.protocol.type }}
  selector:
    app.kubernetes.io/instance: protocol
    app.kubernetes.io/name: component
  {{- include "protocol.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.protocol.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
protocol:
  alightTractMobster: orchestra
  different: fox
  fangMintSurface: confidence
  hempClosure: gymnastics
  initializeJoyYogurt: spiderling
  mattockAssociate: heyday
  paragraphDibble: teriyaki
  permissible: erect
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  protocol:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  replicas: 1
  robustPupilNoon: vascular
  seedGallon: mansion
  shellFishBeam: ripe
  type: ClusterIP
  veteranLetter: intuition
