|
|
@ -67,3 +67,40 @@ Selector labels for ZEO Server component |
|
|
{{ include "portalmodelo.selectorLabels" . }} |
|
|
{{ include "portalmodelo.selectorLabels" . }} |
|
|
app.kubernetes.io/component: zeoserver |
|
|
app.kubernetes.io/component: zeoserver |
|
|
{{- end }} |
|
|
{{- end }} |
|
|
|
|
|
|
|
|
|
|
|
{{/* |
|
|
|
|
|
Calculates zeoInitialDelaySeconds from a Kubernetes resource quantity (Ki, Mi, Gi, K, M, G, or raw bytes). |
|
|
|
|
|
Usage: include "portalmodelo.zeoInitialDelaySeconds" .Values.persistence.size |
|
|
|
|
|
*/}} |
|
|
|
|
|
{{- define "portalmodelo.zeoInitialDelaySeconds" -}} |
|
|
|
|
|
{{- $rawSize := . | toString -}} |
|
|
|
|
|
{{- $num := regexFind "[0-9]+" $rawSize | default "0" | float64 -}} |
|
|
|
|
|
{{- $unit := regexFind "[a-zA-Z]+" $rawSize | default "" | upper -}} |
|
|
|
|
|
|
|
|
|
|
|
{{- $sizeGiFloat := $num -}} |
|
|
|
|
|
{{- if eq $unit "KI" -}} |
|
|
|
|
|
{{- $sizeGiFloat = divf $num 1048576 -}} |
|
|
|
|
|
{{- else if eq $unit "MI" -}} |
|
|
|
|
|
{{- $sizeGiFloat = divf $num 1024 -}} |
|
|
|
|
|
{{- else if eq $unit "GI" -}} |
|
|
|
|
|
{{- $sizeGiFloat = $num -}} |
|
|
|
|
|
{{- else if eq $unit "K" -}} |
|
|
|
|
|
{{- $sizeGiFloat = divf $num 1000000 -}} |
|
|
|
|
|
{{- else if eq $unit "M" -}} |
|
|
|
|
|
{{- $sizeGiFloat = divf $num 1000 -}} |
|
|
|
|
|
{{- else if eq $unit "G" -}} |
|
|
|
|
|
{{- $sizeGiFloat = $num -}} |
|
|
|
|
|
{{- else if eq $unit "TI" -}} |
|
|
|
|
|
{{- $sizeGiFloat = mulf $num 1024 -}} |
|
|
|
|
|
{{- end -}} |
|
|
|
|
|
|
|
|
|
|
|
{{- $calculatedSeconds := int64 (round (mulf $sizeGiFloat 0.9) 0) -}} |
|
|
|
|
|
{{- /* Clamp between min (30s) and max (720s / 12m) */ -}} |
|
|
|
|
|
{{- if lt $calculatedSeconds 30 -}} |
|
|
|
|
|
30 |
|
|
|
|
|
{{- else if gt $calculatedSeconds 720 -}} |
|
|
|
|
|
720 |
|
|
|
|
|
{{- else -}} |
|
|
|
|
|
{{- $calculatedSeconds -}} |
|
|
|
|
|
{{- end -}} |
|
|
|
|
|
{{- end -}} |
|
|
|