Skip to content

Operator incorrectly treats cpu request/limit quantities in podTemplate vs K8S state and gets stuck in "continue reconcile" loop forever #1821

@artem-zinnatullin

Description

@artem-zinnatullin

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:

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 reconcile

You'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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions