synapsecns/sanguine

View on GitHub
charts/scribe/templates/indexer_deployment.yaml

Summary

Maintainability
Test Coverage
{{- if .Values.indexer.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "scribe.fullname" . }}-indexer
  labels:
    {{- include "scribe.labels" . | nindent 4 }}
spec:
  replicas: 1
  selector:
    matchLabels:
      {{- include "scribe.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      annotations:
        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
      {{- with .Values.indexer.podAnnotations }}
        {{- toYaml . | nindent 8 }}
      {{- end }}
      labels:
        {{- include "scribe.selectorLabels" . | nindent 8 }}
        {{- include "scribe.commonLabels" . | nindent 8 }}
        scribe-type: indexer
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "scribe.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.indexer.podSecurityContext | nindent 8 }}
    {{- if .Values.files }}
      initContainers:
        - name: copy-{{ .Release.Name }}-config
          image: busybox
          command: ['sh', '-c', 'cp -v /configmap/* /config/']
          volumeMounts:
            - name: configmap
              mountPath: /configmap
            - name: {{ .Release.Name }}-config
              mountPath: /config
        {{- if .Values.indexer.extraInitContainers }}
        {{- toYaml .Values.indexer.extraInitContainers | nindent 8 }}
        {{- end }}
    {{- end }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          args:
            {{- toYaml .Values.indexer.args | nindent 12 }}
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          resources:
            {{- toYaml .Values.indexer.resources | nindent 12 }}
          {{- if .Values.indexer.env }}
          env:
            {{- toYaml .Values.indexer.env | nindent 12 }}
          {{- end }}
    {{- if .Values.files }}
          volumeMounts:
            - name: configmap
              mountPath: /config
        {{- end }}
        {{- if .Values.indexer.extraContainers }}
        {{- toYaml .Values.indexer.extraContainers | nindent 8 }}
        {{- end }}
      {{- with .Values.indexer.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.indexer.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.indexer.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      volumes:
        {{- if .Values.files }}
        - name: {{ .Release.Name }}-config
          emptyDir: {}
        - name: configmap
          configMap:
            name: {{ include "scribe.fullname" . }}-{{ .Release.Name }}
        {{- end }}
{{- end }}