AGENT-1517: refactored the logic to filter IRI related MachineConfigs#31179
AGENT-1517: refactored the logic to filter IRI related MachineConfigs#31179andfasano wants to merge 1 commit into
Conversation
Also, removed duplications and simplified a little bit the helper code
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
@andfasano: This pull request references AGENT-1517 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. DetailsIn response to this:
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. |
WalkthroughThe ChangesHelper and Test Refactoring for Name-Suffix–Based MachineConfig Discovery
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 11 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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 `@test/extended/internalreleaseimage/helper.go`:
- Around line 66-69: The code currently selects MachineConfigs by name suffix
only (mc.Name HasSuffix "-internalreleaseimage") which can match unrelated
resources; instead, require an ownership signal: when iterating mcList.Items,
add a check that the MachineConfig is owned/managed by the IRI controller (e.g.
inspect mc.OwnerReferences and require an OwnerReference with Controller==true
and the expected Kind/APIVersion or a specific IRI management label), and only
append mc.DeepCopy() to iriMCs if both the name suffix AND the ownership/label
check pass (or alternatively drop the suffix and rely solely on the
owner/label). Update the selection logic around iriMCs, mcList, and
mc.DeepCopy() accordingly.
In `@test/extended/internalreleaseimage/internalreleaseimage.go`:
- Around line 102-105: The test currently requires both mc.UID != oldMC.UID and
mc.CreationTimestamp.After(oldMC.CreationTimestamp.Time) to consider a
MachineConfig recreated, which can fail due to clock/timestamp semantics; change
the check to rely solely on UID (mc.UID != oldMC.UID) when deciding to delete
from oldMCs and log verification (references: mc, oldMC, oldMCs,
CreationTimestamp.After); remove the CreationTimestamp.After(...) condition so
UID alone determines recreation and the subsequent delete/log path runs.
🪄 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: c3ee8632-bddf-461d-85b0-a58c7201751b
📒 Files selected for processing (2)
test/extended/internalreleaseimage/helper.gotest/extended/internalreleaseimage/internalreleaseimage.go
|
Scheduling required tests: |
|
@andfasano: The following tests failed, say
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: andfasano, pawanpinjarkar 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 |
This patch modifies the current ownership logic to reflect the changes introduced in openshift/machine-config-operator#6041.
Also, the helper class has been simplified and some duplication removed.
Summary by CodeRabbit