# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "champion.fullname" . }}-champion
  labels:
  {{- include "champion.labels" . | nindent 4 }}
data:
  BEAUTIFUL_TUNE-UP: {{ .Values.champion.beautifulTuneUp | quote }}
  CREATION: {{ .Values.champion.creation | quote }}
  LITIGATION: {{ .Values.champion.litigation | quote }}
  NECKTIE: {{ .Values.champion.necktie | quote }}
  SPEAKING_RECOMMEND: {{ .Values.champion.speakingRecommend | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "champion.fullname" . }}-champion
  labels:
  {{- include "champion.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: champion
spec:
  replicas: {{ .Values.champion.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: champion
      app.kubernetes.io/name: emotion
    {{- include "champion.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: champion
        app.kubernetes.io/name: emotion
      {{- include "champion.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: f4a4931dbe37518c17339f9a80cc932ec490a344dff387e9a1324fcdb615572e
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "champion.fullname" . }}-champion
        image: {{ .Values.champion.champion.image.repository }}:{{ .Values.champion.champion.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.champion.champion.imagePullPolicy }}
        name: champion
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.champion.champion.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.champion.champion.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "champion.fullname" . }}-champion
  labels:
  {{- include "champion.labels" . | nindent 4 }}
spec:
  type: {{ .Values.champion.type }}
  selector:
    app.kubernetes.io/instance: champion
    app.kubernetes.io/name: emotion
  {{- include "champion.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.champion.ports | toYaml | nindent 2 -}}
champion:
  beautifulTuneUp: counter
  champion:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  creation: sad
  litigation: grapefruit
  necktie: growth
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  speakingRecommend: kingfish
  type: ClusterIP
kubernetesClusterDomain: cluster.local
