# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "historical.fullname" . }}-historical
  labels:
  {{- include "historical.labels" . | nindent 4 }}
data:
  INNOVATE: {{ .Values.historical.innovate | quote }}
  OBSOLETE: {{ .Values.historical.obsolete | quote }}
  SAC_DISCLAIMER: {{ .Values.historical.sacDisclaimer | quote }} # deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "historical.fullname" . }}-historical
  labels:
  {{- include "historical.labels" . | nindent 4 }}
  annotations:
    kubectl.kubernetes.io/default-container: historical
spec:
  replicas: {{ .Values.historical.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/instance: historical
      app.kubernetes.io/name: custody
    {{- include "historical.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: historical
        app.kubernetes.io/name: custody
      {{- include "historical.selectorLabels" . | nindent 8 }}
      annotations:
        checksum/config: 0fc416a8ce283fe4cec8adca1c43841936e6508588ae7c9ca365c544fcfcf629
    spec:
      containers:
      - env:
        - name: KUBERNETES_CLUSTER_DOMAIN
          value: {{ quote .Values.kubernetesClusterDomain }}
        envFrom:
        - configMapRef:
            name: {{ include "historical.fullname" . }}-historical
        image: {{ .Values.historical.historical.image.repository }}:{{ .Values.historical.historical.image.tag
          | default .Chart.AppVersion }}
        imagePullPolicy: {{ .Values.historical.historical.imagePullPolicy }}
        name: historical
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        resources: {{- toYaml .Values.historical.historical.resources | nindent 10 }}
        securityContext: {{- toYaml .Values.historical.historical.containerSecurityContext
          | nindent 10 }}
      securityContext:
        fsGroup: 999 # service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "historical.fullname" . }}-historical
  labels:
  {{- include "historical.labels" . | nindent 4 }}
spec:
  type: {{ .Values.historical.type }}
  selector:
    app.kubernetes.io/instance: historical
    app.kubernetes.io/name: custody
  {{- include "historical.selectorLabels" . | nindent 4 }}
  ports:
	{{- .Values.historical.ports | toYaml | nindent 2 -}}
historical:
  historical:
    containerSecurityContext: {}
    image:
      repository: nginx
      tag: latest
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 200m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 200Mi
  innovate: manor
  obsolete: technology
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  replicas: 1
  sacDisclaimer: soy
  type: ClusterIP
kubernetesClusterDomain: cluster.local
