# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "pinpoint.fullname" . }}-pinpoint
  labels:
  {{- include "pinpoint.labels" . | nindent 4 }}
data:
  CHOKER_CENOTAPH: {{ .Values.pinpoint.chokerCenotaph | quote }}
  HASHTAG: {{ .Values.pinpoint.hashtag | quote }}
  MENU_PONY_BONE: {{ .Values.pinpoint.menuPonyBone | quote }}
  SPELT: {{ .Values.pinpoint.spelt | quote }}
  STUDIO_OPTIMIZATION_LINE: {{ .Values.pinpoint.studioOptimizationLine | quote }}
  TALE_SPASM: {{ .Values.pinpoint.taleSpasm | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "pinpoint.fullname" . }}-pinpoint
  labels:
  {{- include "pinpoint.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: pinpoint
spec:
  replicas: {{ .Values.pinpoint.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: pinpoint
      app.kubernetes.io/name: snob
    {{- include "pinpoint.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: pinpoint
        app.kubernetes.io/name: snob
      {{- include "pinpoint.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: b4528920684d862c4464f7538b75895bd4c61541db299e74e381ca576bdbd4ad
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "pinpoint.fullname" . }}-pinpoint
        image: {{ .Values.pinpoint.pinpoint.image.repository }}:{{ .Values.pinpoint.pinpoint.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.pinpoint.pinpoint.imagePullPolicy }}
        name: pinpoint
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.pinpoint.pinpoint.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.pinpoint.pinpoint.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "pinpoint.fullname" . }}-pinpoint
  labels:
  {{- include "pinpoint.labels" . | nindent 4 }}
spec:
  type: {{ .Values.pinpoint.type }}
  selector:
    app.kubernetes.io/instance: pinpoint
    app.kubernetes.io/name: snob
  {{- include "pinpoint.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.pinpoint.ports | toYaml | nindent 2 -}}
kubernetesClusterDomain: cluster.local
pinpoint:
  chokerCenotaph: alike
  hashtag: amount
  menuPonyBone: luxury
  pinpoint:
    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
  spelt: kick
  studioOptimizationLine: stretch
  taleSpasm: security
  type: ClusterIP
