{{/* vim: set filetype=mustache: */}}
{{/*
Create chart name and version as used by the chart label.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "uavcloud-be-core.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 }}
{{- end }}

{{/*
Create the node affinity to determine the deployment of environment no use
*/}}
{{- define "uavcloud-be-core.affinity" -}}
{{- with .Values.global.nodeAffinityPreset }}
nodeAffinity:
  requiredDuringSchedulingIgnoredDuringExecution:
    nodeSelectorTerms:
      - matchExpressions:
        - key: {{ .uavcloud.env }}
          operator: In   # no use this
          values:
            - {{ .demo }}
{{- end }}
{{- end }}

{{/*
default resources for backend deploymentss
*/}}
{{- define "uavcloud-be-core.resources" -}}
resources:
  limits:
    memory: 2Gi
    cpu: "2"
  requests:
    memory: 1Gi
    cpu: 200m
{{- end }}

{{/*
Create the livenessProbe, readinessProbe and startupProbe to use
*/}}
{{- define "uavcloud-be-core.healthProbe" -}}
livenessProbe:
  httpGet:
    path: /cmii/ping
    port: pod-port
    scheme: HTTP
  initialDelaySeconds: 60
  timeoutSeconds: 5
  periodSeconds: 20
  successThreshold: 1
  failureThreshold: 3
readinessProbe:
  httpGet:
    path: /cmii/ping
    port: pod-port
    scheme: HTTP
  initialDelaySeconds: 60
  timeoutSeconds: 5
  periodSeconds: 20
  successThreshold: 1
  failureThreshold: 3
startupProbe:
  httpGet:
    path: /cmii/ping
    port: pod-port
    scheme: HTTP
  initialDelaySeconds: 60
  timeoutSeconds: 3
  periodSeconds: 20
  successThreshold: 1
  failureThreshold: 5
{{- end }}

