apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "colanode.fullname" . }}
  labels:
    {{- include "colanode.labels" . | nindent 4 }}
spec:
  {{- if not .Values.colanode.autoscaling.enabled }}
  replicas: {{ .Values.colanode.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "colanode.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      {{- with .Values.colanode.podAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      labels:
        {{- include "colanode.selectorLabels" . | nindent 8 }}
        {{- with .Values.colanode.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      {{- with .Values.colanode.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "colanode.serviceAccountName" . }}
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.colanode.image.repository }}:{{ .Values.colanode.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.colanode.image.pullPolicy }}
          ports:
            - name: http
              containerPort: {{ .Values.colanode.service.port }}
              protocol: TCP
          env:
            {{- include "colanode.serverEnvVars" . | nindent 12 }}
          resources:
            {{- toYaml .Values.colanode.resources | nindent 12 }}
