# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "precedent.fullname" . }}-precedent
  labels:
  {{- include "precedent.labels" . | nindent 4 }}
data:
  ABOARD: {{ .Values.precedent.aboard | quote }}
  CIRCUIT: {{ .Values.precedent.circuit | quote }}
  INSTALLATION_STINGER: {{ .Values.precedent.installationStinger | quote }}
  SNOBBISH_GUESTBOOK: {{ .Values.precedent.snobbishGuestbook | quote }}
  STABLE: {{ .Values.precedent.stable | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "precedent.fullname" . }}-precedent
  labels:
  {{- include "precedent.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: precedent
spec:
  replicas: {{ .Values.precedent.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: precedent
      app.kubernetes.io/name: length
    {{- include "precedent.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: precedent
        app.kubernetes.io/name: length
      {{- include "precedent.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 2112e8ff69dfbe0874d751a3960f77c1c02b57b6a8bbd20c565fbfa9412d9fd4
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "precedent.fullname" . }}-precedent
        image: {{ .Values.precedent.precedent.image.repository }}:{{ .Values.precedent.precedent.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.precedent.precedent.imagePullPolicy }}
        name: precedent
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.precedent.precedent.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.precedent.precedent.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "precedent.fullname" . }}-precedent
  labels:
  {{- include "precedent.labels" . | nindent 4 }}
spec:
  type: {{ .Values.precedent.type }}
  selector:
    app.kubernetes.io/instance: precedent
    app.kubernetes.io/name: length
  {{- include "precedent.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.precedent.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
precedent:
  aboard: art
  circuit: heal
  installationStinger: backpack
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  precedent:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  replicas: 1
  snobbishGuestbook: race
  stable: lettuce
  type: ClusterIP
