Skip to content

Second WithPredicates call drops GenerationChangedPredicate #16

Open

Description

@shreemaan-abhishek

Problem

builder.WithPredicates assigns the predicate list, so the later inNamespace option replaces GenerationChangedPredicate on the three CR watches (setup.go#L56).

Reproduce

Reconcile counts (controller-runtime metrics): a status-only patch triggers 1 reconcile (expected 0), and so does a label-only change.

Impact

Bounded extra work per status or metadata change (cache list, one aisix validate, one status read per pod). No extra rollouts, because the file bytes are unchanged.

Scores

Reproducibility Likelihood Severity Existing mitigations Detectability Test coverage Fix cost vs benefit
10 8 1 7 2 1 9

Scores are out of 10. Higher is worse for likelihood and severity. Higher is better for mitigations, detectability, test coverage and cost vs benefit (10 = cheap fix, high value).

Fix

Pass both in one call: builder.WithPredicates(predicate.GenerationChangedPredicate{}, inNamespace), or drop inNamespace, since the cache is already namespace-scoped. A deletion sets deletionTimestamp, which bumps the generation, so #11's case still gets through.

Tests to add

A manager test asserting a status-only patch does not reconcile.

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

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions