-
Notifications
You must be signed in to change notification settings - Fork 72
fix(nvca-operator): preserve self-managed defaults #1879
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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 |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| chart_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
| chart="${chart_root}/nvca-operator" | ||
| work_dir="$(mktemp -d)" | ||
| trap 'rm -rf "${work_dir}"' EXIT | ||
|
|
||
| fail() { | ||
| echo "default-ownership: $*" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| for schema in \ | ||
| "${chart}/values.schema.json" \ | ||
| "${chart_root}/../../../src/compute-plane-services/nvca/deployments/nvca-operator/values.schema.json"; do | ||
| test "$(yq -r '.properties.selfManaged.properties.region.default' "${schema}")" = "us-west-1" || | ||
| fail "${schema} does not declare the selfManaged.region default" | ||
| test "$(yq -r '.properties.helmManaged.properties | has("region")' "${schema}")" = "false" || | ||
| fail "${schema} incorrectly declares region under helmManaged" | ||
| done | ||
|
|
||
| render() { | ||
| local manifest="$1" | ||
| shift | ||
| helm template nvca-operator "${chart}" \ | ||
| --namespace nvca-operator \ | ||
| --values "${chart}/values.yaml" \ | ||
| --set-string ngcConfig.clusterSource=self-managed \ | ||
| --set-string selfManaged.icmsServiceURL=http://icms.example.invalid:8080 \ | ||
| --set-string selfManaged.revalServiceURL=http://reval.example.invalid:8080 \ | ||
| --set-string selfManaged.natsURL=nats://nats.example.invalid:4222 \ | ||
| "$@" >"${manifest}" | ||
| } | ||
|
|
||
| agent_config() { | ||
| yq ea -r \ | ||
| 'select(.kind == "ConfigMap" and .metadata.name == "agent-config-merge") | .data."config.yaml"' \ | ||
| "$1" | ||
| } | ||
|
|
||
| backend_config() { | ||
| yq ea -r \ | ||
| 'select(.kind == "ConfigMap" and .metadata.name == "nvcfbackend-self-managed") | .data."cluster-dto.yaml"' \ | ||
| "$1" | ||
| } | ||
|
|
||
| default_manifest="${work_dir}/default.yaml" | ||
| render "${default_manifest}" | ||
| default_config="$(agent_config "${default_manifest}")" | ||
| default_policy="$(printf '%s' "${default_config}" | yq -r '.cluster.validationPolicy.name')" | ||
| test "${default_policy}" = "Unrestricted" || | ||
| fail "chart default validation policy is ${default_policy:-missing}, expected Unrestricted" | ||
| default_quic_present="$(printf '%s' "${default_config}" | yq -r '(.workload // {}) | has("stargateQUICInsecure")')" | ||
| test "${default_quic_present}" = "false" || | ||
| fail "chart serializes the runtime-default stargateQUICInsecure value" | ||
| default_region="$(backend_config "${default_manifest}" | yq -r '.region')" | ||
| test "${default_region}" = "us-west-1" || | ||
| fail "chart default self-managed region is ${default_region:-missing}, expected us-west-1" | ||
|
|
||
| override_values="${work_dir}/override.yaml" | ||
| printf '%s\n' \ | ||
| 'agentConfig:' \ | ||
| ' mergeConfig: |' \ | ||
| ' cluster:' \ | ||
| ' validationPolicy:' \ | ||
| ' name: Default' \ | ||
| ' workload:' \ | ||
| ' stargateQUICInsecure: true' \ | ||
| 'selfManaged:' \ | ||
| ' region: explicit-region' >"${override_values}" | ||
|
|
||
| override_manifest="${work_dir}/override.yaml.rendered" | ||
| render "${override_manifest}" --values "${override_values}" | ||
| override_config="$(agent_config "${override_manifest}")" | ||
| override_policy="$(printf '%s' "${override_config}" | yq -r '.cluster.validationPolicy.name')" | ||
| test "${override_policy}" = "Default" || | ||
| fail "explicit validation policy override was not preserved" | ||
| override_quic="$(printf '%s' "${override_config}" | yq -r '.workload.stargateQUICInsecure')" | ||
| test "${override_quic}" = "true" || | ||
| fail "explicit stargateQUICInsecure override was not preserved" | ||
| override_region="$(backend_config "${override_manifest}" | yq -r '.region')" | ||
| test "${override_region}" = "explicit-region" || | ||
| fail "explicit selfManaged.region override was not preserved" | ||
|
|
||
| echo "default-ownership: all checks passed" |
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
4 changes: 1 addition & 3 deletions
4
deploy/stacks/nvcf-compute-plane/testdata/golden/local/ncp-local-register-values.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 |
|---|---|---|
| @@ -1,10 +1,8 @@ | ||
| clusterName: my-local-cluster | ||
| clusterID: de5f65fe-08d7-47e7-bf30-860e2fe88c57 | ||
| clusterGroupID: e1c9fcdd-5551-4824-816f-87a044a5dd33 | ||
| ncaID: nvcf-default | ||
| region: us-east-1 | ||
| selfManaged: | ||
| identitySource: psat | ||
| region: us-east-1 | ||
| icmsServiceURL: http://icms.example.invalid:8080 | ||
| revalServiceURL: http://reval.example.invalid:8080 | ||
| natsURL: nats://nats.example.invalid:4222 |
4 changes: 1 addition & 3 deletions
4
deploy/stacks/nvcf-compute-plane/testdata/registration/ncp-local-register-values.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 |
|---|---|---|
| @@ -1,10 +1,8 @@ | ||
| clusterName: my-local-cluster | ||
| clusterID: de5f65fe-08d7-47e7-bf30-860e2fe88c57 | ||
| clusterGroupID: e1c9fcdd-5551-4824-816f-87a044a5dd33 | ||
| ncaID: nvcf-default | ||
| region: us-east-1 | ||
| selfManaged: | ||
| identitySource: psat | ||
| region: us-east-1 | ||
| icmsServiceURL: http://icms.example.invalid:8080 | ||
| revalServiceURL: http://reval.example.invalid:8080 | ||
| natsURL: nats://nats.example.invalid:4222 |
85 changes: 85 additions & 0 deletions
85
deploy/stacks/nvcf-compute-plane/tests/nvca-default-ownership.sh
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,85 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| stack_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
| work_dir="$(mktemp -d)" | ||
| cluster_name="default-ownership" | ||
| registration_values="${work_dir}/${cluster_name}-register-values.yaml" | ||
| trap 'rm -rf "${work_dir}"' EXIT | ||
|
|
||
| fail() { | ||
| echo "nvca-default-ownership: $*" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| render_values() { | ||
| local output_file="$1" | ||
| shift | ||
| HELMFILE_ENV=base \ | ||
| CLUSTER_NAME="${cluster_name}" \ | ||
| NCA_ID=authoritative-nca \ | ||
| OUTPUT_DIR="${work_dir}" \ | ||
| helmfile \ | ||
| --file "${stack_dir}/helmfile.d/02-nvca.yaml.gotmpl" \ | ||
| --environment default \ | ||
| "$@" \ | ||
| --selector name=nvca-operator \ | ||
| write-values \ | ||
| --output-file-template "${output_file}" >/dev/null | ||
| } | ||
|
|
||
| write_registration() { | ||
| local merge_config="${1:-}" | ||
| printf '%s\n' \ | ||
| 'clusterName: default-ownership' \ | ||
| 'clusterID: fixture-cluster-id' \ | ||
| 'clusterGroupID: fixture-cluster-group-id' \ | ||
| 'selfManaged:' \ | ||
| ' region: fixture-region' \ | ||
| ' icmsServiceURL: http://icms.example.invalid:8080' \ | ||
| ' revalServiceURL: http://reval.example.invalid:8080' \ | ||
| ' natsURL: nats://nats.example.invalid:4222' >"${registration_values}" | ||
| if [[ -n "${merge_config}" ]]; then | ||
| printf 'agentConfig:\n mergeConfig: |\n%s\n' "${merge_config}" >>"${registration_values}" | ||
| fi | ||
| } | ||
|
|
||
| write_registration | ||
| default_values="${work_dir}/default-values.yaml" | ||
| render_values "${default_values}" | ||
| test "$(yq -r '.ncaID' "${default_values}")" = "authoritative-nca" || | ||
| fail "NCA_ID was not forwarded with the chart-consumed ncaID spelling" | ||
| test "$(yq -r '.ncaId // "omitted"' "${default_values}")" = "omitted" || | ||
| fail "stack emitted the unused ncaId spelling" | ||
| test "$(yq -r '.selfManaged.region' "${default_values}")" = "fixture-region" || | ||
| fail "selfManaged.region was not preserved" | ||
| test "$(yq -r '.selfManaged.identitySource // "omitted"' "${default_values}")" = "omitted" || | ||
| fail "render-only registration values contain CLI lifecycle metadata" | ||
| test "$(yq -r '.agentConfig // "omitted"' "${default_values}")" = "omitted" || | ||
| fail "stack shadowed the chart agentConfig defaults without an explicit merge" | ||
| test "$(yq -r '.nodeSelector // "omitted"' "${default_values}")" = "omitted" || | ||
| fail "stack emitted a node selector while the singular global default is disabled" | ||
|
|
||
| write_registration ' workload: | ||
| defaultOwnershipProbe: true' | ||
| extended_values="${work_dir}/extended-values.yaml" | ||
| render_values "${extended_values}" --state-values-set addons.kaiScheduler.enabled=true | ||
| extended_config="$(yq -r '.agentConfig.mergeConfig' "${extended_values}")" | ||
| test "$(printf '%s' "${extended_config}" | yq -r '.cluster.validationPolicy.name')" = "Unrestricted" || | ||
| fail "stack extension did not preserve the chart validation policy default" | ||
| test "$(printf '%s' "${extended_config}" | yq -r '.workload.defaultOwnershipProbe')" = "true" || | ||
| fail "stack extension dropped the explicit mergeConfig override" | ||
|
|
||
| write_registration ' cluster: | ||
| validationPolicy: | ||
| name: Default' | ||
| override_values="${work_dir}/override-values.yaml" | ||
| render_values "${override_values}" --state-values-set addons.kaiScheduler.enabled=true | ||
| override_config="$(yq -r '.agentConfig.mergeConfig' "${override_values}")" | ||
| test "$(printf '%s' "${override_config}" | yq -r '.cluster.validationPolicy.name')" = "Default" || | ||
| fail "stack replaced an explicit validation policy override" | ||
|
|
||
| echo "nvca-default-ownership: all checks passed" |
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 |
|---|---|---|
|
|
@@ -207,14 +207,17 @@ identity and endpoints: | |
| clusterID: <uuid> | ||
| clusterGroupID: <uuid> | ||
| ncaID: <nca-id> | ||
| region: <region> | ||
| selfManaged: | ||
| region: <region> | ||
|
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. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Run the required documentation check before completion. The repository guidelines require 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| identitySource: psat | ||
| icmsServiceURL: "http://<GATEWAY_ADDR>" | ||
| revalServiceURL: "http://<GATEWAY_ADDR>" | ||
| natsURL: "nats://<GATEWAY_ADDR>:4222" | ||
| ``` | ||
|
|
||
| `selfManaged.identitySource` is retained for CLI teardown and is not consumed | ||
| by the NVCA Operator chart. | ||
|
|
||
| The `template`, `install`, and `apply` targets copy this file into `out/` before | ||
| running Helmfile. | ||
|
|
||
|
|
||
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.