Fix NodeSelector nil-vs-pointer reconcile loop in all service reconcilers#1907
Fix NodeSelector nil-vs-pointer reconcile loop in all service reconcilers#1907lmiccini wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lmiccini 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 |
OpenStackControlPlane CRD Size Report
Threshold reference
|
|
Build failed (check pipeline). Post ❌ openstack-k8s-operators-content-provider NODE_FAILURE Node(set) request 100-0000083077 failed in 0s |
|
recheck |
…lers When the OSCP has no nodeSelector defined, instance.Spec.NodeSelector is a nil map. Taking its address (&instance.Spec.NodeSelector) creates a non-nil pointer to a nil map, which is structurally different from a nil pointer. controllerutil.CreateOrPatch detects this as a diff via reflect.DeepEqual and sends an update patch on every reconcile, bumping the sub-CR's Generation. The ObservedGeneration readiness check then reports the sub-CR as "in progress", triggering another OSCP reconcile and creating an infinite loop (~1 update/second). Guard all 25 NodeSelector inheritance assignments with len(instance.Spec.NodeSelector) > 0 so the assignment is skipped when the OSCP nodeSelector is nil or empty, avoiding the spurious diff. Two new functional tests verify the fix: - "does not set nodeSelector on sub-CRs": NodeSelector stays nil on Memcached, Galera, and RabbitMQ when the OSCP omits nodeSelector. - "does not cause spurious updates": sub-CR generation remains stable over 5 seconds (Consistently), catching the ~1/second spec mutation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3cf0bfe to
7f2da76
Compare
|
Build failed (check pipeline). Post ❌ openstack-k8s-operators-content-provider RETRY_LIMIT Host unreachable in 5m 46s |
|
recheck |
|
@lmiccini: The following test 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. |
When the OSCP has no nodeSelector defined, instance.Spec.NodeSelector is a nil map. Taking its address (&instance.Spec.NodeSelector) creates a non-nil pointer to a nil map, which is structurally different from a nil pointer. controllerutil.CreateOrPatch detects this as a diff via reflect.DeepEqual and sends an update patch on every reconcile, bumping the sub-CR's Generation. The ObservedGeneration readiness check then reports the sub-CR as "in progress", triggering another OSCP reconcile and creating an infinite loop (~1 update/second).
Guard all 25 NodeSelector inheritance assignments with len(instance.Spec.NodeSelector) > 0 so the assignment is skipped when the OSCP nodeSelector is nil or empty, avoiding the spurious diff.