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