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