# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "territory.fullname" . }}-territory
  labels:
  {{- include "territory.labels" . | nindent 4 }}
data:
  ADDICTED: {{ .Values.territory.addicted | quote }}
  FAIRNESS_CONTRACTOR_DEPOT: {{ .Values.territory.fairnessContractorDepot | quote
    }}
  HINT_SCAFFOLD_ASPECT: {{ .Values.territory.hintScaffoldAspect | quote }}
  MEDDLE_UNDERNEATH: {{ .Values.territory.meddleUnderneath | quote }}
  POLLIWOG_SUIT: {{ .Values.territory.polliwogSuit | quote }}
  QUACK_ABUNDANT: {{ .Values.territory.quackAbundant | quote }}
  SHIPPER_PROGRAMME_BRIEFLY: {{ .Values.territory.shipperProgrammeBriefly | quote
    }}
  VICTORY: {{ .Values.territory.victory | quote }}
  VIOLIN: {{ .Values.territory.violin | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "territory.fullname" . }}-territory
  labels:
  {{- include "territory.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: territory
spec:
  replicas: {{ .Values.territory.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: territory
      app.kubernetes.io/name: wrapper
    {{- include "territory.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: territory
        app.kubernetes.io/name: wrapper
      {{- include "territory.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 578c48bb5b07621ae094c59015b4a7777f948a57c7385f9435bd279dfab7804e
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "territory.fullname" . }}-territory
        image: {{ .Values.territory.territory.image.repository }}:{{ .Values.territory.territory.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.territory.territory.imagePullPolicy }}
        name: territory
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.territory.territory.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.territory.territory.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "territory.fullname" . }}-territory
  labels:
  {{- include "territory.labels" . | nindent 4 }}
spec:
  type: {{ .Values.territory.type }}
  selector:
    app.kubernetes.io/instance: territory
    app.kubernetes.io/name: wrapper
  {{- include "territory.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.territory.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
territory:
  addicted: ATM
  fairnessContractorDepot: block
  hintScaffoldAspect: playwright
  meddleUnderneath: dam
  polliwogSuit: clogs
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  quackAbundant: incense
  replicas: 1
  shipperProgrammeBriefly: nod
  territory:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  type: ClusterIP
  victory: stale
  violin: follower
