# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "plugin.fullname" . }}-plugin
  labels:
  {{- include "plugin.labels" . | nindent 4 }}
data:
  AMBER: {{ .Values.plugin.amber | quote }}
  BREWER: {{ .Values.plugin.brewer | quote }}
  DETECTIVE_STACKING: {{ .Values.plugin.detectiveStacking | quote }}
  SUPER: {{ .Values.plugin.super | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "plugin.fullname" . }}-plugin
  labels:
  {{- include "plugin.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: plugin
spec:
  replicas: {{ .Values.plugin.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: plugin
      app.kubernetes.io/name: airspace
    {{- include "plugin.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: plugin
        app.kubernetes.io/name: airspace
      {{- include "plugin.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 9da96ebd2c84cd2fbdd571cf4150afb827cf14866a610618b9961dbc2b7a32a3
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "plugin.fullname" . }}-plugin
        image: {{ .Values.plugin.plugin.image.repository }}:{{ .Values.plugin.plugin.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.plugin.plugin.imagePullPolicy }}
        name: plugin
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.plugin.plugin.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.plugin.plugin.containerSecurityContext | nindent
          10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "plugin.fullname" . }}-plugin
  labels:
  {{- include "plugin.labels" . | nindent 4 }}
spec:
  type: {{ .Values.plugin.type }}
  selector:
    app.kubernetes.io/instance: plugin
    app.kubernetes.io/name: airspace
  {{- include "plugin.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.plugin.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
plugin:
  amber: reasoning
  brewer: hobbit
  detectiveStacking: detailed
  plugin:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  super: astrology
  type: ClusterIP
