Skip to content

[release-v1.42] Compare PVC storage quantities semantically in nodeSetName - #5078

Merged
pasanw merged 1 commit into
release-v1.42from
fix-nodeset-name-quantity-comparison-release-v1.42
Jul 21, 2026
Merged

pasanw merged 1 commit into
release-v1.42from
fix-nodeset-name-quantity-comparison-release-v1.42

Conversation

@pasanw

@pasanw pasanw commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

Cherry-pick of #5073 to release-v1.42 (Calico Enterprise 3.23.x).

Issue

A non-canonical storage Quantity in the LogStorage CR (e.g. 1024Gi) is written into the Elasticsearch CR in its canonical form (1Ti). nodeSetName() compares the rendered PVC template against the live Elasticsearch CR with reflect.DeepEqual, which inspects the Quantity's unexported cached-string field. The two numerically-equal values therefore compare as different on every reconcile, so the operator generates a new random NodeSet name each pass. ECK treats a renamed NodeSet as new topology and recreates the StatefulSet and its PVCs β€” an unbounded reconcile loop that repeatedly provisions new volumes and prevents Elasticsearch from ever becoming operational.

The bug was introduced by #4378 (current-ES-aware NodeSet naming), which first shipped in operator v1.41 / CE 3.23.0, so it is present on this branch.

Fix

Compare the PVC resource requirements with apiequality.Semantic.DeepEqual, which compares Quantities by numeric value (Cmp) and ignores their string representation. A genuine storage change still forces a rename.

Cherry-pick note

The reproduction test on this branch uses pkg/ptr.ToPtr(...) instead of master's k8s.io/utils/ptr.To(...), because release-v1.42 imports the operator's internal pkg/ptr package in logstorage_test.go. The production change in logstorage.go is identical to #5073.

Note

Backport of #5073 β€” merge only after #5073 lands on master.

Release Note

Fixed an issue where a non-canonical storage quantity in the LogStorage CR (e.g. 1024Gi) caused the Elasticsearch NodeSet to be renamed on every reconcile, repeatedly recreating the Elasticsearch StatefulSet and its PVCs.

For PR reviewers

  • Milestone set according to targeted release (CE 3.23.x).
  • Labels: kind/bug, enterprise.

πŸ€– Generated with Claude Code

A non-canonical storage Quantity in the LogStorage CR (e.g. 1024Gi) is
written to the Elasticsearch CR in its canonical form (1Ti), because
parsing a non-canonical Quantity discards the requested string
representation. reflect.DeepEqual compares the Quantity's unexported
cached-string field, so it reported the numerically-equal values as
different, and nodeSetName generated a new random NodeSet name on every
reconcile. Each rename causes ECK to recreate the Elasticsearch
StatefulSet and its PVCs, in an unbounded loop.

Compare with apiequality.Semantic.DeepEqual instead, which compares
quantities by numeric value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@marvin-tigera marvin-tigera added this to the v1.42.5 milestone Jul 21, 2026
@pasanw pasanw added enterprise Feature applies to enterprise only kind/bug Something isn't working labels Jul 21, 2026
@pasanw
pasanw marked this pull request as ready for review July 21, 2026 22:43
@pasanw
pasanw requested a review from a team as a code owner July 21, 2026 22:43
@pasanw
pasanw merged commit 7cf1395 into release-v1.42 Jul 21, 2026
10 checks passed
@pasanw
pasanw deleted the fix-nodeset-name-quantity-comparison-release-v1.42 branch July 21, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required enterprise Feature applies to enterprise only kind/bug Something isn't working release-note-required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants