WIP: OCPBUGS-80958: NodeUID in status to detect replaced node with same name#2821
WIP: OCPBUGS-80958: NodeUID in status to detect replaced node with same name#2821bhperry wants to merge 1 commit intoopenshift:masterfrom
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@bhperry: This pull request references Jira Issue OCPBUGS-80958, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. 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. |
📝 WalkthroughWalkthroughThis change introduces a new 🚥 Pre-merge checks | ✅ 11 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.11.4)Error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
|
Skipping CI for Draft Pull Request. |
|
Hello @bhperry! Some important instructions when contributing to openshift/api: |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/jira refresh |
|
@bhperry: This pull request references Jira Issue OCPBUGS-80958, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
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. |
|
/retest |
|
@bhperry: 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. |
85d77b4 to
07f1fbe
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
operator/v1/types.go (1)
262-264:⚠️ Potential issue | 🟠 MajorValidators on
currentRevisionblock the reset behavior documented fornodeUIDchangesLines 262 and 278 enforce that
currentRevisioncannot be unset once set and must only increase. However, thenodeUIDfield added in lines 270–274 explicitly documents that status should reset when the UID changes (indicating node replacement). These validators prevent that reset, blocking the intended functionality.The validators must be conditioned to allow reset when
nodeUIDchanges:Suggested fix
Modify line 262 to allow unsetting when nodeUID changes:
-// +kubebuilder:validation:XValidation:rule="has(self.currentRevision) || !has(oldSelf.currentRevision)",message="cannot be unset once set",fieldPath=".currentRevision" +// +kubebuilder:validation:XValidation:rule="has(self.currentRevision) || !has(oldSelf.currentRevision) || (has(self.nodeUID) && has(oldSelf.nodeUID) && self.nodeUID != oldSelf.nodeUID)",message="cannot be unset once set unless nodeUID changes",fieldPath=".currentRevision"Modify line 278 to allow decrease when nodeUID changes:
-// +kubebuilder:validation:XValidation:rule="self >= oldSelf",message="must only increase" +// +kubebuilder:validation:XValidation:rule="!has(self.currentRevision) || !has(oldSelf.currentRevision) || self.currentRevision >= oldSelf.currentRevision || (has(self.nodeUID) && has(oldSelf.nodeUID) && self.nodeUID != oldSelf.nodeUID)",message="must only increase unless nodeUID changes",optionalOldSelf=true,fieldPath=".currentRevision"Also applies to: lines 270–275, 278–280
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@operator/v1/types.go` around lines 262 - 264, The XValidation rules on the status fields currentRevision and targetRevision currently forbid unsetting/decreasing but must allow that when the node was replaced (nodeUID changed); update the XValidation expressions on the currentRevision and targetRevision tags to include an OR that permits the change if self.nodeUID != oldSelf.nodeUID (or if oldSelf.nodeUID is missing) so the rule reads roughly "has(self.currentRevision) || !has(oldSelf.currentRevision) || self.nodeUID != oldSelf.nodeUID" (and similarly allow decrease for targetRevision by adding "|| self.nodeUID != oldSelf.nodeUID"); ensure optionalOldSelf=true is present where needed and adjust the two validation annotations referencing currentRevision/targetRevision to include this nodeUID-change exception.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@payload-manifests/crds/0000_25_kube-scheduler_01_kubeschedulers.crd.yaml`:
- Around line 264-269: Summary: The schema claims status should reset when
nodeUID changes, but nodeStatuses is keyed only by nodeName and
revision/validation rules enforce monotonic behavior, blocking resets on node
replacement; update the CRD so UID changes can represent a fresh status. Fix:
modify the manifest so either (A) nodeStatuses map key includes nodeUID (e.g.,
composite key or change to a map keyed by "nodeName+nodeUID") or (B) keep
nodeName key but add nodeUID as a required field inside each nodeStatuses value
and change the revision/validation rules (the fields enforcing
monotonic/non-unset revisions such as the condition revision constraints) to
only apply when the stored nodeUID equals the incoming nodeUID; ensure the
condition revision validations reference nodeUID equality (not just nodeName) or
are scoped to the value object so a UID change bypasses monotonic checks.
Reference symbols: nodeUID, nodeStatuses, and the condition/revision validation
rules that enforce monotonic/non-unset behavior.
---
Outside diff comments:
In `@operator/v1/types.go`:
- Around line 262-264: The XValidation rules on the status fields
currentRevision and targetRevision currently forbid unsetting/decreasing but
must allow that when the node was replaced (nodeUID changed); update the
XValidation expressions on the currentRevision and targetRevision tags to
include an OR that permits the change if self.nodeUID != oldSelf.nodeUID (or if
oldSelf.nodeUID is missing) so the rule reads roughly "has(self.currentRevision)
|| !has(oldSelf.currentRevision) || self.nodeUID != oldSelf.nodeUID" (and
similarly allow decrease for targetRevision by adding "|| self.nodeUID !=
oldSelf.nodeUID"); ensure optionalOldSelf=true is present where needed and
adjust the two validation annotations referencing currentRevision/targetRevision
to include this nodeUID-change exception.
🪄 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: d56018d4-5aa4-4450-9d29-87334e0bb187
⛔ Files ignored due to path filters (17)
openapi/generated_openapi/zz_generated.openapi.gois excluded by!openapi/**,!**/zz_generated*openapi/openapi.jsonis excluded by!openapi/**operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-CustomNoUpgrade.crd.yamlis excluded by!**/zz_generated.crd-manifests/*operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-Default.crd.yamlis excluded by!**/zz_generated.crd-manifests/*operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-DevPreviewNoUpgrade.crd.yamlis excluded by!**/zz_generated.crd-manifests/*operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-OKD.crd.yamlis excluded by!**/zz_generated.crd-manifests/*operator/v1/zz_generated.crd-manifests/0000_12_etcd_01_etcds-TechPreviewNoUpgrade.crd.yamlis excluded by!**/zz_generated.crd-manifests/*operator/v1/zz_generated.crd-manifests/0000_20_kube-apiserver_01_kubeapiservers.crd.yamlis excluded by!**/zz_generated.crd-manifests/*operator/v1/zz_generated.crd-manifests/0000_25_kube-controller-manager_01_kubecontrollermanagers.crd.yamlis excluded by!**/zz_generated.crd-manifests/*operator/v1/zz_generated.crd-manifests/0000_25_kube-scheduler_01_kubeschedulers.crd.yamlis excluded by!**/zz_generated.crd-manifests/*operator/v1/zz_generated.featuregated-crd-manifests/etcds.operator.openshift.io/AAA_ungated.yamlis excluded by!**/zz_generated.featuregated-crd-manifests/**operator/v1/zz_generated.featuregated-crd-manifests/etcds.operator.openshift.io/EtcdBackendQuota.yamlis excluded by!**/zz_generated.featuregated-crd-manifests/**operator/v1/zz_generated.featuregated-crd-manifests/kubeapiservers.operator.openshift.io/AAA_ungated.yamlis excluded by!**/zz_generated.featuregated-crd-manifests/**operator/v1/zz_generated.featuregated-crd-manifests/kubeapiservers.operator.openshift.io/EventTTL.yamlis excluded by!**/zz_generated.featuregated-crd-manifests/**operator/v1/zz_generated.featuregated-crd-manifests/kubecontrollermanagers.operator.openshift.io/AAA_ungated.yamlis excluded by!**/zz_generated.featuregated-crd-manifests/**operator/v1/zz_generated.featuregated-crd-manifests/kubeschedulers.operator.openshift.io/AAA_ungated.yamlis excluded by!**/zz_generated.featuregated-crd-manifests/**operator/v1/zz_generated.swagger_doc_generated.gois excluded by!**/zz_generated*
📒 Files selected for processing (9)
operator/v1/types.gopayload-manifests/crds/0000_12_etcd_01_etcds-CustomNoUpgrade.crd.yamlpayload-manifests/crds/0000_12_etcd_01_etcds-Default.crd.yamlpayload-manifests/crds/0000_12_etcd_01_etcds-DevPreviewNoUpgrade.crd.yamlpayload-manifests/crds/0000_12_etcd_01_etcds-OKD.crd.yamlpayload-manifests/crds/0000_12_etcd_01_etcds-TechPreviewNoUpgrade.crd.yamlpayload-manifests/crds/0000_20_kube-apiserver_01_kubeapiservers.crd.yamlpayload-manifests/crds/0000_25_kube-controller-manager_01_kubecontrollermanagers.crd.yamlpayload-manifests/crds/0000_25_kube-scheduler_01_kubeschedulers.crd.yaml
No description provided.