feat: add default linux nodeSelector to listener pod#4377
Open
gateixeira wants to merge 1 commit intoactions:masterfrom
Open
feat: add default linux nodeSelector to listener pod#4377gateixeira wants to merge 1 commit intoactions:masterfrom
gateixeira wants to merge 1 commit intoactions:masterfrom
Conversation
The listener is a Linux-only binary. In mixed-OS clusters (e.g. with Windows node pools), the listener pod can be scheduled on a Windows node where it fails with a platform mismatch. Issue actions#2652 was closed by actions#2758 which gave users a workaround via listenerTemplate, but the default behavior still allows the listener to be scheduled on Windows nodes. This PR adds a safe default (kubernetes.io/os: linux) so users don't need to explicitly configure listenerTemplate just to prevent the listener from landing on a non-Linux node. Changes: - Add default nodeSelector kubernetes.io/os: linux to listener pod spec - Define LabelKeyKubernetesOS constant alongside existing k8s labels - Make mergeListenerPodWithTemplate preserve the default when the listenerTemplate does not explicitly set a nodeSelector (nil check) - Add unit tests for all nodeSelector merge scenarios Refs: actions#2652
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a defensive default to ensure the scale set listener pod (a Linux-only binary) is scheduled onto Linux nodes in mixed-OS Kubernetes clusters, without requiring users to set a custom listenerTemplate.
Changes:
- Default the listener pod
spec.nodeSelectortokubernetes.io/os: linux. - Add a
LabelKeyKubernetesOSconstant for the well-known Kubernetes OS label. - Update listener template merging logic to preserve the default nodeSelector unless the template explicitly sets one, with unit tests covering the merge scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| controllers/actions.github.com/resourcebuilder.go | Sets a default Linux NodeSelector on the listener pod and updates template merge behavior to avoid clearing the default when the template nodeSelector is nil. |
| controllers/actions.github.com/constants.go | Introduces LabelKeyKubernetesOS constant (kubernetes.io/os). |
| controllers/actions.github.com/resourcebuilder_test.go | Adds unit tests validating default nodeSelector behavior and template merge override/preserve scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The listener is a Linux-only binary. In mixed-OS clusters (e.g. with Windows node pools), the listener pod can be scheduled on a Windows node where it fails with a platform mismatch.
Issue #2652 was closed by #2758 which gave users a workaround via listenerTemplate, but the default behavior still allows the listener to be scheduled on Windows nodes. This PR adds a safe default (kubernetes.io/os: linux) as a defensive approach so users don't need to explicitly configure listenerTemplate just to prevent the listener from landing on a non-Linux node.
Changes:
Refs: #2652