github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/kafka-cluster/templates/validate.yaml (about) 1 {{- if .Values.replicas }} 2 {{- if gt (int .Values.replicas) 5 }} 3 {{ fail "kafka-server cluster does not support running replicas greater than 3." }} 4 {{- end }} 5 {{- if ne (mod (int .Values.replicas) 2) 1 }} 6 {{ fail "kafka-server cluster does not support running with even number replicas." }} 7 {{- end }} 8 {{- end }} 9 10 {{- if .Values.brokerReplicas }} 11 {{- if gt (int .Values.brokerReplicas) 100 }} 12 {{ fail "kafka-broker cluster does not support running replicas greater than 100." }} 13 {{- end }} 14 {{- end }} 15 {{- if .Values.controllerReplicas }} 16 {{- if gt (int .Values.controllerReplicas) 5 }} 17 {{ fail "kafka-controller cluster does not support running replicas greater than 5." }} 18 {{- end }} 19 {{- if ne (mod (int .Values.controllerReplicas) 2) 1 }} 20 {{ fail "kafka-controller cluster does not support running with even number replicas." }} 21 {{- end }} 22 {{- end }} 23 24 {{- if and ( ne .Values.mode "combined" ) ( ne .Values.mode "separated" ) }} 25 {{ fail "'mode' value should either 'combined' or 'separated'." }} 26 {{- end }} 27 28 {{/* 29 Validate cpu, memory and storage 30 */}} 31 {{- $cpu := (float64 .Values.cpu) }} 32 {{- $memory := (float64 .Values.memory) }} 33 {{- $storage := (float64 .Values.storage) }} 34 {{- if or (lt $cpu 0.5) (gt $cpu 64.0) }} 35 {{- fail (print "cpu must be between 0.5 and 64, got " $cpu) }} 36 {{- end }} 37 {{- if or (lt $memory 0.5) (gt $memory 1000.0) }} 38 {{- fail (print "memory must be between 0.5 and 1000, got " $memory) }} 39 {{- end }} 40 {{- if or (lt $storage 1.0 ) (gt $storage 10000.0) }} 41 {{- fail (print "storage must be between 1 and 10000, got " $storage) }} 42 {{- end }}