-
Notifications
You must be signed in to change notification settings - Fork 12
feat(cli): update-state + targeted reset --package (closes #257) #258
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
base: main
Are you sure you want to change the base?
Changes from all commits
8a3a1ac
47fb655
7fe97f1
352a2ac
f8028fd
0127a2e
2159bdf
78d67ee
e9fdcd4
c6a22e4
8473f6f
f1efd9c
fb5e862
47b40da
ce2dbc8
5c7f7cb
3b75547
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # 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. | ||
|
|
||
| apiVersion: skyhook.nvidia.com/v1alpha1 | ||
| kind: Skyhook | ||
| metadata: | ||
| name: cli-reset-package-test | ||
| status: | ||
| status: complete |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # 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. | ||
|
|
||
| apiVersion: skyhook.nvidia.com/v1alpha1 | ||
| kind: Skyhook | ||
| metadata: | ||
| name: cli-reset-package-test | ||
| annotations: | ||
| skyhook.nvidia.com/disable: "true" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # 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: cli-reset-package | ||
| labels: | ||
| pool: cli | ||
|
Comment on lines
+22
to
+23
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a mutation-profile pool value, not
As per coding guidelines: In Chainsaw e2e test YAMLs, the 🤖 Prompt for AI Agents |
||
| spec: | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| timeouts: | ||
| assert: 240s | ||
| exec: 90s | ||
| steps: | ||
| # Step 0: Reset state from previous runs | ||
| - name: reset-state | ||
| try: | ||
| - script: | ||
| timeout: 30s | ||
| content: | | ||
| ../skyhook-cli reset cli-reset-package-test --confirm 2>/dev/null || true | ||
| echo "State reset complete" | ||
|
|
||
| # Step 1: Create a two-package Skyhook and wait for both packages to complete | ||
| - name: setup-skyhook | ||
| try: | ||
| - apply: | ||
| file: skyhook.yaml | ||
| - assert: | ||
| file: assert-skyhook-complete.yaml | ||
|
|
||
| # Step 2: Disable the Skyhook so the operator won't immediately re-apply pkg1 | ||
| # after we remove its state. | ||
| - name: disable-skyhook | ||
| try: | ||
| - script: | ||
| timeout: 30s | ||
| content: | | ||
| ../skyhook-cli disable cli-reset-package-test --confirm | ||
| - assert: | ||
| file: assert-skyhook-disabled.yaml | ||
|
|
||
| # Step 3: Selectively reset only pkg1. --skip-batch-reset matches the | ||
| # implementation contract for --package (batch state is not reset for a | ||
| # one-package recovery). | ||
| - name: test-reset-package | ||
| try: | ||
| - script: | ||
| timeout: 30s | ||
| content: | | ||
| ../skyhook-cli reset cli-reset-package-test --package pkg1 --confirm --skip-batch-reset | ||
|
|
||
| # Step 4: Assert the per-node annotation no longer contains pkg1|1.0.0 but | ||
| # still contains pkg2|2.0.0. The nodeState annotation is JSON-as-string, so | ||
| # we use jq rather than a native chainsaw assert. | ||
| - name: assert-only-pkg1-removed | ||
| try: | ||
| - script: | ||
| timeout: 30s | ||
| content: | | ||
| set -eu | ||
| nodes=$(kubectl get nodes -l skyhook.nvidia.com/test-node=skyhooke2e -o jsonpath='{.items[*].metadata.name}') | ||
| if [ -z "$nodes" ]; then | ||
| echo "no test nodes found" | ||
| exit 1 | ||
| fi | ||
| fail=0 | ||
| for node in $nodes; do | ||
| raw=$(kubectl get node "$node" -o jsonpath='{.metadata.annotations.skyhook\.nvidia\.com/nodeState_cli-reset-package-test}') | ||
| if [ -z "$raw" ]; then | ||
| echo "node $node: nodeState annotation missing (expected pkg2 to remain)" | ||
| fail=1 | ||
| continue | ||
| fi | ||
| has_pkg1=$(printf '%s' "$raw" | jq 'has("pkg1|1.0.0")') | ||
| has_pkg2=$(printf '%s' "$raw" | jq 'has("pkg2|2.0.0")') | ||
| if [ "$has_pkg1" != "false" ]; then | ||
| echo "node $node: expected pkg1|1.0.0 to be removed, but it is still present" | ||
| echo "annotation: $raw" | ||
| fail=1 | ||
| continue | ||
| fi | ||
| if [ "$has_pkg2" != "true" ]; then | ||
| echo "node $node: expected pkg2|2.0.0 to remain, but it is missing" | ||
| echo "annotation: $raw" | ||
| fail=1 | ||
| continue | ||
| fi | ||
| echo "node $node: pkg1 removed, pkg2 retained OK" | ||
| done | ||
| exit $fail | ||
Uh oh!
There was an error while loading. Please reload this page.