Upgrade k8s v0.34.8, controller-runtime v0.22.5 (OCP 4.21 alignment)#434
Conversation
|
/label tide/merge-method-squash 🤖 Claude claude@anthropic.com commenting on behalf of @clcollins |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughModernize event handlers to typed controller-runtime APIs, update tests and fake clients to client.Object and typed queues, remove loop-variable copies, deterministically sort finalizers, bump dependencies and CRD list-type, and add an operator validation script. ChangesOperator modernization and validation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 1 warning)
✅ Passed checks (13 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/validate-event-handlers.sh (1)
85-87: ⚡ Quick winAvoid unconditional stderr suppression in
elevated_oc.Dropping all stderr makes auth/permission/API failures look like empty results and obscures root cause. Consider suppressing stderr only in non-verbose mode.
Proposed refactor
elevated_oc() { - ocm backplane elevate "${TICKET}" -- "${@}" 2>/dev/null + if [[ "${VERBOSE}" == "true" ]]; then + ocm backplane elevate "${TICKET}" -- "${@}" + else + ocm backplane elevate "${TICKET}" -- "${@}" 2>/dev/null + fi }🤖 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 `@scripts/validate-event-handlers.sh` around lines 85 - 87, The elevated_oc function currently unconditionally discards stderr which hides auth/permission/API errors; change elevated_oc (the function calling ocm backplane elevate "${TICKET}" -- "${@}") to only redirect stderr to /dev/null when a non-verbose mode is active (e.g., check a VERBOSE or QUIET flag) and otherwise let stderr pass through (or capture and log it); implement the conditional around the redirection so verbose runs show ocm error output while quiet runs suppress it.
🤖 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 `@scripts/validate-event-handlers.sh`:
- Around line 80-83: The show_help function currently always exits 0 and option
handlers reference ${2} without checking it; change show_help() to return a
non-zero status for usage/errors (e.g., exit 2) and ensure it can
accept/propagate an explicit exit code for success vs error; for option parsing
(the -n/-t branches that use ${2}) guard access with a safe test like if [ -z
"${2:-}" ]; then echo "Missing argument for -n/-t" >&2; show_help 2; fi (or use
${2:-} in tests) before using the value, and mirror these fixes in the other
similar handler blocks referenced (the other option-check sections noted in the
comment) so missing arguments produce a clear error and non-zero exit rather
than aborting under set -u.
---
Nitpick comments:
In `@scripts/validate-event-handlers.sh`:
- Around line 85-87: The elevated_oc function currently unconditionally discards
stderr which hides auth/permission/API errors; change elevated_oc (the function
calling ocm backplane elevate "${TICKET}" -- "${@}") to only redirect stderr to
/dev/null when a non-verbose mode is active (e.g., check a VERBOSE or QUIET
flag) and otherwise let stderr pass through (or capture and log it); implement
the conditional around the redirection so verbose runs show ocm error output
while quiet runs suppress it.
🪄 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 YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: c79f929f-9771-4bd6-bb66-b38fa13bc128
⛔ Files ignored due to path filters (7)
boilerplate/_data/last-boilerplate-commitis excluded by!boilerplate/**boilerplate/openshift/golang-osd-operator/dependabot.ymlis excluded by!boilerplate/**boilerplate/openshift/golang-osd-operator/ensure.shis excluded by!boilerplate/**boilerplate/openshift/golang-osd-operator/olm_pko_migration.pyis excluded by!boilerplate/**build/Dockerfileis excluded by!build/**build/Dockerfile.olm-registryis excluded by!build/**go.sumis excluded by!**/*.sum
📒 Files selected for processing (9)
controllers/pagerdutyintegration/event_handlers.gocontrollers/pagerdutyintegration/event_handlers_test.gocontrollers/pagerdutyintegration/pagerdutyintegration_controller.gocontrollers/pagerdutyintegration/pagerdutyintegration_controller_test.godeploy/crds/pagerduty.openshift.io_pagerdutyintegrations.yamlgo.modpkg/pagerduty/service_test.gopkg/utils/utils.goscripts/validate-event-handlers.sh
💤 Files with no reviewable changes (2)
- pkg/pagerduty/service_test.go
- controllers/pagerdutyintegration/pagerdutyintegration_controller.go
1ad31e0 to
972fa0f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@scripts/validate-event-handlers.sh`:
- Line 176: The grep assignments (e.g., WATCH_COUNT=$(echo "${LOGS}" | grep
--count "Starting EventSource" 2>/dev/null || echo "0")) append an extra token
("0") when grep returns non-zero, producing malformed counters like "0 0";
replace them to rely on grep -c output (which prints 0 on no matches) by
removing the "|| echo \"0\"" fallback and using e.g. WATCH_COUNT=$(echo
"${LOGS}" | grep -c "Starting EventSource" 2>/dev/null) (apply the same change
to the other similar variables/assignments at the other locations).
🪄 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 YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 1d76ce94-23c3-4aa4-b66c-aba61613c50e
⛔ Files ignored due to path filters (7)
boilerplate/_data/last-boilerplate-commitis excluded by!boilerplate/**boilerplate/openshift/golang-osd-operator/dependabot.ymlis excluded by!boilerplate/**boilerplate/openshift/golang-osd-operator/ensure.shis excluded by!boilerplate/**boilerplate/openshift/golang-osd-operator/olm_pko_migration.pyis excluded by!boilerplate/**build/Dockerfileis excluded by!build/**build/Dockerfile.olm-registryis excluded by!build/**go.sumis excluded by!**/*.sum
📒 Files selected for processing (9)
controllers/pagerdutyintegration/event_handlers.gocontrollers/pagerdutyintegration/event_handlers_test.gocontrollers/pagerdutyintegration/pagerdutyintegration_controller.gocontrollers/pagerdutyintegration/pagerdutyintegration_controller_test.godeploy/crds/pagerduty.openshift.io_pagerdutyintegrations.yamlgo.modpkg/pagerduty/service_test.gopkg/utils/utils.goscripts/validate-event-handlers.sh
💤 Files with no reviewable changes (2)
- pkg/pagerduty/service_test.go
- controllers/pagerdutyintegration/pagerdutyintegration_controller.go
🚧 Files skipped from review as they are similar to previous changes (6)
- pkg/utils/utils.go
- deploy/crds/pagerduty.openshift.io_pagerdutyintegrations.yaml
- controllers/pagerdutyintegration/event_handlers.go
- controllers/pagerdutyintegration/pagerdutyintegration_controller_test.go
- go.mod
- controllers/pagerdutyintegration/event_handlers_test.go
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #434 +/- ##
==========================================
+ Coverage 61.07% 63.04% +1.96%
==========================================
Files 22 22
Lines 1824 1821 -3
==========================================
+ Hits 1114 1148 +34
+ Misses 567 530 -37
Partials 143 143
🚀 New features to boost your workflow:
|
|
/retest ci/prow/lint Lint failure was a timeout (0 issues found, Also addressed both CodeRabbit findings in the validation script:
🤖 Claude claude@anthropic.com commenting on behalf of @clcollins |
|
/retest ci/prow/lint Lint pod was terminated before golangci-lint ran — CI infrastructure issue, not a code problem. 🤖 Claude claude@anthropic.com commenting on behalf of @clcollins |
|
/retest |
|
/retest ci/prow/lint Third OOM/infrastructure failure on lint — no code issues. Retesting. 🤖 Claude claude@anthropic.com commenting on behalf of @clcollins |
|
/lgtm |
|
/retest 🤖 Claude claude@anthropic.com commenting on behalf of @clcollins |
Standalone validation script that checks operator event handler health on a live cluster. Validates watch registration, reconciliation activity, completion, error-free operation, PD API heartbeat, and deployed image version. Intended to capture a baseline before upgrades and confirm no regressions after. Created with assistance from Claude 🤖 <claude@anthropic.com> Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
Test Create/Update/Delete/Generic interface methods directly against the workqueue for all three handler types. Validates enqueue behavior, de-duplication on Update, owner-based routing, and namespace filtering. These lock in pre-upgrade behavior before the typed workqueue migration. Created with assistance from Claude 🤖 <claude@anthropic.com> Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
Bump k8s.io/api, apimachinery, client-go from v0.29.3 to v0.34.8 and sigs.k8s.io/controller-runtime from v0.17.3 to v0.22.5, aligning with OpenShift 4.21. Go directive stays at 1.25.0 (boilerplate-compatible). Migrate all 15 event handler signatures to typed interfaces: - event.CreateEvent -> event.TypedCreateEvent[client.Object] - workqueue.RateLimitingInterface -> workqueue.TypedRateLimitingInterface[reconcile.Request] Migrate test files from deprecated WithRuntimeObjects/[]runtime.Object to WithObjects/[]client.Object. Update queue-level tests to use typed workqueue (removes type assertions on q.Get()). Created with assistance from Claude 🤖 <claude@anthropic.com> Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
- Migrate sets.NewString() to generic sets.New[string]() API with slices.Sort(UnsortedList()) preserving sorted finalizer output - Remove 6 gosec G601 loop variable shadow workarounds (Go 1.22+ scopes loop variables per-iteration, making these dead code) - Update stale controller-runtime comment references from v0.12.1 to v0.22.5 Created with assistance from Claude 🤖 <claude@anthropic.com> Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
Created with assistance from Claude 🤖 <claude@anthropic.com> Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
controller-gen from controller-runtime v0.22 adds x-kubernetes-list-type annotations to the CRD schema. Created with assistance from Claude 🤖 <claude@anthropic.com> Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
Created with assistance from Claude 🤖 <claude@anthropic.com> Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
- show_help() now accepts an exit code parameter, error paths exit 2
- Guard -n/--ticket option args with $# check before accessing ${2}
- Replace grep --count || echo "0" with || true to avoid double output
Created with assistance from Claude 🤖 <claude@anthropic.com>
Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
864c142 to
c0c74d1
Compare
There was a problem hiding this comment.
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 `@scripts/validate-event-handlers.sh`:
- Around line 141-149: Add explicit prerequisite checks at the start of main()
in scripts/validate-event-handlers.sh to fail fast if required CLIs are missing:
use command -v to test for oc and ocm (and any wrapper like elevated_oc if it's
an external dependency) before the first oc whoami call, and call log_fail with
a clear message and unique error code (e.g., "oc_missing" / "ocm_missing") if
either is absent; this prevents misleading downstream errors (references:
main(), elevated_oc wrapper and the oc whoami check).
- Around line 157-159: The current POD_NAME assignment uses .items[0] which can
target non-running/terminating replicas; change the elevated_oc get pods call
that sets POD_NAME to filter for a Running and Ready operator pod and select
deterministically (e.g., use --field-selector=status.phase=Running and filter
containerStatuses[*].ready=true or use --sort-by=.metadata.creationTimestamp
with a subsequent deterministic selection) so POD_NAME always points to a live
operator pod; update the POD_NAME variable assignment (the line that calls
elevated_oc get pods -n "${NAMESPACE}" -l name=pagerduty-operator ...) to
include these filters/ordering and fall back safely (empty string) if no
suitable pod is found, since POD_NAME is used for log, restart-count, and image
checks.
🪄 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 YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 07e395e7-104c-483b-82e8-84f5495d4415
⛔ Files ignored due to path filters (8)
boilerplate/_data/last-boilerplate-commitis excluded by!boilerplate/**boilerplate/openshift/golang-osd-operator/docs/pre-commit.mdis excluded by!boilerplate/**boilerplate/openshift/golang-osd-operator/olm_pko_migration.pyis excluded by!boilerplate/**boilerplate/openshift/golang-osd-operator/pre-commit-config.yamlis excluded by!boilerplate/**boilerplate/openshift/golang-osd-operator/standard.mkis excluded by!boilerplate/**build/Dockerfileis excluded by!build/**build/Dockerfile.olm-registryis excluded by!build/**go.sumis excluded by!**/*.sum
📒 Files selected for processing (11)
.pre-commit-config.yamlcontrollers/pagerdutyintegration/event_handlers.gocontrollers/pagerdutyintegration/event_handlers_test.gocontrollers/pagerdutyintegration/pagerdutyintegration_controller.gocontrollers/pagerdutyintegration/pagerdutyintegration_controller_test.godeploy/crds/pagerduty.openshift.io_pagerdutyintegrations.yamldeploy_pko/CustomResourceDefinition-pagerdutyintegrations.pagerduty.openshift.io.yamlgo.modpkg/pagerduty/service_test.gopkg/utils/utils.goscripts/validate-event-handlers.sh
💤 Files with no reviewable changes (2)
- pkg/pagerduty/service_test.go
- controllers/pagerdutyintegration/pagerdutyintegration_controller.go
✅ Files skipped from review due to trivial changes (2)
- .pre-commit-config.yaml
- deploy_pko/CustomResourceDefinition-pagerdutyintegrations.pagerduty.openshift.io.yaml
🚧 Files skipped from review as they are similar to previous changes (6)
- deploy/crds/pagerduty.openshift.io_pagerdutyintegrations.yaml
- controllers/pagerdutyintegration/pagerdutyintegration_controller_test.go
- pkg/utils/utils.go
- controllers/pagerdutyintegration/event_handlers.go
- controllers/pagerdutyintegration/event_handlers_test.go
- go.mod
|
/retest ci/prow/validate 🤖 Claude claude@anthropic.com commenting on behalf of @clcollins |
|
/retest pull-ci-openshift-pagerduty-operator-master-validate 🤖 Claude claude@anthropic.com commenting on behalf of @clcollins |
|
/retest 🤖 Claude claude@anthropic.com commenting on behalf of @clcollins |
Fixture CRD YAML indentation changed due to updated controller-gen in the k8s v0.36 / controller-runtime v0.24 upgrade. Created with assistance from Claude 🤖 <claude@anthropic.com> Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
Fail fast with a clear error if oc or ocm are not installed, rather than producing misleading downstream errors. Created with assistance from Claude 🤖 <claude@anthropic.com> Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
|
@clcollins: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: clcollins, nephomaniac The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
TypedCreateEvent[client.Object],TypedRateLimitingInterface[reconcile.Request])WithRuntimeObjects/[]runtime.ObjecttoWithObjects/[]client.Objectsets.NewString()to genericsets.New[string]()APIscripts/validate-event-handlers.shfor pre/post-upgrade live cluster validationx-kubernetes-list-type: atomicannotationsPR Disposition
Resolves these open dependency PRs (close after merge):
Leave open:
Test plan
go build ./...passes (Go 1.25)go test ./... -count=1— all passgo vet ./...— cleanmake container-lint— 0 issuesmake container-test— all passmake container-coverage— passesmake container-generate— passesscripts/validate-event-handlers.shon integration hive post-rolloutPre/post-upgrade validation with
validate-event-handlers.shRun on each hive before the upgrade rolls out to capture a baseline, then again after to confirm no regressions:
The script validates 7 checks against the live operator pod:
Starting EventSourcelog entriesReconciling PagerDutyIntegrationentryReconcile completeentries with durationMetrics for PD APIentries confirm connectivityOptions:
-t(ticket, required),-v(verbose),-j(JSON output),-n(namespace override, default:pagerduty-operator)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Refactor
Chores
Tests
API