{{/* 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-middleware.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 }}
{{- end }}

{{/*
Create the node affinity to determine the deployment of environment
*/}}
{{- define "uavcloud-middleware.affinity" -}}
{{- with .Values.global.affinity }}
nodeAffinity:
  requiredDuringSchedulingIgnoredDuringExecution:
    nodeSelectorTerms:
      - matchExpressions:
        - key: uavcloud.affinity
          operator: In
          values:
            - {{ .k8sNodeEnv }}
{{- end }}
{{- end }}

{{/*
Create the tls configuration for https to enable trafik-ingress
*/}}
{{- define "uavcloud-middleware.trafik.tls" -}}
entryPoints:
  - websecure
tls:
  certResolver: default
{{- end }}


{{/*
Create the volumeClaimTemplates to use
*/}}
{{/*{{- define "uavcloud-middleware.global.volumeClaimTemplates" -}}*/}}
{{/*- metadata:*/}}
{{/*    name: {{ .Values.global.volume.name }}*/}}
{{/*    namespace: {{ .Release.Namespace }}*/}}
{{/*    labels:*/}}
{{/*      cmii.type: {{ .Values.global.application.type }}*/}}
{{/*      cmii.app: {{ .Values.global.volume.name }}*/}}
{{/*  spec:*/}}
{{/*    storageClassName: {{ .Values.global.storageClass.name }}*/}}
{{/*    accessModes: [ "{{ .Values.storageClass.accessMode }}" ]*/}}
{{/*    volumeMode: {{ .Values.storageClass.volumeMode }}*/}}
{{/*    resources:*/}}
{{/*      requests:*/}}
{{/*        storage: {{ .Values.storageClass.resources.requests.storage }}*/}}
{{/*{{- end }}*/}}
