# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "rapid.fullname" . }}-rapid
  labels:
  {{- include "rapid.labels" . | nindent 4 }}
data:
  CICADA: {{ .Values.rapid.cicada | quote }}
  GLIDER: {{ .Values.rapid.glider | quote }}
  REFLECTIVE: {{ .Values.rapid.reflective | quote }}
  TRAINER_FISH_ITEM: {{ .Values.rapid.trainerFishItem | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "rapid.fullname" . }}-rapid
  labels:
  {{- include "rapid.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: rapid
spec:
  replicas: {{ .Values.rapid.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: rapid
      app.kubernetes.io/name: upper
    {{- include "rapid.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: rapid
        app.kubernetes.io/name: upper
      {{- include "rapid.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 1387095e468ebf2762379dc7ed4f25c145dbb59944007b8bee9159b8fff49ace
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "rapid.fullname" . }}-rapid
        image: {{ .Values.rapid.rapid.image.repository }}:{{ .Values.rapid.rapid.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.rapid.rapid.imagePullPolicy }}
        name: rapid
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.rapid.rapid.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.rapid.rapid.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "rapid.fullname" . }}-rapid
  labels:
  {{- include "rapid.labels" . | nindent 4 }}
spec:
  type: {{ .Values.rapid.type }}
  selector:
    app.kubernetes.io/instance: rapid
    app.kubernetes.io/name: upper
  {{- include "rapid.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.rapid.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
rapid:
  cicada: concerned
  glider: tame
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  rapid:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  reflective: apricot
  replicas: 1
  trainerFishItem: torso
  type: ClusterIP
