Skip to content

CM-1114: Add health probes and richer status conditions#417

Open
sebrandon1 wants to merge 1 commit into
openshift:masterfrom
sebrandon1:add-operator-health-probes
Open

CM-1114: Add health probes and richer status conditions#417
sebrandon1 wants to merge 1 commit into
openshift:masterfrom
sebrandon1:add-operator-health-probes

Conversation

@sebrandon1

@sebrandon1 sebrandon1 commented May 1, 2026

Copy link
Copy Markdown
Member

Summary

Health Probes

The operator deployment currently has no health probes, so Kubernetes cannot detect if the operator process is stuck or not yet ready to serve. All cert-manager operands (controller, webhook, cainjector, trust-manager, istio-csr) already have probes configured — the operator itself is the only component missing them.

The library-go controllercmd framework already serves /healthz and /readyz over HTTPS on port 8443 via its GenericAPIServer, so no Go code changes are needed.

  • Liveness/healthz (ping, log, post-start hooks)
  • Readiness/readyz (same checks + shutdown, so the pod drains traffic during graceful termination)

Richer Status Conditions

IstioCSR and TrustManager CRs currently report only two status conditions (Ready and Degraded) with generic reason constants (Failed, Ready, Progressing). Users can't tell why something is progressing or degraded without reading operator logs.

This adds:

  • A dedicated Progressing condition type alongside Ready and Degraded
  • Specific reason constants: Reconciling, WaitingForDependencies, ValidationFailed, MultipleInstancesFound
  • A ConditionReason field on ReconcileError with WithConditionReason() chainable setter so controllers can annotate errors with specific reasons
  • Updated HandleReconcileResult to manage all three conditions and extract specific reasons from errors

Test plan

Health Probes

$ curl -sk "https://localhost:8443/healthz?verbose"
[+]ping ok
[+]log ok
[+]poststarthook/max-in-flight-filter ok
[+]poststarthook/storage-object-count-tracker-hook ok
healthz check passed

$ curl -sk "https://localhost:8443/readyz?verbose"
[+]ping ok
[+]log ok
[+]poststarthook/max-in-flight-filter ok
[+]poststarthook/storage-object-count-tracker-hook ok
[+]shutdown ok
readyz check passed

Status Conditions — Reconciling

IstioCSR CR during active reconciliation (retrying due to missing namespace):

[
    {
        "lastTransitionTime": "2026-06-08T21:44:45Z",
        "message": "",
        "reason": "Ready",
        "status": "False",
        "type": "Degraded"
    },
    {
        "lastTransitionTime": "2026-06-08T21:44:45Z",
        "message": "reconciliation failed, retrying: failed to create istio-system/cert-manager-istio-csr role resource: ...",
        "reason": "Progressing",
        "status": "False",
        "type": "Ready"
    },
    {
        "lastTransitionTime": "2026-06-08T21:44:45Z",
        "message": "reconciliation in progress: failed to create istio-system/cert-manager-istio-csr role resource: ...",
        "reason": "Reconciling",
        "status": "True",
        "type": "Progressing"
    }
]

Status Conditions — MultipleInstancesFound

Second IstioCSR CR rejected as a duplicate:

[
    {
        "lastTransitionTime": "2026-06-08T21:45:06Z",
        "message": "",
        "reason": "MultipleInstancesFound",
        "status": "False",
        "type": "Degraded"
    },
    {
        "lastTransitionTime": "2026-06-08T21:45:06Z",
        "message": "multiple instances of istiocsr exists, cert-manager-operator/default will not be processed",
        "reason": "MultipleInstancesFound",
        "status": "False",
        "type": "Ready"
    },
    {
        "lastTransitionTime": "2026-06-08T21:45:06Z",
        "message": "multiple instances of istiocsr exists, cert-manager-operator/default will not be processed",
        "reason": "MultipleInstancesFound",
        "status": "False",
        "type": "Progressing"
    }
]
  • All unit tests pass (123/123 Ginkgo specs + all Go packages)
  • No lint issues from changed files
  • Verified on OCP 4.22 cluster — all three conditions visible with correct reasons
  • E2E tests pass

Summary by CodeRabbit

  • New Features

    • Added HTTPS liveness and readiness probes to the operator for improved pod health reporting.
    • Introduced/standardized the Progressing status condition for reconciliation state visibility.
  • Bug Fixes

    • Improved condition-reason specificity across validation failures, dependency waiting, and multiple-instance conflicts.
    • Updated reconciliation logic so Ready, Degraded, and Progressing are consistently set for success and error outcomes.
  • Tests

    • Updated unit and e2e expectations to cover the new/revised status conditions and reasons.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 1, 2026
@openshift-ci-robot

openshift-ci-robot commented May 1, 2026

Copy link
Copy Markdown

@sebrandon1: This pull request references CNF-23436 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

The operator deployment currently has no health probes, so Kubernetes cannot detect if the operator process is stuck or not yet ready to serve. All cert-manager operands (controller, webhook, cainjector, trust-manager, istio-csr) already have probes configured — the operator itself is the only component missing them.

The library-go controllercmd framework already serves /healthz and /readyz over HTTPS on port 8443 via its GenericAPIServer, so no Go code changes are needed.

  • Liveness/healthz (ping, log, post-start hooks)
  • Readiness/readyz (same checks + shutdown, so the pod drains traffic during graceful termination)

Test plan

Tested locally against an OCP 4.22 cluster:

$ curl -sk "https://localhost:8443/healthz?verbose"
[+]ping ok
[+]log ok
[+]poststarthook/max-in-flight-filter ok
[+]poststarthook/storage-object-count-tracker-hook ok
healthz check passed

$ curl -sk "https://localhost:8443/readyz?verbose"
[+]ping ok
[+]log ok
[+]poststarthook/max-in-flight-filter ok
[+]poststarthook/storage-object-count-tracker-hook ok
[+]shutdown ok
readyz check passed
  • Operator deploys and reports ready
  • /healthz and /readyz return 200 when operator is healthy
  • Pod is restarted by kubelet when liveness probe fails
  • Pod is removed from service endpoints during graceful shutdown via readyz shutdown check

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown

Walkthrough

The PR adds HTTPS liveness/readiness probes to operator manifests and expands reconciliation status handling to include Progressing plus condition-specific reasons across shared controller logic, IstioCSR, and TrustManager flows.

Changes

Condition status and health probes

Layer / File(s) Summary
Operator health probes
config/manager/manager.yaml, bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
Adds HTTPS liveness and readiness checks on /healthz and /readyz using the named https port and configured timing thresholds.
Condition contracts and error reasons
api/operator/v1alpha1/conditions.go, api/operator/v1alpha1/conditions_test.go, pkg/controller/common/errors.go, pkg/controller/common/errors_test.go
Adds the Progressing condition type, new reason constants, and ConditionReason storage and extraction helpers with tests.
Shared reconcile status handling
pkg/controller/common/reconcile_result.go
Updates irrecoverable, recoverable, and successful reconciliation paths to set Degraded, Ready, and Progressing using resolved condition reasons.
Controller-specific reason propagation
pkg/controller/istiocsr/*, pkg/controller/trustmanager/*, test/e2e/trustmanager_test.go
Attaches validation, dependency, and multiple-instance reasons and updates controller and e2e condition expectations.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Controller
  participant ReconcileResult
  participant ReconcileError
  participant StatusConditions
  Controller->>ReconcileResult: HandleReconcileResult(error)
  ReconcileResult->>ReconcileError: GetConditionReason(error)
  ReconcileResult->>StatusConditions: Set Degraded, Ready, and Progressing
  StatusConditions-->>Controller: updateConditionFn(result)
Loading

Suggested reviewers: swghosh, trilokgeer

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: adding health probes and richer status conditions.
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 Changed Ginkgo/test names are static and deterministic; no titles include generated IDs, timestamps, namespaces, or other dynamic values.
Test Structure And Quality ✅ Passed The changed tests stay within existing patterns: focused table cases/unit asserts, e2e uses BeforeAll/AfterAll + AfterEach cleanup, and all Eventually/Consistently calls have explicit timeouts.
Microshift Test Compatibility ✅ Passed PASS: The e2e diff only updates expectations in an existing test; no new Ginkgo blocks or MicroShift-unsupported APIs/resources were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The touched e2e specs only assert CR/Deployment state and RBAC; they don't count nodes or require HA/SNO skips, so no multi-node assumption was added.
Topology-Aware Scheduling Compatibility ✅ Passed The patch only adds HTTPS liveness/readiness probes; the diff contains no topology-sensitive scheduling fields like anti-affinity, node selectors, or spread constraints.
Ote Binary Stdout Contract ✅ Passed No new stdout writes were added in main/init/TestMain/suite setup; the only new output is to GinkgoWriter, and init() only registers schemes.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The changed e2e test only updates status assertions; it uses cluster-internal objects and no hardcoded IPv4, localhost, or external hosts.
No-Weak-Crypto ✅ Passed No weak crypto, custom crypto, or secret/token comparisons appear in the changed files; the diff only touches probes and condition handling.
Container-Privileges ✅ Passed Changed manifests keep allowPrivilegeEscalation=false, privileged=false, runAsNonRoot=true, and no hostPID/hostNetwork/hostIPC/SYS_ADMIN were introduced.
No-Sensitive-Data-In-Logs ✅ Passed No new logs expose secrets, PII, tokens, or hostnames; the only log change is a structured message with namespace/name and reason fields.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot requested review from TrilokGeer and swghosh May 1, 2026 16:41
@openshift-ci

openshift-ci Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@sebrandon1 sebrandon1 force-pushed the add-operator-health-probes branch from e2f1df3 to cc2910e Compare May 5, 2026 22:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
config/manager/manager.yaml (1)

114-122: ⚡ Quick win

Tune readiness probe for faster drain on shutdown.

To better align with graceful termination, Line 120 and Line 122 are a bit slow (10s * 3 worst-case before NotReady). Consider faster readiness failure so endpoints stop routing sooner.

Suggested tweak
           readinessProbe:
             httpGet:
               path: /readyz
               port: https
               scheme: HTTPS
             initialDelaySeconds: 5
-            periodSeconds: 10
+            periodSeconds: 5
             timeoutSeconds: 5
-            failureThreshold: 3
+            failureThreshold: 1
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@config/manager/manager.yaml` around lines 114 - 122, The readinessProbe for
the manager (httpGet path "/readyz", scheme HTTPS) is too slow to mark Pod
NotReady during shutdown; adjust readinessProbe settings to fail faster by
lowering periodSeconds (e.g., from 10 to 2–3), reducing failureThreshold (e.g.,
from 3 to 1–2) and/or decreasing timeoutSeconds to ensure the probe transitions
to NotReady quickly so endpoints are drained sooner; update the readinessProbe
block (httpGet path /readyz, initialDelaySeconds, periodSeconds, timeoutSeconds,
failureThreshold) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@config/manager/manager.yaml`:
- Around line 114-122: The readinessProbe for the manager (httpGet path
"/readyz", scheme HTTPS) is too slow to mark Pod NotReady during shutdown;
adjust readinessProbe settings to fail faster by lowering periodSeconds (e.g.,
from 10 to 2–3), reducing failureThreshold (e.g., from 3 to 1–2) and/or
decreasing timeoutSeconds to ensure the probe transitions to NotReady quickly so
endpoints are drained sooner; update the readinessProbe block (httpGet path
/readyz, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold)
accordingly.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: f1db3899-53e4-40c3-a38c-c2fc93c4f11f

📥 Commits

Reviewing files that changed from the base of the PR and between e2f1df3 and cc2910e.

📒 Files selected for processing (2)
  • bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
  • config/manager/manager.yaml

@sebrandon1 sebrandon1 force-pushed the add-operator-health-probes branch from cc2910e to d9d40bd Compare May 14, 2026 19:07
@sebrandon1 sebrandon1 force-pushed the add-operator-health-probes branch from d9d40bd to 7285ee6 Compare May 29, 2026 15:51
@sebrandon1 sebrandon1 force-pushed the add-operator-health-probes branch from 7285ee6 to 53508d0 Compare June 8, 2026 21:39
@sebrandon1 sebrandon1 changed the title CNF-23436: Add liveness and readiness probes to operator deployment CNF-23436: Add health probes and richer status conditions Jun 8, 2026
@sebrandon1 sebrandon1 force-pushed the add-operator-health-probes branch 2 times, most recently from 19e3212 to 4e2bb0d Compare June 9, 2026 17:47
@sebrandon1

Copy link
Copy Markdown
Member Author

/retest

@sebrandon1 sebrandon1 changed the title CNF-23436: Add health probes and richer status conditions CM-1114: Add health probes and richer status conditions Jun 10, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 10, 2026

Copy link
Copy Markdown

@sebrandon1: This pull request references CM-1114 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

Health Probes

The operator deployment currently has no health probes, so Kubernetes cannot detect if the operator process is stuck or not yet ready to serve. All cert-manager operands (controller, webhook, cainjector, trust-manager, istio-csr) already have probes configured — the operator itself is the only component missing them.

The library-go controllercmd framework already serves /healthz and /readyz over HTTPS on port 8443 via its GenericAPIServer, so no Go code changes are needed.

  • Liveness/healthz (ping, log, post-start hooks)
  • Readiness/readyz (same checks + shutdown, so the pod drains traffic during graceful termination)

Richer Status Conditions

IstioCSR and TrustManager CRs currently report only two status conditions (Ready and Degraded) with generic reason constants (Failed, Ready, Progressing). Users can't tell why something is progressing or degraded without reading operator logs.

This adds:

  • A dedicated Progressing condition type alongside Ready and Degraded
  • Specific reason constants: Reconciling, WaitingForDependencies, ValidationFailed, MultipleInstancesFound
  • A ConditionReason field on ReconcileError with WithConditionReason() chainable setter so controllers can annotate errors with specific reasons
  • Updated HandleReconcileResult to manage all three conditions and extract specific reasons from errors

Test plan

Health Probes

$ curl -sk "https://localhost:8443/healthz?verbose"
[+]ping ok
[+]log ok
[+]poststarthook/max-in-flight-filter ok
[+]poststarthook/storage-object-count-tracker-hook ok
healthz check passed

$ curl -sk "https://localhost:8443/readyz?verbose"
[+]ping ok
[+]log ok
[+]poststarthook/max-in-flight-filter ok
[+]poststarthook/storage-object-count-tracker-hook ok
[+]shutdown ok
readyz check passed

Status Conditions — Reconciling

IstioCSR CR during active reconciliation (retrying due to missing namespace):

[
   {
       "lastTransitionTime": "2026-06-08T21:44:45Z",
       "message": "",
       "reason": "Ready",
       "status": "False",
       "type": "Degraded"
   },
   {
       "lastTransitionTime": "2026-06-08T21:44:45Z",
       "message": "reconciliation failed, retrying: failed to create istio-system/cert-manager-istio-csr role resource: ...",
       "reason": "Progressing",
       "status": "False",
       "type": "Ready"
   },
   {
       "lastTransitionTime": "2026-06-08T21:44:45Z",
       "message": "reconciliation in progress: failed to create istio-system/cert-manager-istio-csr role resource: ...",
       "reason": "Reconciling",
       "status": "True",
       "type": "Progressing"
   }
]

Status Conditions — MultipleInstancesFound

Second IstioCSR CR rejected as a duplicate:

[
   {
       "lastTransitionTime": "2026-06-08T21:45:06Z",
       "message": "",
       "reason": "MultipleInstancesFound",
       "status": "False",
       "type": "Degraded"
   },
   {
       "lastTransitionTime": "2026-06-08T21:45:06Z",
       "message": "multiple instances of istiocsr exists, cert-manager-operator/default will not be processed",
       "reason": "MultipleInstancesFound",
       "status": "False",
       "type": "Ready"
   },
   {
       "lastTransitionTime": "2026-06-08T21:45:06Z",
       "message": "multiple instances of istiocsr exists, cert-manager-operator/default will not be processed",
       "reason": "MultipleInstancesFound",
       "status": "False",
       "type": "Progressing"
   }
]
  • All unit tests pass (123/123 Ginkgo specs + all Go packages)
  • No lint issues from changed files
  • Verified on OCP 4.22 cluster — all three conditions visible with correct reasons
  • E2E tests pass

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 openshift-eng/jira-lifecycle-plugin repository.

@sebrandon1 sebrandon1 force-pushed the add-operator-health-probes branch 2 times, most recently from d43d440 to 3cdd7f9 Compare June 15, 2026 16:25
@sebrandon1 sebrandon1 force-pushed the add-operator-health-probes branch 2 times, most recently from 858bcea to 28e5593 Compare June 24, 2026 19:51
@sebrandon1 sebrandon1 force-pushed the add-operator-health-probes branch from 28e5593 to b550fd8 Compare July 6, 2026 16:17
@sebrandon1

Copy link
Copy Markdown
Member Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

Add liveness and readiness probes to the operator deployment.

Add a Progressing condition type and specific reason codes
(Reconciling, WaitingForDependencies, ValidationFailed,
MultipleInstancesFound) to IstioCSR and TrustManager CRs for
richer diagnostic information without checking operator logs.
@sebrandon1 sebrandon1 force-pushed the add-operator-health-probes branch from b550fd8 to b484ca2 Compare July 13, 2026 17:58

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/controller/common/errors.go`:
- Around line 143-146: Update GetConditionReason to verify rerr is non-nil after
errors.As succeeds before accessing ConditionReason, returning the existing
fallback for a typed-nil *ReconcileError; add a regression test covering an
error interface containing a nil *ReconcileError.

In `@pkg/controller/trustmanager/install_trustmanager.go`:
- Around line 21-23: Update the error handling around validateTrustNamespace in
the trust-manager installation flow to distinguish a missing trust namespace
from lookup/API failures. Wrap only the not-found result with
ReasonWaitingForDependencies; propagate other validation errors without that
reason so transient failures remain retryable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: bac91557-f9e0-4aaf-8ed7-9e5aedab1f3c

📥 Commits

Reviewing files that changed from the base of the PR and between d9d40bd and b484ca2.

📒 Files selected for processing (13)
  • api/operator/v1alpha1/conditions.go
  • api/operator/v1alpha1/conditions_test.go
  • bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
  • config/manager/manager.yaml
  • pkg/controller/common/errors.go
  • pkg/controller/common/errors_test.go
  • pkg/controller/common/reconcile_result.go
  • pkg/controller/istiocsr/controller_test.go
  • pkg/controller/istiocsr/install_istiocsr.go
  • pkg/controller/istiocsr/utils.go
  • pkg/controller/trustmanager/controller_test.go
  • pkg/controller/trustmanager/install_trustmanager.go
  • test/e2e/trustmanager_test.go
🚧 Files skipped from review as they are similar to previous changes (10)
  • pkg/controller/istiocsr/install_istiocsr.go
  • bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
  • config/manager/manager.yaml
  • pkg/controller/istiocsr/utils.go
  • pkg/controller/common/errors_test.go
  • api/operator/v1alpha1/conditions.go
  • pkg/controller/trustmanager/controller_test.go
  • api/operator/v1alpha1/conditions_test.go
  • test/e2e/trustmanager_test.go
  • pkg/controller/istiocsr/controller_test.go

Comment on lines +143 to +146
func GetConditionReason(err error) string {
rerr := &ReconcileError{}
if errors.As(err, &rerr) {
return rerr.ConditionReason

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 4 '\bGetConditionReason\s*\(' --glob '*.go' || true
rg -n -C 4 '\(\*ReconcileError\)\(nil\)|var[[:space:]].*\*ReconcileError' --glob '*_test.go' || true

Repository: openshift/cert-manager-operator

Length of output: 169


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the relevant file and inspect the surrounding code.
git ls-files 'pkg/controller/common/errors.go' 'pkg/controller/common/*test.go'
wc -l pkg/controller/common/errors.go
sed -n '1,240p' pkg/controller/common/errors.go

# Look for definitions/usages of ReconcileError and existing tests.
rg -n -C 3 'type ReconcileError|ConditionReason|GetConditionReason|errors\.As\(' pkg/controller/common --glob '*.go'

Repository: openshift/cert-manager-operator

Length of output: 14082


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Narrowly inspect tests and any typed-nil construction patterns.
rg -n -C 3 'ReconcileError|GetConditionReason|typed nil|nil\)\)|\(\*ReconcileError\)\(nil\)' pkg --glob '*.go'

Repository: openshift/cert-manager-operator

Length of output: 14380


🏁 Script executed:

#!/bin/bash
set -euo pipefail

cat >/tmp/typed_nil_probe.go <<'GO'
package main

import (
	"errors"
	"fmt"
)

type ReconcileError struct {
	ConditionReason string
}

func (e *ReconcileError) Error() string { return "x" }

func main() {
	var inner *ReconcileError = nil
	var err error = inner

	var rerr *ReconcileError
	ok := errors.As(err, &rerr)
	fmt.Printf("errors.As=%v rerr==nil=%v\n", ok, rerr == nil)
	if ok && rerr != nil {
		fmt.Println(rerr.ConditionReason)
	} else if ok {
		fmt.Println("would panic if dereferenced")
	}
}
GO

go run /tmp/typed_nil_probe.go

Repository: openshift/cert-manager-operator

Length of output: 227


Guard GetConditionReason against typed-nil *ReconcileError values. errors.As can match an error interface holding a nil *ReconcileError, leaving rerr == nil and making rerr.ConditionReason panic. Check rerr != nil before dereferencing and add a regression test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/controller/common/errors.go` around lines 143 - 146, Update
GetConditionReason to verify rerr is non-nil after errors.As succeeds before
accessing ConditionReason, returning the existing fallback for a typed-nil
*ReconcileError; add a regression test covering an error interface containing a
nil *ReconcileError.

Comment on lines 21 to +23
if err := r.validateTrustNamespace(trustNamespace); err != nil {
return common.NewIrrecoverableError(err, "trust namespace %q validation failed", trustNamespace)
return common.NewIrrecoverableError(err, "trust namespace %q validation failed", trustNamespace).
WithConditionReason(v1alpha1.ReasonWaitingForDependencies)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 10 '\b(namespaceExists|validateTrustNamespace)\b' --glob '*.go' || true
rg -n -C 5 'ReasonWaitingForDependencies|NewIrrecoverableError' --glob '*.go' || true

Repository: openshift/cert-manager-operator

Length of output: 169


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Files of interest:\n'
git ls-files 'pkg/controller/trustmanager/*' 'pkg/controller/**/reconcile_result.go' 'pkg/**/reconcile_result.go' 'pkg/**/install_trustmanager.go' | sed -n '1,200p'

printf '\nSearch for relevant symbols:\n'
rg -n -C 3 'validateTrustNamespace|namespaceExists|ReasonWaitingForDependencies|NewIrrecoverableError|irrecoverable' pkg --glob '*.go' || true

printf '\nOutline candidate file(s):\n'
for f in $(git ls-files 'pkg/controller/trustmanager/install_trustmanager.go' 'pkg/controller/**/reconcile_result.go' 'pkg/**/reconcile_result.go' 2>/dev/null); do
  echo "### $f"
  ast-grep outline "$f" --view expanded 2>/dev/null || true
done

Repository: openshift/cert-manager-operator

Length of output: 29604


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '70,90p' pkg/controller/trustmanager/install_trustmanager.go | cat -n
printf '\n---\n'
sed -n '1,80p' pkg/controller/common/reconcile_result.go | cat -n

Repository: openshift/cert-manager-operator

Length of output: 5136


Split trust-namespace lookup failures from not-found pkg/controller/trustmanager/install_trustmanager.go:21-23
validateTrustNamespace returns both “namespace does not exist” and “failed to check if namespace exists,” but both are wrapped as ReasonWaitingForDependencies and then treated as irrecoverable. That makes transient client/API failures skip the retry path; keep the waiting-for-dependencies reason only for the not-found case.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/controller/trustmanager/install_trustmanager.go` around lines 21 - 23,
Update the error handling around validateTrustNamespace in the trust-manager
installation flow to distinguish a missing trust namespace from lookup/API
failures. Wrap only the not-found result with ReasonWaitingForDependencies;
propagate other validation errors without that reason so transient failures
remain retryable.

@openshift-ci

openshift-ci Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@sebrandon1: 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-tech-preview b484ca2 link false /test e2e-operator-tech-preview
ci/prow/e2e-operator b484ca2 link true /test e2e-operator

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.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants