Skip to content

✨Namespace and PVC probes#2535

Open
dtfranz wants to merge 1 commit intooperator-framework:mainfrom
dtfranz:pvc-namespace-probes
Open

✨Namespace and PVC probes#2535
dtfranz wants to merge 1 commit intooperator-framework:mainfrom
dtfranz:pvc-namespace-probes

Conversation

@dtfranz
Copy link
Contributor

@dtfranz dtfranz commented Mar 3, 2026

Adds readiness probing via CEL for namespaces and PVCs, to prevent subsequent phases from installing until their readiness checks have passed. Also adds e2e coverage via direct CER creation.

Description

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

Copilot AI review requested due to automatic review settings March 3, 2026 15:07
@netlify
Copy link

netlify bot commented Mar 3, 2026

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 1f0a99f
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/69a8079a1b07a4000807034e
😎 Deploy Preview https://deploy-preview-2535--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@openshift-ci openshift-ci bot requested review from ankitathomas and bentito March 3, 2026 15:08
@openshift-ci
Copy link

openshift-ci bot commented Mar 3, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign pedjak 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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds readiness probing for additional Kubernetes resource types (Namespaces and PVCs) using CEL-based probes in the ClusterExtensionRevision reconciliation flow, and extends the e2e framework + scenarios to validate direct CER application and phase-blocking behavior when probes fail.

Changes:

  • Add CEL readiness probes for Namespace (Active) and PersistentVolumeClaim (Bound) and wire them into the CER progress probe chain.
  • Extend e2e step framework to support direct ClusterExtensionRevision application and scenario templating via ${CER_NAME}.
  • Add new e2e feature coverage for CER install success and probe-driven phase progression/halting (PVC scenarios), plus required RBAC.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/e2e/steps/testdata/rbac-template.yaml Grants e2e SA permissions for PV/PVC resources needed by new scenarios.
test/e2e/steps/steps.go Adds ${CER_NAME} templating and helper to fetch CER objects; expands step matching for “not installed”.
test/e2e/steps/hooks.go Extends scenario context with CER name/state and updates cleanup behavior.
test/e2e/features/revision.feature New e2e feature validating direct CER apply + probe gating for PVC phases.
test/e2e/README.md Documents the new ${CER_NAME} scenario variable.
internal/operator-controller/controllers/clusterextensionrevision_controller.go Initializes and registers CEL probes for Namespace/PVC readiness in CER reconcile options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dtfranz dtfranz force-pushed the pvc-namespace-probes branch 2 times, most recently from d87dfaf to 6a9f311 Compare March 3, 2026 15:45
Copilot AI review requested due to automatic review settings March 3, 2026 15:45
@dtfranz dtfranz force-pushed the pvc-namespace-probes branch from 6a9f311 to ec5019e Compare March 3, 2026 15:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 64.70588% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.61%. Comparing base (55473d8) to head (1f0a99f).

Files with missing lines Patch % Lines
...controllers/clusterextensionrevision_controller.go 64.70% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2535      +/-   ##
==========================================
- Coverage   68.62%   68.61%   -0.02%     
==========================================
  Files         131      131              
  Lines        9288     9304      +16     
==========================================
+ Hits         6374     6384      +10     
- Misses       2427     2430       +3     
- Partials      487      490       +3     
Flag Coverage Δ
e2e 42.26% <0.00%> (-0.09%) ⬇️
experimental-e2e 52.09% <64.70%> (+0.07%) ⬆️
unit 53.62% <5.88%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dtfranz dtfranz force-pushed the pvc-namespace-probes branch 2 times, most recently from 493a1a7 to 1c7882b Compare March 4, 2026 09:31
Copilot AI review requested due to automatic review settings March 4, 2026 09:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 323 to +327
func (c *ClusterExtensionRevisionReconciler) SetupWithManager(mgr ctrl.Manager) error {
// Initialize probes once at setup time
if err := initializeProbes(); err != nil {
return err
}
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initializeProbes() is only invoked from SetupWithManager, but unit tests (and any direct calls to Reconcile without calling SetupWithManager) construct the reconciler and call Reconcile directly. In that case namespaceActiveProbe/pvcBoundProbe remain zero values, so the new readiness probes are effectively disabled (and could diverge from production behavior). Consider initializing these probes via a sync.Once guard that’s called from toBoxcutterRevision/Reconcile (and optionally from SetupWithManager), so probes are always available when reconciliation runs.

Copilot uses AI. Check for mistakes.
Adds readiness probing via CEL for namespaces and PVCs, to prevent subsequent phases from installing until their readiness checks have passed. Also adds e2e coverage via direct CER creation. Increased e2e timeout to 15m for experimental target.

Signed-off-by: Daniel Franz <dfranz@redhat.com>
@dtfranz dtfranz force-pushed the pvc-namespace-probes branch from 1c7882b to 1f0a99f Compare March 4, 2026 10:21
Copy link
Contributor

@pedjak pedjak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if for this PR is necessary to expose direct creation of CERs, instead of going through CE and appropriate bundles.

}

// initializeProbes is used to initialize CEL probes at startup time, so we don't recreate them on every reconcile
func initializeProbes() error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would actually wrap this function into sync.OnceValue and then call it from reconcile loop - it looks cleaner from workflow point of view.

And ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}

@BoxcutterRuntime
Scenario: Install simple revision
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this scenario related to the logic introduced in PR? We have plenty of scenarios under install.feature that install exactly these resources.

}

// initializeProbes is used to initialize CEL probes at startup time, so we don't recreate them on every reconcile
func initializeProbes() error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would wrap this into sync.OnceValue and then call it from reconcile loop, it feels more natural and matches the flow.

"""

And resource "persistentvolumeclaim/test-pvc" is installed
And ClusterExtensionRevision "${CER_NAME}" reports Available as False with Reason ProbeFailure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any message we could assert?

for _, r := range forDeletion {
if _, err := k8sClient("delete", r.kind, r.name, "--ignore-not-found=true"); err != nil {
logger.Info("Error deleting resource", "name", r.name, "namespace", sc.namespace, "stderr", stderrOutput(err))
for _, r := range forDeletion {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this change related to the PR?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants