fix(builder): replace lifecycle handlers instead of merging them - #245
Open
giuliocalzo wants to merge 1 commit into
Open
fix(builder): replace lifecycle handlers instead of merging them#245giuliocalzo wants to merge 1 commit into
giuliocalzo wants to merge 1 commit into
Conversation
giuliocalzo
requested review from
SkylerMalinowski,
alanmutsch,
catblade,
vivian-hafener and
wickberg
as code owners
August 28, 2026 08:11
giuliocalzo
force-pushed
the
gcalzolari/configurable-slurmd-prestop
branch
4 times, most recently
from
September 4, 2026 08:04
210f1be to
ed0b9ec
Compare
A NodeSet can already override the slurmd preStop command, but only while the handler stays an `exec` one. Strategic merge patch combines the handler from `spec.slurmd.lifecycle` with the operator default, so switching the action to `httpGet`, `tcpSocket`, or `sleep` renders a handler holding two actions, which Kubernetes rejects. Let a merged lifecycle handler displace the base handler, the way probe handlers are already treated, and lift the default slurmd preStop out of an inline literal into a named function so what a NodeSet replaces is legible. Signed-off-by: Giulio Calzolari <gcalzolari@nvidia.com> Changelog: Fixed - A non-exec slurmd preStop handler rendered an invalid container.
giuliocalzo
force-pushed
the
gcalzolari/configurable-slurmd-prestop
branch
from
September 4, 2026 15:07
ed0b9ec to
f0d94d0
Compare
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.
Summary
A NodeSet can already override the slurmd
preStopcommand, but only while the handler stays anexecone.BuildContainermerges the handler fromspec.slurmd.lifecycleinto the operator default with a strategic merge patch, so switching the action tohttpGet,tcpSocket, orsleepleaves the defaultexecin place alongside it. A lifecycle handler may specify only one action, so Kubernetes rejects the result.A merged lifecycle handler now displaces the base handler rather than being merged into it, the way
BuildContaineralready treats probe handlers. The default slurmdpreStopalso moves out of an inline literal into a named function, so what a NodeSet replaces is legible at the call site.Both new cases fail against
mainand pass with the fix:TestBuilder_BuildContainer/preStop_httpGet_replaces_execandTestWorkerBuilder_slurmdContainerPreStop/httpGet_handler_replaces_the_default_exec.Checklist
CONTRIBUTING.md
and the
Code of Conduct.
Breaking Changes
None. A NodeSet that does not set
spec.slurmd.lifecyclerenders an identical container.Testing Notes
Deploy a NodeSet whose
preStopuses a different action than the defaultexec:On
mainthe API server rejects the pod, because the rendered handler carries bothhttpGetand the operator'sexec. With this change the pod is admitted and carries only thehttpGethandler:A NodeSet with no
lifecycleshould still show the defaultstate=downhook.Additional Context
Also submitted upstream on GitLab as
slurm-operator!724, where the maintainers do their review; I will close whichever of the two you prefer not to keep.