mirror of
https://github.com/dsx-ai-factory/nvke.git
synced 2026-12-07 04:35:58 +08:00
* feat(e2e): validation profile and label exclusions for the validation image Sites whose layout differs from deploy/nico can now configure the validation image without their layout living in this repo. - NVKE_VALIDATE_PROFILE names a YAML file keyed by the existing environment variable names. It fills only unset or blank variables before the suite is built; the environment wins over the profile, and the profile over the built-in defaults. Keys outside an allowlist, including the run switches and per-tenant identity, fail the run. - NVKE_VALIDATE_EXCLUDE_LABELS ANDs label exclusions onto the label filter. It refuses site-validate and tenant-validate, and fails a run left with no specs. - Check 31 gains the issues-certificate label so sites whose approver policy blocks self-signed issuers can leave it out. - siteNamespaces and siteLaneChecks become functions so they see profile-set values. - The image workflow dry-runs the entrypoint with a good and a bad profile. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): tighten validation profile and exclusions after review - NVKE_VALIDATE_EXCLUDE_LABELS takes only labels from an allowlist, so far issues-certificate. A deny-list let a profile drop the health and version checks it is barred from controlling, and accepted typos. - A variable set blank wins over the profile, so a run can get a built-in default back. The profile is applied with t.Setenv so its values end with TestE2E. - The exclusion is recorded by the JUnit LabelFilter property rather than a per-container report entry that some runs never wrote. - The drift test scans the whole module, internal packages included, for every input prefix; NKE_E2E_AUDIENCE becomes a profile key and the auth switch, token TTL and lane-only inputs are excluded with reasons. - siteNamespaces takes the controller namespace from the settings it reads rather than the process environment. - The loader refuses blank values, empty lists and extra documents. - The image workflow checks the bad profile fails for the right reason. Signed-off-by: Ron Compos <rcompos@nvidia.com> * feat(e2e): cert-manager approval as a site fact in place of label exclusions Signed-off-by: Ron Compos <rcompos@nvidia.com> * feat(e2e): declare what the site lane installs Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): keep lane tenant probes out of default and refuse reuse on the site lane Signed-off-by: Ron Compos <rcompos@nvidia.com> * feat(e2e): keep the site and tenant kubeconfigs in the run's key dir Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): drop the temp kubeconfig from the keep log and say cluster in the PVC skip Signed-off-by: Ron Compos <rcompos@nvidia.com> * docs(e2e): run the validation image against a kept site Signed-off-by: Ron Compos <rcompos@nvidia.com> * feat(e2e): run the validation image from a workstation hack/validate-site.sh runs the validation image with Docker against a site, from a site file kept outside the repository: how to reach the site (a kubeconfig, a Teleport kube proxy, or an SSH forward, which a kept qualify run can fill in), the profile, the image and the two versions. Read-only by default; --full, --only and --dry-run select the checks. Each run keeps its reports, log and inputs, without credentials, and prints failures and skip reasons. The README documents it, and says read-only runs still create a short-lived probe pod. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): wait for Docker and read tsh's local proxy in validate-site.sh A Docker daemon waking from idle fails its first requests, which the script took for a missing image. It now waits for the daemon and pulls only when the image is not there, and shows any other error. tsh v18 prints the local proxy's kubeconfig on stderr, and that kubeconfig keeps the Teleport server and listens as proxy-url. The script reads both streams and points a loopback proxy-url at host.docker.internal. Signed-off-by: Ron Compos <rcompos@nvidia.com> * docs(e2e): run the validation Job with a profile, and tidy validate-site.sh deploy/validate-site.yaml gains commented blocks for a profile mounted from an nvke-validate-profile ConfigMap and for the CertificateRequest rule NVKE_SITE_CERT_MANAGER_APPROVAL=policy needs. "Running it on a site" says how to create the ConfigMap and when to uncomment each. validate-site.sh counts only specs in its summary, not [AfterSuite], runs the image on its own platform, and its header mentions the proxy-url rewrite for tsh's local proxy. Signed-off-by: Ron Compos <rcompos@nvidia.com> * feat(e2e): add qualify validate and NVKE_SITE_SCOPE - qualify validate runs the validation image against a kept Forge site (--run-dir), a Teleport cluster (--teleport-cluster) or a kubeconfig, building the image from the checkout unless --image is given. It replaces hack/validate-site.sh. A kept site now records its node, jump host and kubeconfig in node-keys/<node>.json for it to read. - NVKE_SITE_SCOPE=namespaces holds the workload, pod, certificate, Argo CD and CloudNativePG checks to the site's namespaces and its components'. What they find elsewhere is reported, failed or not, and fails nothing. - Check 24 reports anonymous access as not checked where a proxy turns the request away at TLS, as Teleport's does. - Check 31, under approver-policy, reports issuance as not checked where no Ready CertificateRequestPolicy selects its Issuer, following approver-policy's own selection rules. - Lint fixes in earlier files on the branch. Signed-off-by: Ron Compos <rcompos@nvidia.com> * docs(e2e): fix validation image tag examples and site Job notes - Use v0.23.1 in the image build, push, run and FROM examples; a controller/vX.Y.Z tag publishes nothing. - List v* release tags, without nightly betas, when keeping a site's image current. - Say which tags have the Dockerfile and deploy/. - Running it on a site: how to run without the creates checks, link NVKE_SITE_SCOPE and a shared site, note that older images ignore scope and profiles, and point to running from a workstation. Signed-off-by: Ron Compos <rcompos@nvidia.com> * docs(e2e): spell out what qualify validate needs from a workstation - List the tools each mode needs, and that --image must be pulled first. - Say which checkout the built image tests, and when to pass --image. - Give each mode its own steps and credentials: the jump host login for --run-dir, tsh login and tsh kube ls for --teleport-cluster, and a kubeconfig without exec plugins for --kubeconfig. - Table the inputs and where each value comes from. - State the RBAC, the probe namespace, the controller API token, and what a run writes and leaves. Signed-off-by: Ron Compos <rcompos@nvidia.com> * docs(e2e): state what qualify validate expects of the image - Say what an --image must keep from the Dockerfile: the mounts, the ENTRYPOINT report paths and the ENV switches the run relies on. - Note that the container runs as your user and on the image's platform, and that no published image exists yet. - Say the identity, not the label filter, keeps a run from changing the site, and use the validate-site.yaml roles rather than admin on a shared site. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): keep the site connection through an interrupt and skip checks that tested nothing - qualify validate: give the site connection its own context, ended only after the suite exits, so the suite's cleanup still reaches the site on an interrupt. Start docker and tsh in their own process groups, so the suite gets one interrupt and Ginkgo does not skip its cleanup. - Check 31: skip with the reason, rather than pass, when no CertificateRequestPolicy selects its Issuer. - Check 24: skip, rather than pass, when a proxy refuses the anonymous request before the API server; binding and identity problems still fail. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): refuse run switches, fail empty runs, pin the issuerRef group and keep kube-system in scope qualify validate refuses to start when NVKE_SITE_VALIDATE, NVKE_E2E_REQUIRE_EXPECTED_VERSION or NKE_E2E_AUTH_DISABLE is set, even to nothing, and exits non-zero when no check passed. The cert-manager check writes the issuerRef group, from the same helper its policy pre-check matches against. A scoped site always includes kube-system and the controller's namespace. The README notes that the pre-check does not cover the RBAC use binding. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): bound the SSH handshake, pin the kept node's host key, and tighten the run summary and inputs qualify validate: - kills the relay when the SSH handshake takes more than a minute - holds a kept node to the host key its record now carries, and refuses a record without one - refuses --context outside --kubeconfig - deletes a reused --out's old report before the run - lists failed suite nodes in the summary The suite records the node's host key in the kept-site record, rejects an empty validation profile, and reports a denied certificate request as not failing the check. The README reads --controller-version from /api/version, not the image tag, and says the Job's env wins over a profile. Signed-off-by: Ron Compos <rcompos@nvidia.com> * feat(e2e)!: typed, versioned validation profile Replace the flat NVKE_SITE_* profile with a validate.nvke.dev/v1alpha1 ValidationProfile, strictly decoded and described by a JSON Schema. Retired description variables fail the run, naming their field. NVKE_SITE_VALIDATE, _KUBERNETES_VERSION and _WORKLOAD_VERSIONS become NVKE_MGMT_CLUSTER_*, and the site-validate label becomes mgmt-cluster-validate. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): find the profile tests' files from their source, and drop an old name The suite binary runs from another directory in the CAPD and NICO jobs, so the README, schema and input-coverage tests now read from the package's source directory. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(qualify): harden qualify validate and use neutral example names - Refuse a run with no --run-dir, --teleport-cluster or --kubeconfig, rather than fall back to the default kubeconfig. - Say what a run creates: without --full, only the DNS probe pod. - Clear the last run's JSON report as well as its JUnit one. - Write the container kubeconfig to a new owner-only file. - Refuse a git describe tag that is not a Docker tag. - Read only this run's part of connect.log, and keep tsh's kubeconfig in --out. - Refuse a kubeconfig whose token comes from a file. - Keep a kept tenant's kubeconfig at 0600 when the file already existed. - Drop the FORGE_TELEPORT_PROXY fallback; set TELEPORT_PROXY or tsh login. - Use nvke-controller and registry as example names in tests and docs. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): address review findings on validation profiles Skip the profile tests that read the package's source when the binary runs without it, as the e2e images do. Refuse duplicate API server flag names and component keys. Run the probe namespace removal however the teardown ends, and write a kept tenant's kubeconfig privately. Stop tsh with an interrupt and wait for it, removing its kubeconfig. Note the variable and label a v0.23.1 image reads. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(qualify): keep --only narrowing, fail empty runs in the suite, free the --run-dir port - Refuse an --only that does not parse as a label expression on its own, so it cannot close the filter's parenthesis and select the creates specs. - Fail a validation image run in which no spec passed, in the suite, so the in-cluster Job fails as qualify validate does. Dry runs are exempt. - Forward a free local port for --run-dir, with a private copy of the kept kubeconfig on that port, rather than bind the node's own port locally. - Say that apiVersion and kind are required in a profile. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): bound the probe namespace cleanup, and test writePrivateFile - Remove the tenant's probe namespace on its own one-minute context, so an AfterAll timeout, which cancels the spec's, does not leave it behind. - Test writePrivateFile on a new file and on an existing 0644 one. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): register the no-check hook before the selected JUnit report ReportAfterSuite hooks run in registration order, each on the report as it stood before it ran, so the JUnit report written first left out the no-check failure. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(qualify): require a probe namespace for scoped runs, keep credentials out of --out - Refuse a profile with managementCluster.scope: namespaces and no probe.namespace when the run is not in a pod, rather than create the probe pods in default, which the scope never named. - Write the transit kubeconfigs to a private directory under the user's cache, removed when the run ends, so --out holds no credentials. - Say in the README that the image's default runs the creates specs, the equivalent of qualify validate --full, and how to run it read-only. Signed-off-by: Ron Compos <rcompos@nvidia.com> * fix(e2e): precheck the profile in the run's namespace, and fail a CNPG check that saw no cluster The profile precheck passed no namespace file, so it always took the run to be outside a pod and refused scope: namespaces without probe.namespace even in the image. It now reads the service-account namespace file the specs read. With scope: namespaces and every CloudNativePG cluster outside the scope, the database check passed having checked none. It now fails, while a site with no database cluster still passes. Signed-off-by: Ron Compos <rcompos@nvidia.com> --------- Signed-off-by: Ron Compos <rcompos@nvidia.com>