# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "rider.fullname" . }}-rider
  labels:
  {{- include "rider.labels" . | nindent 4 }}
data:
  BOOST: {{ .Values.rider.boost | quote }}
  FIESTA_FAMILIARITY: {{ .Values.rider.fiestaFamiliarity | quote }}
  LOCATE: {{ .Values.rider.locate | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "rider.fullname" . }}-rider
  labels:
  {{- include "rider.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: rider
spec:
  replicas: {{ .Values.rider.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: rider
      app.kubernetes.io/name: inversion
    {{- include "rider.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: rider
        app.kubernetes.io/name: inversion
      {{- include "rider.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 873e1fa4865df18d6e3077abebb41dbb0be2e3c8e12f6c34978da7d198eba954
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "rider.fullname" . }}-rider
        image: {{ .Values.rider.rider.image.repository }}:{{ .Values.rider.rider.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.rider.rider.imagePullPolicy }}
        name: rider
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.rider.rider.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.rider.rider.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "rider.fullname" . }}-rider
  labels:
  {{- include "rider.labels" . | nindent 4 }}
spec:
  type: {{ .Values.rider.type }}
  selector:
    app.kubernetes.io/instance: rider
    app.kubernetes.io/name: inversion
  {{- include "rider.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.rider.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
rider:
  boost: booster
  fiestaFamiliarity: issue
  locate: fratricide
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  rider:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  type: ClusterIP
