-
Notifications
You must be signed in to change notification settings - Fork 539
Operator incorrectly treats cpu request/limit quantities in podTemplate vs K8S state and gets stuck in "continue reconcile" loop forever #1821
Description
Hi,
I think I've found a major bug in the operator when trying to apply ClickHouseKeeperInstallation and ClickHouseInstallation CRDs with podTempate that defines cpu request/limit values as per provided examples:
- https://github.com/Altinity/clickhouse-operator/blob/master/docs/chk-examples/02-extended-3-nodes.yaml
- https://github.com/Altinity/clickhouse-operator/blob/master/docs/chi-examples/02-templates-03-host-template-volume-claim-and-pod-resources-limit.yaml
Essentially, if you set cpu request/limit values as 0.1 or 1.5 — K8S will apply these as 100m and 1500m respectively, but operator will get stuck thinking it should achieve 0.1 or 1.5 in k8s or whatever quantities it converts to and CRD will never apply successfully.
ActionPlan start---------------------------------------------:
Diff start -------------------------
modified spec items num: 6
diff item [0]:'.Templates.PodTemplates[0].Spec.Containers[0].Resources.Requests["cpu"].i.scale' = '-1'
diff item [1]:'.Templates.PodTemplates[0].Spec.Containers[0].Resources.Requests["cpu"].s' = '""'
diff item [2]:'.Templates.PodTemplates[0].Spec.Containers[0].Resources.Limits["cpu"].i.value' = '15'
diff item [3]:'.Templates.PodTemplates[0].Spec.Containers[0].Resources.Limits["cpu"].i.scale' = '-1'
diff item [4]:'.Templates.PodTemplates[0].Spec.Containers[0].Resources.Limits["cpu"].s' = '""'
diff item [5]:'.Templates.PodTemplates[0].Spec.Containers[0].Resources.Requests["cpu"].i.value' = '1'
Diff end -------------------------
ActionPlan end---------------------------------------------
1 worker-reconciler-chk.go:60] reconcileCR():unknown:ActionPlan has actions - continue reconcileYou'd think okay, I should set all values as m, like 100m instead of 0.1 and 1000m instead of 1, but then there is another bug: operator will never match k8s value for m values that are divisible by 1000.
There is no easy way for users of the operator to know about this bug upfront..
Version: 0.25.3