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