Skip to content

Using decimal values in quantities resulting in infinity reconciliation loop #1849

@realyota

Description

@realyota

Just use decimal in quantities like memory ie.:

            spec:
              containers:
              - image: altinity/clickhouse-keeper:24.3.5.48.altinityfips
                resources:
                  requests:
                    cpu: 800m
                    memory: 1.5Gi

operator falls into infinity reconciliation loop, since cannot properly compare converted by k8s value (1536Mi - Integer) to it's decimal representation from DeepDiff, hence the CRD is always in InProgress status:

I1017 14:45:51.336239       1 worker-log.go:37] ActionPlan start---------------------------------------------:
Diff start -------------------------
modified spec items num: 2
diff item [0]:'.Templates.PodTemplates[0].Spec.Containers[0].Resources.Requests["memory"].d.Dec' = '&inf.Dec{
  unscaled: big.Int{
    neg: false,
    abs: big.nat{
      1610612736000000000,
    },
  },
  scale: 9,
}'
diff item [1]:'.Templates.PodTemplates[0].Spec.Containers[0].Resources.Requests["memory"].i.value' = '0'
Diff end -------------------------

ActionPlan end---------------------------------------------
I1017 14:45:51.336401       1 worker-reconciler-chk.go:60] reconcileCR():unknown:ActionPlan has actions - continue reconcile

Not sure if easily fixable, probably adding a doc will do. Maybe we can parse values like this using and then compare: https://github.com/kubernetes/apimachinery/blob/b72d93d174332f952a8d431419fece5e6f044bcb/pkg/api/resource/quantity.go#L277

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