mirror of
https://github.com/dsx-ai-factory/nvke.git
synced 2026-12-07 04:35:58 +08:00
* feat(deploy)!: move the greenfield overlays and the release namespace to nvke-controller This moves them, and with them the persisted identifiers a site carries: the Helm release and its namespace, the database, and the Temporal namespace and task queue. In the three greenfield stacks: nameOverride, fullnameOverride, namespaceOverride, serviceAccount.name, serviceMonitor.name, appDb.dbName, the Temporal namespace and queue, the field managers and the managed-by values, tracing.serviceName, and the objects the stacks render around them -- the Namespace manifest, the Postgres CREATE DATABASE, the SPIRE admin ID and ClusterSPIFFEID namespace selectors, the auth-dev ConfigMap's namespace, the CAPD RBAC ClusterRole and its subject, and the spire-client probe URL. Consumers that move with it: controller/Tiltfile (release name, namespace, SPIRE admin path and the string-matched resource names), deploy/check-site.sh, the e2e site helpers and their collect script, cli/internal/bootstrap/controllerdeploy (including the NodePort Service nvke-controller-external), cli/internal/deploypath's admin path, management-engine/hack/nvke-controller.sh, and the CI lane scripts. The discovery paths search the new name first and keep the old one: nvkectl's authConfigNamespaces, nvke-token.sh, nvke-auth-demo.sh and dev-env-spire.sh now try nvke-controller, then nke-controller, then cloud-workflow-engine. The reference health dashboard matches all three workload names, and Tilt's preflight refuses to take over a cluster that still runs the nke-controller release rather than failing later. The published image keeps its name per #1554 decision 2, as do the nke-controller-config ConfigMap and the nke-controller-chart release artifact; hack/name-check-allowlist.txt now carries one entry per reason rather than one blanket token. Refs #1861, #1554, #1496, #1818 Signed-off-by: Terry Howe <thowe@nvidia.com> * fix: address review feedback Name nke-controller as the intermediate namespace in the authentication docs, matching authConfigNamespaces, and restore the legacy node-agent audience in the exchange mock's test. Signed-off-by: Terry Howe <thowe@nvidia.com> * fix: address review feedback Signed-off-by: Terry Howe <thowe@nvidia.com> * fix(e2e): point the nico bootstrap lane at the nvke-controller namespace The nico lane still asserted the tenant credentials Secret landed in nke-controller, so both e2e (nico) jobs failed after the rename. Signed-off-by: Terry Howe <thowe@nvidia.com> * fix(deploy): carry the nvke-controller rename into the rebased files The rebase onto main replayed the rename over two files that gained nke-controller references after the branch was cut: the management-engine dev overlay, which succeeds the hack script this branch had edited and was removed in #1918, and an API-authentication example added in #1935. Refs #1861 Signed-off-by: Terry Howe <thowe@nvidia.com> * fix: address review feedback Continue namespace discovery past a Forbidden lookup in nvke-token.sh and nvke-auth-demo.sh. --ignore-not-found suppresses absence, not denial, so a kubeconfig scoped to nke-controller alone died on the nvke-controller probe before reaching the namespace it can read -- the migration case this branch adds. Keep the first denial, try the remaining candidates, and fail with it only when none was readable, since falling back to cloud-workflow-engine needs a confirmed absence. Refs #1861 Signed-off-by: Terry Howe <thowe@nvidia.com> --------- Signed-off-by: Terry Howe <thowe@nvidia.com>
88 lines
4.0 KiB
Bash
Executable File
88 lines
4.0 KiB
Bash
Executable File
#!/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="${CHART:-"$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/deploy/charts/controller"}"
|
|
failures=0
|
|
|
|
want() {
|
|
if grep -qE "$2" <<<"$3"; then
|
|
printf ' ok %s\n' "$1"
|
|
else
|
|
printf ' FAIL %s (expected %s)\n' "$1" "$2" >&2
|
|
failures=$((failures + 1))
|
|
fi
|
|
}
|
|
|
|
absent() {
|
|
if grep -qE "$2" <<<"$3"; then
|
|
printf ' FAIL %s (unexpected %s)\n' "$1" "$2" >&2
|
|
failures=$((failures + 1))
|
|
else
|
|
printf ' ok %s\n' "$1"
|
|
fi
|
|
}
|
|
|
|
# setting <description> <config.yaml key> <value> <rendered>
|
|
# Asserts one key of the rendered nvke-controller-config, where the controller
|
|
# reads its settings. A list compares as its items joined with commas.
|
|
setting() {
|
|
local got
|
|
got="$(yq 'select(.kind == "ConfigMap" and .metadata.name == "nvke-controller-config") | .data["config.yaml"]' <<<"$4" |
|
|
yq ".$2 | (select(tag == \"!!seq\") | join(\",\")) // .")"
|
|
if [[ "${got}" == "$3" ]]; then
|
|
printf ' ok %s\n' "$1"
|
|
else
|
|
printf ' FAIL %s (expected %s = %s, got %s)\n' "$1" "$2" "$3" "${got}" >&2
|
|
failures=$((failures + 1))
|
|
fi
|
|
}
|
|
|
|
echo "node-agent TLS/JWT disabled:"
|
|
out="$(helm template cwe "${CHART}")"
|
|
setting "capability is explicitly false" nodeAgent.tlsJWT.enabled false "${out}"
|
|
absent "no client identity mount" 'name: node-agent-client-tls' "${out}"
|
|
setting "no JWT issuer configuration" nodeAgent.tlsJWT.issuer "" "${out}"
|
|
setting "no JWT key-source configuration" nodeAgent.tlsJWT.jwksURI "" "${out}"
|
|
|
|
echo "node-agent TLS/JWT enabled:"
|
|
tls_jwt_values=(
|
|
--set spiffe.enabled=true
|
|
--set nodeAgent.tlsJwt.enabled=true
|
|
--set nodeAgent.tlsJwt.issuer=https://identity.example.test
|
|
--set nodeAgent.tlsJwt.jwksURI=https://identity.example.test/.well-known/jwks.json
|
|
--set 'nodeAgent.tlsJwt.algorithms={RS256,ES256}'
|
|
--set nodeAgent.tlsJwt.subjectTrustDomain=identity.example.test
|
|
--set nodeAgent.tlsJwt.subjectTenant=tenant-a
|
|
--set nodeAgent.tlsJwt.subjectService=node-agent
|
|
--set nodeAgent.tlsJwt.dsxIdentityExchangeURL=https://identity.example.test/exchange
|
|
)
|
|
out="$(helm template cwe "${CHART}" "${tls_jwt_values[@]}")"
|
|
setting "capability is true" nodeAgent.tlsJWT.enabled true "${out}"
|
|
absent "no token configuration ConfigMap" 'name: nke-node-agent-auth' "${out}"
|
|
absent "no client identity Secret" 'secretName: nvke-controller-agent-client-tls' "${out}"
|
|
absent "no client identity mount" 'name: node-agent-client-tls' "${out}"
|
|
setting "JWT issuer comes from controller config" nodeAgent.tlsJWT.issuer https://identity.example.test "${out}"
|
|
setting "JWT key source comes from controller config" nodeAgent.tlsJWT.jwksURI https://identity.example.test/.well-known/jwks.json "${out}"
|
|
setting "JWT algorithms come from controller config" nodeAgent.tlsJWT.algorithms RS256,ES256 "${out}"
|
|
setting "JWT subject trust domain comes from controller config" nodeAgent.tlsJWT.subjectTrustDomain identity.example.test "${out}"
|
|
setting "JWT subject tenant comes from controller config" nodeAgent.tlsJWT.subjectTenant tenant-a "${out}"
|
|
setting "JWT subject service comes from controller config" nodeAgent.tlsJWT.subjectService node-agent "${out}"
|
|
setting "identity exchange URL comes from controller config" nodeAgent.tlsJWT.dsxIdentityExchangeURL https://identity.example.test/exchange "${out}"
|
|
if whitespace_out="$(helm template cwe "${CHART}" "${tls_jwt_values[@]}" \
|
|
--set-string nodeAgent.tlsJwt.dsxIdentityExchangeURL=' ' 2>&1)"; then
|
|
printf ' FAIL whitespace-only identity exchange URL was accepted\n' >&2
|
|
failures=$((failures + 1))
|
|
else
|
|
want "whitespace-only identity exchange URL is rejected" 'nodeAgent.tlsJwt.dsxIdentityExchangeURL is required' "${whitespace_out}"
|
|
fi
|
|
absent "no certificate Secret reload" 'secret.reloader.stakater.com/reload: "nvke-controller-agent-client-tls"' "${out}"
|
|
absent "no certificate mount" 'mountPath: /etc/nvke/node-agent-client-tls' "${out}"
|
|
|
|
if ((failures > 0)); then
|
|
printf '%d node-agent TLS/JWT chart assertion(s) failed\n' "${failures}" >&2
|
|
exit 1
|
|
fi
|