-
Notifications
You must be signed in to change notification settings - Fork 15
feat(operator): make node drain behavior configurable #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AnouarMohamed
wants to merge
9
commits into
NVIDIA:main
Choose a base branch
from
AnouarMohamed:fix/issue-259-drain-config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
33874d1
feat(operator): add configurable drain behavior
AnouarMohamed 8a174cc
fix(operator): address drain config review feedback
AnouarMohamed e5ad3d5
fix(operator): address drain config review feedback
AnouarMohamed 4333f01
merge: update branch with upstream main
AnouarMohamed 2671b54
fix(operator): always emit drain timeout event
AnouarMohamed 2fec764
merge: update drain config branch with upstream main
AnouarMohamed 7881ecf
Merge branch 'main' into fix/issue-259-drain-config
AnouarMohamed 529dde1
Merge remote-tracking branch 'upstream/main' into fix/issue-259-drain…
AnouarMohamed d16669f
Merge branch 'main' into fix/issue-259-drain-config
lockwobr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,4 +111,3 @@ | |
| "modes" | ||
| ] | ||
| } | ||
|
|
||
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
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
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
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
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
138 changes: 138 additions & 0 deletions
138
k8s-tests/chainsaw/skyhook/drain-config/chainsaw-test.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json | ||
| apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
| kind: Test | ||
| metadata: | ||
| name: drain-config | ||
| labels: | ||
| pool: interrupt | ||
| spec: | ||
| timeouts: | ||
| assert: 240s | ||
| exec: 90s | ||
| catch: | ||
| - get: | ||
| apiVersion: v1 | ||
| kind: Node | ||
| selector: skyhook.nvidia.com/test-node=skyhooke2e | ||
| format: yaml | ||
| - get: | ||
| apiVersion: skyhook.nvidia.com/v1alpha1 | ||
| kind: Skyhook | ||
| name: drain-config-disable-eviction | ||
| namespace: skyhook | ||
| format: yaml | ||
| - get: | ||
| apiVersion: skyhook.nvidia.com/v1alpha1 | ||
| kind: Skyhook | ||
| name: drain-config-timeout | ||
| namespace: skyhook | ||
| format: yaml | ||
| - get: | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| namespace: skyhook | ||
| selector: app in (drain-config-pdb,drain-config-blocker) | ||
| format: yaml | ||
| steps: | ||
| - name: disable-eviction-bypasses-pdb | ||
| description: Verify disableEviction deletes through a zero-disruption PDB and lets the interrupt complete | ||
| try: | ||
| - script: | ||
| content: | | ||
| ../skyhook-cli reset drain-config-disable-eviction --confirm 2>/dev/null || true | ||
| kubectl -n skyhook delete skyhook drain-config-disable-eviction --ignore-not-found --wait=false | ||
| kubectl -n skyhook delete deployment drain-config-pdb --ignore-not-found --wait=false | ||
| kubectl -n skyhook delete pdb drain-config-pdb --ignore-not-found | ||
| kubectl -n skyhook delete configmap drain-config-original-pod --ignore-not-found | ||
| kubectl -n skyhook delete pod -l app=drain-config-pdb --ignore-not-found --wait=false | ||
| - apply: | ||
| file: disable-eviction.yaml | ||
| - script: | ||
| content: | | ||
| kubectl -n skyhook rollout status deployment/drain-config-pdb --timeout=60s | ||
| pod="$(kubectl -n skyhook get pod -l app=drain-config-pdb -o jsonpath='{.items[0].metadata.name}')" | ||
| kubectl -n skyhook wait --for=condition=Ready "pod/${pod}" --timeout=30s | ||
| kubectl -n skyhook create configmap drain-config-original-pod --from-literal=name="${pod}" --dry-run=client -o yaml | kubectl apply -f - | ||
| kubectl -n skyhook wait --for=jsonpath='{.status.disruptionsAllowed}'=0 pdb/drain-config-pdb --timeout=60s | ||
| - apply: | ||
| file: disable-eviction-skyhook.yaml | ||
| - script: | ||
| content: | | ||
| kubectl -n skyhook wait --for=condition=Ready skyhook/drain-config-disable-eviction --timeout=180s | ||
| - script: | ||
| content: | | ||
| pod="$(kubectl -n skyhook get configmap drain-config-original-pod -o jsonpath='{.data.name}')" | ||
| if kubectl -n skyhook get pod "${pod}" >/dev/null 2>&1; then | ||
| echo "expected original PDB-protected pod ${pod} to be deleted directly" | ||
| exit 1 | ||
| fi | ||
| finally: | ||
| - script: | ||
| content: | | ||
| ../skyhook-cli reset drain-config-disable-eviction --confirm 2>/dev/null || true | ||
| kubectl -n skyhook delete skyhook drain-config-disable-eviction --ignore-not-found --wait=false | ||
| kubectl -n skyhook delete deployment drain-config-pdb --ignore-not-found --wait=false | ||
| kubectl -n skyhook delete pdb drain-config-pdb --ignore-not-found | ||
| kubectl -n skyhook delete configmap drain-config-original-pod --ignore-not-found | ||
| kubectl -n skyhook delete pod -l app=drain-config-pdb --ignore-not-found --wait=false | ||
| kubectl get nodes -l skyhook.nvidia.com/test-node=skyhooke2e -o name | while read -r node; do kubectl uncordon "${node}" || true; done | ||
| - name: timeout-surfaces-erroring | ||
| description: Verify timeout marks the node erroring and emits a drain event when drain cannot proceed | ||
| try: | ||
| - script: | ||
| content: | | ||
| ../skyhook-cli reset drain-config-timeout --confirm 2>/dev/null || true | ||
| kubectl -n skyhook delete skyhook drain-config-timeout --ignore-not-found --wait=false | ||
| kubectl -n skyhook delete pod drain-config-blocker --ignore-not-found --wait=false | ||
| - apply: | ||
| file: timeout.yaml | ||
| - wait: | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| name: drain-config-blocker | ||
| namespace: skyhook | ||
| timeout: 30s | ||
| for: | ||
| condition: | ||
| name: Ready | ||
| value: 'true' | ||
| - script: | ||
| content: | | ||
| kubectl -n skyhook wait --for=jsonpath='{.status.status}'=erroring skyhook/drain-config-timeout --timeout=180s | ||
| - assert: | ||
| file: timeout-assert.yaml | ||
| - script: | ||
| content: | | ||
| for _ in $(seq 1 30); do | ||
| events="$(kubectl get events -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"\t"}{.reason}{"\t"}{.action}{"\t"}{.involvedObject.kind}{"\t"}{.involvedObject.name}{"\t"}{.regarding.kind}{"\t"}{.regarding.name}{"\t"}{.message}{"\t"}{.note}{"\n"}{end}' 2>/dev/null || true)" | ||
| if printf "%s\n" "${events}" | grep -F "Drain" | grep -F "drain-config-timeout" | grep -F "drain timed out"; then | ||
| exit 0 | ||
| fi | ||
| sleep 2 | ||
| done | ||
| printf "%s\n" "${events}" | ||
| echo "expected drain timeout event for drain-config-timeout" | ||
| exit 1 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| finally: | ||
| - script: | ||
| content: | | ||
| ../skyhook-cli reset drain-config-timeout --confirm 2>/dev/null || true | ||
| kubectl -n skyhook delete skyhook drain-config-timeout --ignore-not-found --wait=false | ||
| kubectl -n skyhook delete pod drain-config-blocker --ignore-not-found --wait=false | ||
| kubectl get nodes -l skyhook.nvidia.com/test-node=skyhooke2e -o name | while read -r node; do kubectl uncordon "${node}" || true; done | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.