Skip to content

fix: match StatefulSet volumeClaimTemplates storage quantities in SSA matcher - #3683

Draft
cjbooms wants to merge 3 commits into
operator-framework:mainfrom
cjbooms:fix/statefulset-vct-quantity-sanitizer
Draft

cjbooms wants to merge 3 commits into
operator-framework:mainfrom
cjbooms:fix/statefulset-vct-quantity-sanitizer

Conversation

@cjbooms

@cjbooms cjbooms commented Nov 6, 2026

Copy link
Copy Markdown

Stacked on #3682. Review only the second commit (2638bd69). This PR stays in draft until #3682 merges, then I rebase it onto main.

Problem

The API server stores PersistentVolumeClaim template storage requests in canonical form, for example 1024Mi as 1Gi. The SSA matcher compares strings, so it reports a mismatch and the dependent StatefulSet is updated on every reconciliation. This is the same symptom as #3681, for StatefulSet.spec.volumeClaimTemplates[i].spec.resources.requests.

Change

File Change
SSABasedGenericKubernetesResourceMatcher sanitizeVolumeClaimTemplates normalises resources.requests with QuantitySanitizer.sanitizeQuantities from #3682.
sample-sts-volumeclaimtemplates-desired-with-equivalent-storage.yaml Desired fixture with 1024Mi against the actual 1Gi. Added to the existing matching test parameters.
StatefulSetDesiredSanitizerDependentResource The existing IT now requests 1024Mi storage.

Verification

  • The new unit case fails before the change and passes after it.
  • StatefulSetDesiredSanitizerIT on k3s v1.31.4 times out without the matcher change and passes with it.

The API server stores HPA metric target quantities in canonical form,
so a desired averageValue of 1000 is stored as 1k and the dependent HPA
was updated on every reconciliation. Normalise value and averageValue
for all autoscaling/v2 metric sources, reusing the quantity check of
PodTemplateSpecSanitizer.

Fixes operator-framework#3681

Signed-off-by: Conor Gallagher <[email protected]>
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 6, 2026
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@cjbooms cjbooms closed this Nov 6, 2026
@cjbooms cjbooms reopened this Nov 6, 2026
… matcher

The API server stores PersistentVolumeClaim template storage requests in
canonical form, so a desired storage of 1024Mi is stored as 1Gi and the
dependent StatefulSet was updated on every reconciliation. Normalise the
volumeClaimTemplates resource requests with the shared quantity check
used for pod template resources.

Signed-off-by: Conor Gallagher <[email protected]>
@cjbooms
cjbooms force-pushed the fix/statefulset-vct-quantity-sanitizer branch from 2638bd6 to 5f1ec01 Compare November 6, 2026 17:09

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant