Skip to content

fix(controller): ESO-481 fix secondary watch predicates - #182

Draft
siddhibhor-56 wants to merge 1 commit into
openshift:mainfrom
siddhibhor-56:eval/eso-481-jira-solve
Draft

fix(controller): ESO-481 fix secondary watch predicates#182
siddhibhor-56 wants to merge 1 commit into
openshift:mainfrom
siddhibhor-56:eval/eso-481-jira-solve

Conversation

@siddhibhor-56

@siddhibhor-56 siddhibhor-56 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

The managedOrWatchedResources predicate was built with predicate.NewPredicateFuncs which only inspects ObjectNew on update events. When a watched label (e.g. trustedCABundle ConfigMap) was removed externally, the event was filtered out and reconciliation never ran — breaking self-healing for watched ConfigMaps.

Extract a shared labelMatchPredicate helper that builds predicate.Funcs checking both ObjectOld and ObjectNew on updates. Consolidate the inline isManagedResource closure and the NewPredicateFuncs block into two package-level matchers (isManagedResource, isManagedOrWatchedResource) both using the new helper.

Add unit tests covering update, create, delete, and generic event behavior for both managed and watched resource predicates.

Description

What changed?

Why?

How?

Type of Change

  • Bug fix
  • New feature
  • CRD / API change
  • Refactoring (no functional change)
  • Documentation
  • CI / build

Checklist

  • make verify passes (vet, fmt, deps, bindata, generated files, govulncheck, git diff)
  • make test passes (unit + API integration tests)
  • make lint passes
  • New/changed CRD fields have appropriate CEL validation; add .testsuite.yaml tests for new CEL rules
  • New managed resources added to controllerManagedResources, buildCacheObjectList(), HasObjectChanged, and the ordered install sequence
  • No hand-edits to generated files (bindata.go, zz_generated.deepcopy.go, CRD YAML, fakes)
  • Error paths use the correct error type (IrrecoverableError / RetryRequiredError / UserConfigurationError)

Testing

Additional Context

Summary by CodeRabbit

  • Bug Fixes

    • Fixed reconciliation when ConfigMap watch labels are added or removed.
    • Improved detection of label changes across resource updates.
    • Preserved separate handling for managed resources and watched ConfigMaps.
  • Tests

    • Added coverage for create, update, delete, and generic events, including managed, watched, combined, unrelated, and empty label scenarios.
  • Documentation

    • Added a specification describing the issue, impact, root cause, and planned resolution.

…ld and new objects on update

The managedOrWatchedResources predicate was built with
predicate.NewPredicateFuncs which only inspects ObjectNew on update events.
When a watched label (e.g. trustedCABundle ConfigMap) was removed externally,
the event was filtered out and reconciliation never ran — breaking
self-healing for watched ConfigMaps.

Extract a shared labelMatchPredicate helper that builds predicate.Funcs
checking both ObjectOld and ObjectNew on updates. Consolidate the inline
isManagedResource closure and the NewPredicateFuncs block into two
package-level matchers (isManagedResource, isManagedOrWatchedResource) both
using the new helper.

Add unit tests covering update, create, delete, and generic event behavior
for both managed and watched resource predicates.
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 19, 2026
@openshift-ci

openshift-ci Bot commented Aug 19, 2026

Copy link
Copy Markdown

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci
openshift-ci Bot requested review from bharath-b-rh and swghosh August 19, 2026 17:51
@openshift-ci

openshift-ci Bot commented Aug 19, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: siddhibhor-56
Once this PR has been reviewed and has the lgtm label, please assign mytreya-rh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci

openshift-ci Bot commented Aug 19, 2026

Copy link
Copy Markdown

@siddhibhor-56: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-operator bcd14e0 link true /test e2e-operator
ci/prow/fips-image-scan-external-secrets bcd14e0 link true /test fips-image-scan-external-secrets
ci/prow/unit bcd14e0 link true /test unit
ci/prow/verify bcd14e0 link true /test verify
ci/prow/images bcd14e0 link true /test images
ci/prow/fips-image-scan-operator bcd14e0 link true /test fips-image-scan-operator
ci/prow/ci-bundle-external-secrets-operator-bundle bcd14e0 link true /test ci-bundle-external-secrets-operator-bundle

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: cce32f54-cb95-456d-bedf-dd5bacd02e0f

📥 Commits

Reviewing files that changed from the base of the PR and between a0124d7 and bcd14e0.

📒 Files selected for processing (4)
  • .work/solve/spec-ESO-481.md
  • pkg/controller/external_secrets/controller.go
  • pkg/controller/external_secrets/utils.go
  • pkg/controller/external_secrets/utils_test.go

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


Walkthrough

The change extracts reusable label predicates for managed and watched resources, updates controller wiring to use them, and adds tests for label transitions and resource event types.

Changes

ConfigMap predicate reconciliation fix

Layer / File(s) Summary
Shared label predicate implementation
.work/solve/spec-ESO-481.md, pkg/controller/external_secrets/utils.go
Adds nil-safe resource matching helpers and a predicate that evaluates both old and new objects during updates.
Controller predicate wiring
pkg/controller/external_secrets/controller.go
Replaces local predicate logic with shared predicates for managed and managed-or-watched resources.
Predicate event coverage
pkg/controller/external_secrets/utils_test.go
Adds table-driven tests for update, create, delete, and generic events across matching and non-matching label sets.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to bcd14

This localized predicate update and its accompanying tests leave no actionable merge-blocking risk; the PR is merge-ready after normal checks and review.

Suggested reviewers: bharath-b-rh, swghosh

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The diff adds standard Go tests with static function and subtest names; no Ginkgo declarations or dynamic values appear in test titles.
Test Structure And Quality ✅ Passed The PR adds standard Go table tests, not Ginkgo tests. They create only in-memory objects, use no cluster waits, and include diagnostic t.Fatalf messages; setup and cleanup requirements do not apply.
Microshift Test Compatibility ✅ Passed The diff adds only Go unit tests (TestLabelMatchPredicate...) in utils_test.go; it adds no Ginkgo e2e tests or MicroShift-incompatible API references.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR adds only standard Go unit tests (TestLabelMatchPredicate...); no new Ginkgo e2e tests or multi-node assumptions were introduced.
Topology-Aware Scheduling Compatibility ✅ Passed The diff only refactors controller event predicates and adds tests/spec text; it introduces no affinity, spread, replica, node targeting, toleration, or PDB scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The diff adds only predicate logic, tests, and a specification; it introduces no process-level stdout writes in main or suite setup.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds only Go unit tests using testing.T; no Ginkgo e2e tests, IPv4 assumptions, or external connectivity requirements were introduced.
No-Weak-Crypto ✅ Passed The HEAD diff only changes label predicates, event handling, tests, and a specification; no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret/token comparisons were added.
Container-Privileges ✅ Passed The PR adds no manifest security settings. The changed deployment code preserves allowPrivilegeEscalation=false and runAsNonRoot=true; manifests use non-root settings and hostNetwork=false.
No-Sensitive-Data-In-Logs ✅ Passed The diff adds no logging calls or sensitive log fields; it changes predicates and tests, while existing event logs expose only object type, name, and namespace.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the controller predicate fix addressed by the pull request.
✨ Finishing Touches 💡 2
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch eval/eso-481-jira-solve
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@swghosh

swghosh commented Aug 19, 2026

Copy link
Copy Markdown
Member

/retitle ai-eval: DNM, fix(controller): ESO-481 fix secondary watch predicates

@openshift-ci openshift-ci Bot changed the title fix(controller): ESO-481 fix secondary watch predicates to evaluate o… ai-eval: DNM, fix(controller): ESO-481 fix secondary watch predicates Aug 19, 2026
@siddhibhor-56
siddhibhor-56 marked this pull request as draft August 19, 2026 18:35
@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 Aug 19, 2026
@siddhibhor-56 siddhibhor-56 changed the title ai-eval: DNM, fix(controller): ESO-481 fix secondary watch predicates fix(controller): ESO-481 fix secondary watch predicates Aug 19, 2026
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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants