diff --git a/.agents/skills/helm-dev-environment/SKILL.md b/.agents/skills/helm-dev-environment/SKILL.md index 170bdd7c16..e3448efa3e 100644 --- a/.agents/skills/helm-dev-environment/SKILL.md +++ b/.agents/skills/helm-dev-environment/SKILL.md @@ -355,7 +355,7 @@ KUBECONFIG=../../../kubeconfig skaffold run -p high-availability The `high-availability` profile expects a Secret named `openshell-ha-pg` in the `openshell` namespace with a `uri` key. For local manual testing, either create your own PostgreSQL Secret or use the e2e PostgreSQL fixture manifest in -`e2e/kubernetes/postgres-fixture.yaml`. +`tests/support/kube/fixtures/postgres.yaml`. For the `high-availability` profile, return to the repository root and apply the GatewayClass and BackendTrafficPolicy manifest after Skaffold has installed diff --git a/.github/workflows/branch-checks.yml b/.github/workflows/branch-checks.yml index 411572ee33..9f6531bdc1 100644 --- a/.github/workflows/branch-checks.yml +++ b/.github/workflows/branch-checks.yml @@ -280,6 +280,7 @@ jobs: cargo fmt --manifest-path tests/suites/conformance/Cargo.toml --all -- --check cargo fmt --manifest-path tests/suites/continuity/Cargo.toml --all -- --check cargo fmt --manifest-path tests/suites/drivers/docker/Cargo.toml --all -- --check + cargo fmt --manifest-path tests/suites/drivers/kubernetes/Cargo.toml --all -- --check cargo fmt --manifest-path tests/suites/drivers/podman/Cargo.toml --all -- --check cargo fmt --manifest-path tests/suites/features/Cargo.toml --all -- --check cargo fmt --manifest-path tests/support/Cargo.toml --all -- --check @@ -343,6 +344,7 @@ jobs: cargo clippy --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --all-targets -- -D warnings cargo clippy --locked --manifest-path tests/suites/continuity/Cargo.toml --workspace --all-targets -- -D warnings cargo clippy --locked --manifest-path tests/suites/drivers/docker/Cargo.toml --workspace --all-targets -- -D warnings + cargo clippy --locked --manifest-path tests/suites/drivers/kubernetes/Cargo.toml --workspace --all-targets -- -D warnings cargo clippy --locked --manifest-path tests/suites/drivers/podman/Cargo.toml --workspace --all-targets -- -D warnings cargo clippy --locked --manifest-path tests/suites/features/Cargo.toml --workspace --all-targets -- -D warnings cargo clippy --locked --manifest-path tests/support/Cargo.toml --all-targets -- -D warnings diff --git a/.github/workflows/branch-e2e.yml b/.github/workflows/branch-e2e.yml index 87d9a38db7..8224227b2b 100644 --- a/.github/workflows/branch-e2e.yml +++ b/.github/workflows/branch-e2e.yml @@ -29,7 +29,6 @@ jobs: run_integration: ${{ steps.labels.outputs.run_core_e2e }} run_core_e2e: ${{ steps.labels.outputs.run_core_e2e }} run_kubernetes_ha_e2e: ${{ steps.labels.outputs.run_kubernetes_ha_e2e }} - run_kubernetes_credential_drivers_e2e: ${{ steps.labels.outputs.run_kubernetes_credential_drivers_e2e }} run_continuity_e2e: ${{ steps.labels.outputs.run_continuity_e2e }} run_any_e2e: ${{ steps.labels.outputs.run_any_e2e }} steps: @@ -53,24 +52,21 @@ jobs: fi run_core_e2e="$(jq -r 'index("test:e2e") != null' <<< "$LABELS_JSON")" run_kubernetes_ha_e2e="$(jq -r 'index("test:e2e-kubernetes") != null' <<< "$LABELS_JSON")" - run_kubernetes_credential_drivers_e2e="$(jq -r 'index("test:e2e-kubernetes") != null' <<< "$LABELS_JSON")" run_continuity_e2e="$(jq -r 'index("test:e2e:continuity") != null' <<< "$LABELS_JSON")" ;; *) sha="$DISPATCH_SHA" run_core_e2e=true run_kubernetes_ha_e2e=false - run_kubernetes_credential_drivers_e2e=false run_continuity_e2e=true ;; esac if [ "$should_run" = false ]; then run_core_e2e=false run_kubernetes_ha_e2e=false - run_kubernetes_credential_drivers_e2e=false run_continuity_e2e=false fi - if [ "$run_core_e2e" = "true" ] || [ "$run_kubernetes_ha_e2e" = "true" ] || [ "$run_kubernetes_credential_drivers_e2e" = "true" ]; then + if [ "$run_core_e2e" = "true" ] || [ "$run_kubernetes_ha_e2e" = "true" ]; then run_any_e2e=true else run_any_e2e=false @@ -81,7 +77,6 @@ jobs: echo "sha=$sha" echo "run_core_e2e=$run_core_e2e" echo "run_kubernetes_ha_e2e=$run_kubernetes_ha_e2e" - echo "run_kubernetes_credential_drivers_e2e=$run_kubernetes_credential_drivers_e2e" echo "run_continuity_e2e=$run_continuity_e2e" echo "run_any_e2e=$run_any_e2e" } >> "$GITHUB_OUTPUT" @@ -269,7 +264,7 @@ jobs: set -euo pipefail # Retry dependency preparation, then build once. nix build --no-link .#openshell-test-runner || nix build --no-link .#openshell-test-runner - for family in features drivers/docker drivers/podman; do + for family in features drivers/docker drivers/kubernetes drivers/podman; do nix run .#openshell-test-runner -- build \ --family "$family" --out "artifacts/e2e-bundles/${family//\//-}" done @@ -285,6 +280,12 @@ jobs: path: artifacts/e2e-bundles/drivers-docker retention-days: 5 if-no-files-found: error + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: openshell-e2e-bundle-drivers-kubernetes-x86_64-unknown-linux-musl + path: artifacts/e2e-bundles/drivers-kubernetes + retention-days: 5 + if-no-files-found: error - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: openshell-e2e-bundle-drivers-podman-x86_64-unknown-linux-musl @@ -717,21 +718,6 @@ jobs: listener-delivery: ${{ matrix.delivery }} listener-takeover: ${{ matrix.takeover }} - kubernetes-workspace-managed-e2e: - needs: [pr_metadata, build-binaries-linux, build-conformance, build-images] - if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' - permissions: - actions: read - contents: read - packages: read - uses: ./.github/workflows/e2e-kubernetes-test.yml - with: - checkout-ref: ${{ needs.pr_metadata.outputs.sha }} - prebuilt-conformance: true - image-tag: ${{ needs.pr_metadata.outputs.sha }} - job-name: Kubernetes E2E (workspace managed mode) - e2e-task: e2e:kubernetes:workspace-managed - kubernetes-external-driver-e2e: needs: [pr_metadata, build-binaries-linux, build-conformance, build-gateway-plain, build-external-drivers, build-images] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' @@ -750,21 +736,6 @@ jobs: external-driver-binary: openshell-driver-kubernetes cluster-images: sandbox supervisor - kubernetes-workspace-operator-e2e: - needs: [pr_metadata, build-binaries-linux, build-conformance, build-images] - if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' - permissions: - actions: read - contents: read - packages: read - uses: ./.github/workflows/e2e-kubernetes-test.yml - with: - checkout-ref: ${{ needs.pr_metadata.outputs.sha }} - prebuilt-conformance: true - image-tag: ${{ needs.pr_metadata.outputs.sha }} - job-name: Kubernetes E2E (workspace operator mode) - e2e-task: e2e:kubernetes:workspace-operator - kubernetes-tracing-e2e: needs: [pr_metadata, build-binaries-linux, build-conformance, build-images] if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' @@ -799,21 +770,6 @@ jobs: kubernetes-features: e2e,e2e-host-gateway,e2e-kubernetes,e2e-kubernetes-ha use-envoy-gateway: true - kubernetes-credential-drivers-e2e: - needs: [pr_metadata, build-binaries-linux, build-conformance, build-images] - if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_kubernetes_credential_drivers_e2e == 'true' - permissions: - actions: read - contents: read - packages: read - uses: ./.github/workflows/e2e-kubernetes-test.yml - with: - checkout-ref: ${{ needs.pr_metadata.outputs.sha }} - prebuilt-conformance: true - image-tag: ${{ needs.pr_metadata.outputs.sha }} - job-name: Kubernetes Credential Drivers E2E - e2e-task: e2e:kubernetes:credential-drivers - core-e2e-result: name: Core E2E result needs: @@ -834,8 +790,6 @@ jobs: - kubernetes-e2e - kubernetes-app-listener-e2e - kubernetes-external-driver-e2e - - kubernetes-workspace-managed-e2e - - kubernetes-workspace-operator-e2e - kubernetes-tracing-e2e if: always() && needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == 'true' runs-on: ubuntu-latest @@ -859,16 +813,3 @@ jobs: - uses: ./.github/actions/check-job-results with: results: ${{ toJSON(needs) }} - - kubernetes-credential-drivers-e2e-result: - name: Kubernetes Credential Drivers E2E result - needs: [pr_metadata, build-binaries-macos, kubernetes-credential-drivers-e2e] - if: always() && needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_kubernetes_credential_drivers_e2e == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - uses: ./.github/actions/check-job-results - with: - results: ${{ toJSON(needs) }} diff --git a/.github/workflows/e2e-suites.yml b/.github/workflows/e2e-suites.yml index 3de3608656..e48c95d16f 100644 --- a/.github/workflows/e2e-suites.yml +++ b/.github/workflows/e2e-suites.yml @@ -10,8 +10,8 @@ # results. With `prebuilt`, the rows run what the caller built once for the # run instead: conformance rows the static `openshell-conformance`, the other # rows their family's test bundle. The `family` input selects the rows of one -# family, including the workspaces under it (drivers selects drivers/docker -# and drivers/podman); leave it empty to run every row. +# family, including the workspaces under it (drivers selects drivers/docker, +# drivers/kubernetes and drivers/podman); leave it empty to run every row. name: E2E Suites @@ -146,6 +146,12 @@ jobs: {"environment":"fedora-podman-rootful-keycloak","installer":"rpm","family":"features","package":"keycloak-provider-refresh","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"fedora-podman-rootless-keycloak","installer":"rpm","family":"features","package":"keycloak-provider-refresh","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"ubuntu-docker-rootful","installer":"deb","family":"drivers/docker","gateway":"openshell","runner":"ubuntu-24.04"}, + {"environment":"ubuntu-k3s","installer":"k3s","family":"drivers/kubernetes","package":"runtime","gateway":"tmachine","runner":"ubuntu-24.04"}, + {"environment":"ubuntu-k3s","installer":"k3s-ha","family":"drivers/kubernetes","package":"runtime","gateway":"tmachine","runner":"ubuntu-24.04"}, + {"environment":"ubuntu-k3s","installer":"k3s-workspace-managed","family":"drivers/kubernetes","package":"workspace-managed","gateway":"tmachine","runner":"ubuntu-24.04"}, + {"environment":"ubuntu-k3s","installer":"k3s-workspace-operator","family":"drivers/kubernetes","package":"workspace-operator","gateway":"tmachine","runner":"ubuntu-24.04"}, + {"environment":"ubuntu-k3s","installer":"k3s-credentials-secrets","family":"drivers/kubernetes","package":"credential-drivers","gateway":"tmachine","runner":"ubuntu-24.04"}, + {"environment":"ubuntu-k3s","installer":"k3s-credentials-vault","family":"drivers/kubernetes","package":"credential-drivers","gateway":"tmachine","runner":"ubuntu-24.04"}, {"environment":"fedora-podman-rootful-userns-default","installer":"rpm","family":"drivers/podman","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"fedora-podman-rootful-userns-auto","installer":"rpm","family":"drivers/podman","gateway":"openshell","runner":"ubuntu-24.04"}, {"environment":"fedora-podman-rootful-userns-keep-id","installer":"rpm","family":"drivers/podman","gateway":"openshell","runner":"ubuntu-24.04"}, diff --git a/.github/workflows/rust-cache.yml b/.github/workflows/rust-cache.yml index 0a66b04309..8eade6cc55 100644 --- a/.github/workflows/rust-cache.yml +++ b/.github/workflows/rust-cache.yml @@ -110,7 +110,7 @@ jobs: run: | set -euo pipefail nix build --no-link .#openshell-test-runner || nix build --no-link .#openshell-test-runner - for family in features drivers/docker drivers/podman; do + for family in features drivers/docker drivers/kubernetes drivers/podman; do nix run .#openshell-test-runner -- build \ --family "$family" --out "$RUNNER_TEMP/e2e-bundles/${family//\//-}" done diff --git a/CI.md b/CI.md index 8eaf6b1787..e5eb732344 100644 --- a/CI.md +++ b/CI.md @@ -220,8 +220,10 @@ images. Release Dev, Release, and Pre-release use the same package installers. The feature suites (`tests/suites/features`) and the Docker and Podman driver suites (`tests/suites/drivers/{docker,podman}`) run the same way, on the package installers; the Podman driver suite's environments merge their Podman settings -into the packaged gateway's configuration (see `TESTING.md`). The `e2e-podman` -lane runs on the RPM installer as well. The driver suites and `e2e-podman` run +into the packaged gateway's configuration (see `TESTING.md`). The Kubernetes +driver suite (`tests/suites/drivers/kubernetes`) runs each package on the k3s +installers that configure the chart the way it needs, such as +`k3s-workspace-managed` or `k3s-credentials-vault` (see `TESTING.md`). The `e2e-podman` lane runs on the RPM installer as well. The driver suites and `e2e-podman` run only in `Branch E2E Checks`. The manual Integration Tests workflow runs the remaining tmachine testsuites, such as `e2e-podman`, and downloads the packages selected by its matrix. diff --git a/TESTING.md b/TESTING.md index 5cf0592fd0..c664c6424c 100644 --- a/TESTING.md +++ b/TESTING.md @@ -680,7 +680,31 @@ builds in `branch-e2e.yml` and `rust-cache.yml`. The Docker and Podman driver suites (`tests/suites/drivers/{docker,podman}`) check what the driver does with a sandbox's containers when its workload stops or an ephemeral sandbox finishes. The Podman suite also compares OpenShell and direct Podman -user-namespace mappings. +user-namespace mappings. The Kubernetes driver suite +(`tests/suites/drivers/kubernetes`) checks the objects the driver keeps for a +sandbox. Each of its packages needs one way of installing the chart: `runtime` +runs on the `k3s` and `k3s-ha` installers, `workspace-managed` and +`workspace-operator` on `k3s-workspace-managed` and `k3s-workspace-operator`, +and `credential-drivers` on `k3s-credentials-secrets` and +`k3s-credentials-vault`. Every k3s installer publishes the cluster's +kubeconfig and the release namespace for `tests/support/kube`. + +A k3s installer is a `k3sInstaller` in `tests/tmachine/config.nix`: fixture +playbooks (`ansible/playbooks/k3s-.yaml`) that stage what the gateway +depends on, such as PostgreSQL or OpenBao, then Helm values files applied in +order, mTLS, and variables published to tests. Add a variant there rather than +a new playbook. CI rebuilds installer layers on every run but caches the +`ubuntu-k3s` setup layer, so `ansible/playbooks/k3s.yaml` stages the Agent +Sandbox manifest, the fixture charts and the images they use. A fixture that +deploys a new image adds its manifest or chart there, so installers need no +network. + +```shell +nix run .#openshell-test-runner -- run \ + --environment ubuntu-k3s --installer k3s-workspace-managed \ + --family drivers/kubernetes --package workspace-managed +``` + Each `fedora-podman-{rootful,rootless}-userns-` environment configures the gateway with one mode (`default`, `auto`, `keep-id` or `private`) and works with every installer; CI runs it with `rpm`: @@ -814,14 +838,6 @@ Run the VM-backed Rust CLI e2e suite: mise run e2e:vm ``` -Run the targeted Kubernetes credential-driver e2e suite. This deploys an -OpenBao fixture for the Vault-compatible driver path and validates Kubernetes -Secrets and Vault storage backends one at a time: - -```shell -mise run e2e:kubernetes:credential-drivers -``` - ### Kubernetes E2E (`e2e/rust/e2e-kubernetes.sh`) The `e2e-kubernetes` nextest profile temporarily excludes only @@ -973,9 +989,6 @@ Available task variants: | `e2e:kubernetes` | Default Rust e2e against Helm-deployed gateway | | `e2e:kubernetes:db` | All database backend scenarios (SQLite + external PostgreSQL) | | `e2e:kubernetes:sidecar` | Supervisor sidecar topology overlay | -| `e2e:kubernetes:credential-drivers` | Kubernetes Secrets and Vault credential storage | -| `e2e:kubernetes:workspace-managed` | Managed workspace mode (auto-created namespaces) | -| `e2e:kubernetes:workspace-operator` | Operator workspace mode (pre-provisioned namespaces) | | `e2e:kubernetes:v1alpha1` | Agent Sandbox v1alpha1 compatibility | | `e2e:kubernetes:external-driver` | External Kubernetes driver sidecar | | `e2e:kubernetes:shared-supervisor` | One-member shared supervisor pool for the gateway's sandboxes (gateway TLS through the port-forward) | diff --git a/e2e/rust/Cargo.toml b/e2e/rust/Cargo.toml index 33464ed903..a9738bfa71 100644 --- a/e2e/rust/Cargo.toml +++ b/e2e/rust/Cargo.toml @@ -32,9 +32,6 @@ e2e-gpu = ["e2e"] e2e-docker-gpu = ["e2e-docker", "e2e-gpu"] e2e-kubernetes = ["e2e"] e2e-kubernetes-ha = ["e2e-kubernetes"] -e2e-kubernetes-credential-drivers = ["e2e-kubernetes"] -e2e-kubernetes-workspace-managed = ["e2e-kubernetes"] -e2e-kubernetes-workspace-operator = ["e2e-kubernetes"] # Trace export to the Jaeger fixture that `OPENSHELL_E2E_KUBE_JAEGER=1` deploys. e2e-kubernetes-tracing = ["e2e-kubernetes"] # One supervisor process shared by the gateway's sandboxes. @@ -136,36 +133,16 @@ name = "kubernetes_corporate_proxy" path = "tests/kubernetes_corporate_proxy.rs" required-features = ["e2e-kubernetes"] -[[test]] -name = "kubernetes_runtime_reconcile" -path = "tests/kubernetes_runtime_reconcile.rs" -required-features = ["e2e-kubernetes"] - [[test]] name = "kubernetes_tracing" path = "tests/kubernetes_tracing.rs" required-features = ["e2e-kubernetes-tracing"] -[[test]] -name = "credential_drivers" -path = "tests/credential_drivers.rs" -required-features = ["e2e-kubernetes-credential-drivers"] - [[test]] name = "user_namespaces" path = "tests/user_namespaces.rs" required-features = ["e2e-kubernetes"] -[[test]] -name = "workspace_namespace_managed" -path = "tests/workspace_namespace_managed.rs" -required-features = ["e2e-kubernetes-workspace-managed"] - -[[test]] -name = "workspace_namespace_operator" -path = "tests/workspace_namespace_operator.rs" -required-features = ["e2e-kubernetes-workspace-operator"] - [[test]] name = "gpu" path = "tests/gpu.rs" diff --git a/e2e/rust/e2e-kubernetes.sh b/e2e/rust/e2e-kubernetes.sh index 4e2df4a469..7645c6844f 100755 --- a/e2e/rust/e2e-kubernetes.sh +++ b/e2e/rust/e2e-kubernetes.sh @@ -69,19 +69,11 @@ if [ -n "${OPENSHELL_E2E_KUBE_TEST:-}" ]; then test_filter+=(--test "${OPENSHELL_E2E_KUBE_TEST}") fi -is_operator_workspace_mode() { - [[ ",${E2E_FEATURES}," == *",e2e-kubernetes-workspace-operator,"* ]] -} - run_conformance() { if [ "${OPENSHELL_E2E_KUBE_CONFORMANCE:-1}" = "0" ]; then echo "note: skipping conformance suites (OPENSHELL_E2E_KUBE_CONFORMANCE=0)." return 0 fi - if is_operator_workspace_mode; then - echo "note: skipping conformance suites in Kubernetes operator workspace mode; default workspace is not operator-allowlisted (see #2971)." - return 0 - fi OPENSHELL_CONFORMANCE_JUNIT="${OPENSHELL_CONFORMANCE_JUNIT:-${ROOT}/results/${OPENSHELL_E2E_REPORT_NAME:-e2e-kubernetes}-conformance.xml}" \ OPENSHELL_TEST_PYTHON_IMAGE="${OPENSHELL_TEST_PYTHON_IMAGE:-${E2E_PULLABLE_PYTHON_IMAGE}}" \ @@ -135,13 +127,4 @@ if [ "${1:-}" = "${RUN_WITH_GATEWAY_COMMAND}" ]; then exit 0 fi -# Credential-driver mode: run once per storage backend, each with its own report. -if [ "${OPENSHELL_E2E_CREDENTIAL_DRIVERS:-0}" = "1" ] \ - && [ -z "${OPENSHELL_E2E_CREDENTIAL_DRIVER:-}" ]; then - OPENSHELL_E2E_CREDENTIAL_DRIVER=kubernetes-secrets \ - OPENSHELL_E2E_REPORT_NAME=e2e-kubernetes-secrets run_suite - OPENSHELL_E2E_CREDENTIAL_DRIVER=vault \ - OPENSHELL_E2E_REPORT_NAME=e2e-kubernetes-vault run_suite -else - run_suite -fi +run_suite diff --git a/e2e/rust/src/harness/sandbox.rs b/e2e/rust/src/harness/sandbox.rs index 9d14092cb2..61ea08ec22 100644 --- a/e2e/rust/src/harness/sandbox.rs +++ b/e2e/rust/src/harness/sandbox.rs @@ -638,9 +638,8 @@ impl Drop for SandboxGuard { // A detached thread here would get killed along with the test // process before the delete command finishes, leaking the sandbox. - // Use a blocking std::process::Command instead, matching the - // ManagedCleanup pattern in workspace_namespace_managed.rs, so - // cleanup completes before this function returns. + // Use a blocking std::process::Command instead, so cleanup completes + // before this function returns. if let Some(mut child) = self.child.take() { let _ = child.start_kill(); } diff --git a/e2e/rust/tests/credential_drivers.rs b/e2e/rust/tests/credential_drivers.rs deleted file mode 100644 index 3901de1c15..0000000000 --- a/e2e/rust/tests/credential_drivers.rs +++ /dev/null @@ -1,412 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -#![cfg(feature = "e2e-kubernetes-credential-drivers")] - -use std::process::Stdio; -use std::time::{SystemTime, UNIX_EPOCH}; - -use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64_STANDARD}; -use openshell_e2e::harness::binary::openshell_cmd; -use openshell_e2e::harness::cli::run_cli; -use openshell_e2e::harness::output::strip_ansi; -use openshell_e2e::harness::sandbox::SandboxGuard; -use sha2::{Digest, Sha256}; - -const CREDENTIAL_KEY: &str = "OPENAI_API_KEY"; - -fn unique_suffix() -> String { - let millis = SystemTime::now() - .duration_since(UNIX_EPOCH) - .unwrap_or_default() - .as_millis(); - format!("{}-{millis}", std::process::id()) -} - -fn namespace() -> String { - std::env::var("OPENSHELL_E2E_SANDBOX_NAMESPACE").unwrap_or_else(|_| "openshell".to_string()) -} - -fn credential_driver() -> String { - std::env::var("OPENSHELL_E2E_CREDENTIAL_DRIVER") - .unwrap_or_else(|_| "kubernetes-secrets".to_string()) -} - -#[derive(Debug)] -struct ProviderIdentity { - id: String, - workspace: String, -} - -fn vault_namespace() -> String { - std::env::var("OPENSHELL_E2E_VAULT_NAMESPACE").unwrap_or_else(|_| "vault".to_string()) -} - -fn vault_pod() -> String { - std::env::var("OPENSHELL_E2E_VAULT_POD").unwrap_or_else(|_| "vault-0".to_string()) -} - -fn vault_token() -> String { - std::env::var("OPENSHELL_E2E_VAULT_TOKEN").unwrap_or_else(|_| "root".to_string()) -} - -fn managed_credential_hash(identity: &ProviderIdentity, provider_name: &str) -> String { - // This test stores an ordinary provider credential, whose storage object ID is - // the provider ID, so both managed drivers use these four identity fields. - let mut hasher = Sha256::new(); - hasher.update(identity.workspace.as_bytes()); - hasher.update([0]); - hasher.update(identity.id.as_bytes()); - hasher.update([0]); - hasher.update(provider_name.as_bytes()); - hasher.update([0]); - hasher.update(CREDENTIAL_KEY.as_bytes()); - let digest = hasher.finalize(); - format!("{digest:x}") -} - -fn managed_kubernetes_secret_name(identity: &ProviderIdentity, provider_name: &str) -> String { - let hex = managed_credential_hash(identity, provider_name); - format!("openshell-cred-{}", &hex[..40]) -} - -fn managed_vault_path(identity: &ProviderIdentity, provider_name: &str) -> String { - let hex = managed_credential_hash(identity, provider_name); - format!("openshell/provider-credentials/{}", &hex[..40]) -} - -fn contains_placeholder_for_env_key(output: &str, key: &str) -> bool { - let legacy = format!("openshell:resolve:env:{key}"); - let revision_prefix = "openshell:resolve:env:v"; - let revision_suffix = format!("_{key}"); - output.split_whitespace().any(|token| { - token == legacy || (token.starts_with(revision_prefix) && token.ends_with(&revision_suffix)) - }) -} - -fn kubectl_command() -> tokio::process::Command { - let mut cmd = tokio::process::Command::new("kubectl"); - if let Ok(context) = std::env::var("OPENSHELL_E2E_KUBE_CONTEXT_ACTIVE") - && !context.trim().is_empty() - { - cmd.arg("--context").arg(context); - } - cmd -} - -async fn kubectl(args: &[&str]) -> Result { - let output = kubectl_command() - .args(args) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .output() - .await - .map_err(|err| format!("failed to spawn kubectl {args:?}: {err}"))?; - - let stdout = String::from_utf8_lossy(&output.stdout).to_string(); - let stderr = String::from_utf8_lossy(&output.stderr).to_string(); - let combined = format!("{stdout}{stderr}"); - if !output.status.success() { - return Err(format!( - "kubectl {args:?} failed (exit {:?}):\n{combined}", - output.status.code() - )); - } - Ok(combined) -} - -async fn bao(args: &[&str]) -> Result { - let namespace = vault_namespace(); - let pod = vault_pod(); - let token = vault_token(); - let token_env = format!("BAO_TOKEN={token}"); - let mut command = kubectl_command(); - command.args([ - "-n", &namespace, "exec", &pod, "--", "env", &token_env, "bao", - ]); - command.args(args); - let output = command - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .output() - .await - .map_err(|err| format!("failed to spawn bao {args:?}: {err}"))?; - - let stdout = String::from_utf8_lossy(&output.stdout).to_string(); - let stderr = String::from_utf8_lossy(&output.stderr).to_string(); - let combined = format!("{stdout}{stderr}"); - if !output.status.success() { - return Err(format!( - "bao {args:?} failed (exit {:?}):\n{combined}", - output.status.code() - )); - } - Ok(combined) -} - -async fn delete_provider(name: &str) { - let mut cmd = openshell_cmd(); - cmd.arg("provider") - .arg("delete") - .arg(name) - .stdout(Stdio::null()) - .stderr(Stdio::null()); - let _ = cmd.status().await; -} - -async fn create_provider(name: &str, secret_value: &str) -> Result { - let credential = format!("{CREDENTIAL_KEY}={secret_value}"); - let (output, code) = run_cli(&[ - "provider", - "create", - "--name", - name, - "--type", - "openai", - "--credential", - &credential, - ]) - .await; - let clean = strip_ansi(&output); - if code != 0 { - return Err(format!( - "provider create {name} failed (exit {code}):\n{clean}" - )); - } - Ok(clean) -} - -async fn provider_identity(provider_name: &str) -> Result { - let (output, code) = run_cli(&["provider", "list", "--output", "json"]).await; - let clean = strip_ansi(&output); - if code != 0 { - return Err(format!("provider list failed (exit {code}):\n{clean}")); - } - let listing: serde_json::Value = serde_json::from_str(&clean) - .map_err(|err| format!("failed to parse provider list JSON: {err}\n{clean}"))?; - let provider = listing["providers"] - .as_array() - .ok_or_else(|| format!("provider list JSON has no providers array:\n{clean}"))? - .iter() - .find(|provider| provider["name"].as_str() == Some(provider_name)) - .ok_or_else(|| format!("provider '{provider_name}' was not returned by provider list"))?; - let id = provider["id"] - .as_str() - .filter(|id| !id.is_empty()) - .ok_or_else(|| format!("provider '{provider_name}' did not include an ID"))?; - let workspace = provider["workspace"] - .as_str() - .ok_or_else(|| format!("provider '{provider_name}' did not include a workspace"))?; - Ok(ProviderIdentity { - id: id.to_string(), - workspace: workspace.to_string(), - }) -} - -async fn assert_provider_get_does_not_expose_secret( - provider_name: &str, - secret_value: &str, -) -> Result<(), String> { - let (output, code) = run_cli(&["provider", "get", provider_name]).await; - let clean = strip_ansi(&output); - if code != 0 { - return Err(format!( - "provider get {provider_name} failed (exit {code}):\n{clean}" - )); - } - if clean.contains(secret_value) { - return Err(format!( - "provider get {provider_name} exposed credential material:\n{clean}" - )); - } - Ok(()) -} - -async fn assert_provider_placeholder_available_in_sandbox( - provider_name: &str, - sandbox_name: &str, - secret_value: &str, -) -> Result<(), String> { - let mut guard = SandboxGuard::create(&[ - "--name", - sandbox_name, - "--provider", - provider_name, - "--no-auto-providers", - "--no-tty", - "--", - "bash", - "-lc", - r#"printf '%s\n' "$OPENAI_API_KEY""#, - ]) - .await?; - let clean = strip_ansi(&guard.create_output); - // Delete the sandbox before returning: the gateway refuses to delete a - // provider that is still attached to a sandbox. - guard.cleanup().await; - if !contains_placeholder_for_env_key(&clean, CREDENTIAL_KEY) { - return Err(format!( - "sandbox {sandbox_name} did not receive provider credential placeholder:\n{clean}" - )); - } - if clean.contains(secret_value) { - return Err(format!( - "sandbox {sandbox_name} output exposed credential material:\n{clean}" - )); - } - Ok(()) -} - -async fn assert_kubernetes_secret_stored( - identity: &ProviderIdentity, - provider_name: &str, - secret_value: &str, -) -> Result<(), String> { - let namespace = namespace(); - let secret_name = managed_kubernetes_secret_name(identity, provider_name); - let encoded = kubectl(&[ - "-n", - &namespace, - "get", - "secret", - &secret_name, - "-o", - &format!("jsonpath={{.data.{CREDENTIAL_KEY}}}"), - ]) - .await?; - let decoded = BASE64_STANDARD - .decode(encoded.trim()) - .map_err(|err| format!("failed to decode Kubernetes Secret value: {err}"))?; - let decoded = String::from_utf8(decoded) - .map_err(|err| format!("Kubernetes Secret value was not UTF-8: {err}"))?; - if decoded != secret_value { - return Err("Kubernetes Secret stored an unexpected credential value".to_string()); - } - Ok(()) -} - -async fn assert_kubernetes_secret_deleted( - identity: &ProviderIdentity, - provider_name: &str, -) -> Result<(), String> { - let namespace = namespace(); - let secret_name = managed_kubernetes_secret_name(identity, provider_name); - match kubectl(&["-n", &namespace, "get", "secret", &secret_name]).await { - Ok(output) => Err(format!( - "Kubernetes Secret '{secret_name}' still exists after provider deletion:\n{output}" - )), - Err(_) => Ok(()), - } -} - -async fn assert_vault_secret_stored( - identity: &ProviderIdentity, - provider_name: &str, - secret_value: &str, -) -> Result<(), String> { - let logical_path = managed_vault_path(identity, provider_name); - let output = bao(&[ - "kv", - "get", - "-field=value", - &format!("secret/{logical_path}"), - ]) - .await?; - if output.trim() != secret_value { - return Err("Vault stored an unexpected credential value".to_string()); - } - Ok(()) -} - -async fn assert_vault_secret_deleted( - identity: &ProviderIdentity, - provider_name: &str, -) -> Result<(), String> { - let logical_path = managed_vault_path(identity, provider_name); - match bao(&[ - "kv", - "get", - "-field=value", - &format!("secret/{logical_path}"), - ]) - .await - { - Ok(output) => Err(format!( - "Vault secret '{logical_path}' still exists after provider deletion:\n{output}" - )), - Err(_) => Ok(()), - } -} - -async fn assert_backend_stored( - driver: &str, - identity: &ProviderIdentity, - provider_name: &str, - secret_value: &str, -) -> Result<(), String> { - match driver { - "kubernetes-secrets" => { - assert_kubernetes_secret_stored(identity, provider_name, secret_value).await - } - "vault" => assert_vault_secret_stored(identity, provider_name, secret_value).await, - other => Err(format!("unsupported credential driver '{other}'")), - } -} - -async fn assert_backend_deleted( - driver: &str, - identity: &ProviderIdentity, - provider_name: &str, -) -> Result<(), String> { - match driver { - "kubernetes-secrets" => assert_kubernetes_secret_deleted(identity, provider_name).await, - "vault" => assert_vault_secret_deleted(identity, provider_name).await, - other => Err(format!("unsupported credential driver '{other}'")), - } -} - -#[tokio::test] -async fn provider_credentials_are_stored_in_configured_backend() { - assert!( - matches!( - std::env::var("OPENSHELL_E2E_CREDENTIAL_DRIVERS").as_deref(), - Ok("1") - ), - "run with `mise run e2e:kubernetes:credential-drivers` so the Kubernetes wrapper enables a credential storage driver" - ); - - let driver = credential_driver(); - let suffix = unique_suffix(); - let driver_slug = driver.replace('-', ""); - let provider_name = format!("cred-storage-{driver_slug}-{suffix}"); - // Sandbox names are DNS-routable and limited to 19 characters. - let sandbox_name = format!( - "cred-{}-{}", - &driver_slug[..1], - &suffix[suffix.len() - 10..] - ); - let secret_value = format!("example-e2e-{driver_slug}-{suffix}"); - - delete_provider(&provider_name).await; - - let result: Result = async { - create_provider(&provider_name, &secret_value).await?; - assert_provider_get_does_not_expose_secret(&provider_name, &secret_value).await?; - let identity = provider_identity(&provider_name).await?; - assert_backend_stored(&driver, &identity, &provider_name, &secret_value).await?; - assert_provider_placeholder_available_in_sandbox( - &provider_name, - &sandbox_name, - &secret_value, - ) - .await?; - Ok(identity) - } - .await; - - delete_provider(&provider_name).await; - let identity = result.expect("credential storage e2e failed"); - assert_backend_deleted(&driver, &identity, &provider_name) - .await - .expect("credential backend object should be deleted with provider"); -} diff --git a/e2e/rust/tests/kubernetes_runtime_reconcile.rs b/e2e/rust/tests/kubernetes_runtime_reconcile.rs deleted file mode 100644 index f93b2b8448..0000000000 --- a/e2e/rust/tests/kubernetes_runtime_reconcile.rs +++ /dev/null @@ -1,271 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -#![cfg(feature = "e2e-kubernetes")] - -//! A stopped sandbox whose stored bootstrap image predates a gateway upgrade -//! starts with the gateway's configured runtime image and keeps its identity -//! and workspace. - -use std::process::Stdio; - -use openshell_e2e::harness::binary::openshell_cmd; -use openshell_e2e::harness::cli::run_cli; -use openshell_e2e::harness::sandbox::SandboxGuard; - -const BOOTSTRAP_CONTAINER: &str = "openshell-sandbox-bootstrap"; -const STALE_IMAGE: &str = "registry.invalid/openshell/sandbox:stale"; -const MARKER: &str = "openshell-runtime-reconcile"; -const MARKER_PATH: &str = "/sandbox/.openshell-runtime-reconcile"; - -fn namespace() -> String { - std::env::var("OPENSHELL_E2E_SANDBOX_NAMESPACE").unwrap_or_else(|_| "openshell".to_string()) -} - -async fn kubectl(args: &[&str]) -> String { - let mut cmd = tokio::process::Command::new("kubectl"); - if let Ok(context) = std::env::var("OPENSHELL_E2E_KUBE_CONTEXT_ACTIVE") - && !context.trim().is_empty() - { - cmd.arg("--context").arg(context); - } - let output = cmd - .args(args) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .output() - .await - .unwrap_or_else(|error| panic!("spawn kubectl {args:?}: {error}")); - assert!( - output.status.success(), - "kubectl {args:?} failed: {}", - String::from_utf8_lossy(&output.stderr) - ); - String::from_utf8_lossy(&output.stdout).into_owned() -} - -/// Return the sandbox's Agent Sandbox resource and the index of its stored -/// bootstrap init container. -async fn sandbox_resource(name: &str) -> (serde_json::Value, usize) { - let output = kubectl(&[ - "-n", - &namespace(), - "get", - "sandboxes.agents.x-k8s.io", - "-l", - &format!("openshell.ai/sandbox-name={name}"), - "-o", - "json", - ]) - .await; - let list: serde_json::Value = serde_json::from_str(&output).expect("parse Sandbox list"); - let [resource] = list["items"].as_array().expect("Sandbox items").as_slice() else { - panic!("expected one Sandbox resource for {name}: {list}"); - }; - let index = resource["spec"]["podTemplate"]["spec"]["initContainers"] - .as_array() - .expect("stored init containers") - .iter() - .position(|container| container["name"] == BOOTSTRAP_CONTAINER) - .expect("stored bootstrap init container"); - (resource.clone(), index) -} - -fn bootstrap_image(resource: &serde_json::Value, index: usize) -> &serde_json::Value { - &resource["spec"]["podTemplate"]["spec"]["initContainers"][index]["image"] -} - -async fn service(resource: &serde_json::Value, prefix: &str) -> serde_json::Value { - let sandbox_id = resource["metadata"]["labels"]["openshell.ai/sandbox-id"] - .as_str() - .expect("sandbox ID"); - serde_json::from_str( - &kubectl(&[ - "-n", - &namespace(), - "get", - "service", - &format!("{prefix}-{sandbox_id}"), - "-o", - "json", - ]) - .await, - ) - .expect("parse Service") -} - -async fn legacy_lifecycle(endpoint: &str, operation: &str, name: &str) { - let output = openshell_cmd() - .args(["--gateway-endpoint", endpoint, "sandbox", operation, name]) - .output() - .await - .expect("legacy gateway lifecycle command"); - assert!( - output.status.success(), - "legacy {operation} failed: {}{}", - String::from_utf8_lossy(&output.stdout), - String::from_utf8_lossy(&output.stderr) - ); -} - -/// Run with an old gateway sharing the fixture database, signing keys and -/// cluster, with its own matching supervisor/runtime images. The configured -/// gateway endpoint must target the new gateway. -#[tokio::test] -#[ignore = "requires OPENSHELL_E2E_LEGACY_GATEWAY_ENDPOINT and a mixed-version gateway fixture"] -async fn old_and_new_gateways_can_restart_the_same_sandbox() { - let legacy = - std::env::var("OPENSHELL_E2E_LEGACY_GATEWAY_ENDPOINT").expect("legacy gateway endpoint"); - let mut sandbox = SandboxGuard::create_keep( - &["sh", "-c", "echo mixed-ready; exec sleep infinity"], - "mixed-ready", - ) - .await - .expect("create sandbox through new gateway"); - let (created, _) = sandbox_resource(&sandbox.name).await; - let boundary = service(&created, "os-boundary").await; - let supervisor = service(&created, "os-supervisor").await; - assert_eq!( - boundary["spec"]["selector"]["openshell.ai/boundary-role"], - "workload" - ); - assert_eq!( - supervisor["spec"]["selector"]["openshell.ai/boundary-role"], - "supervisor" - ); - assert_ne!( - boundary["spec"]["clusterIP"], - supervisor["spec"]["clusterIP"] - ); - - legacy_lifecycle(&legacy, "stop", &sandbox.name).await; - legacy_lifecycle(&legacy, "start", &sandbox.name).await; - let (restarted, _) = sandbox_resource(&sandbox.name).await; - let annotations = &restarted["metadata"]["annotations"]; - assert_ne!( - annotations["openshell.ai/sandbox-runtime-generation"], - annotations["openshell.ai/sandbox-runtime-control-generation"] - ); - assert!( - sandbox - .exec(&["printf", "old-ready"]) - .await - .expect("old pair exec") - .contains("old-ready") - ); - - for operation in ["stop", "start"] { - let (output, code) = run_cli(&["sandbox", operation, &sandbox.name]).await; - assert_eq!(code, 0, "new gateway {operation}: {output}"); - } - assert!( - sandbox - .exec(&["printf", "new-ready"]) - .await - .expect("new pair exec") - .contains("new-ready") - ); - let (restarted, _) = sandbox_resource(&sandbox.name).await; - let annotations = &restarted["metadata"]["annotations"]; - assert_eq!( - annotations["openshell.ai/sandbox-runtime-generation"], - annotations["openshell.ai/sandbox-runtime-control-generation"] - ); - let unchanged = service(&restarted, "os-boundary").await; - assert_eq!(unchanged["metadata"]["uid"], boundary["metadata"]["uid"]); - assert_eq!( - unchanged["spec"]["clusterIP"], - boundary["spec"]["clusterIP"] - ); - assert_eq!(unchanged["spec"]["selector"], boundary["spec"]["selector"]); - sandbox.cleanup().await; -} - -#[tokio::test] -async fn start_refreshes_stale_bootstrap_image() { - let mut sandbox = SandboxGuard::create_keep( - &["sh", "-c", "echo reconcile-ready; exec sleep infinity"], - "reconcile-ready", - ) - .await - .expect("create sandbox"); - sandbox - .exec(&[ - "sh", - "-c", - &format!("printf '%s\\n' '{MARKER}' > '{MARKER_PATH}'"), - ]) - .await - .expect("write workspace marker"); - let (output, code) = run_cli(&["sandbox", "stop", &sandbox.name]).await; - assert_eq!(code, 0, "sandbox stop failed:\n{output}"); - - // An older gateway stored its own runtime image in the resource. - let (before, index) = sandbox_resource(&sandbox.name).await; - let boundary = service(&before, "os-boundary").await; - let supervisor = service(&before, "os-supervisor").await; - // A legacy sandbox has no supervisor Service. Adding it on start must - // preserve the workload Service that old gateways use. - kubectl(&[ - "-n", - &namespace(), - "delete", - "service", - supervisor["metadata"]["name"] - .as_str() - .expect("supervisor Service name"), - ]) - .await; - let patch = serde_json::json!([{ - "op": "replace", - "path": format!("/spec/podTemplate/spec/initContainers/{index}/image"), - "value": STALE_IMAGE, - }]); - kubectl(&[ - "-n", - &namespace(), - "patch", - "sandboxes.agents.x-k8s.io", - before["metadata"]["name"] - .as_str() - .expect("Sandbox resource name"), - "--type=json", - "-p", - &patch.to_string(), - ]) - .await; - - let (output, code) = run_cli(&["sandbox", "start", &sandbox.name]).await; - assert_eq!(code, 0, "sandbox start failed:\n{output}"); - - let marker = sandbox - .exec(&["cat", MARKER_PATH]) - .await - .expect("read workspace marker"); - assert!( - marker.lines().any(|line| line.trim() == MARKER), - "workspace marker should survive the restart:\n{marker}" - ); - let (after, after_index) = sandbox_resource(&sandbox.name).await; - assert_eq!(after["metadata"]["uid"], before["metadata"]["uid"]); - let unchanged = service(&after, "os-boundary").await; - assert_eq!(unchanged["metadata"]["uid"], boundary["metadata"]["uid"]); - assert_eq!( - unchanged["spec"]["clusterIP"], - boundary["spec"]["clusterIP"] - ); - assert_eq!( - unchanged["spec"]["selector"]["openshell.ai/boundary-role"], - "workload" - ); - assert_eq!( - service(&after, "os-supervisor").await["spec"]["selector"]["openshell.ai/boundary-role"], - "supervisor" - ); - assert_eq!( - bootstrap_image(&after, after_index), - bootstrap_image(&before, index) - ); - - sandbox.cleanup().await; -} diff --git a/e2e/rust/tests/workspace_namespace_managed.rs b/e2e/rust/tests/workspace_namespace_managed.rs deleted file mode 100644 index a8f97cf5ef..0000000000 --- a/e2e/rust/tests/workspace_namespace_managed.rs +++ /dev/null @@ -1,878 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -#![cfg(feature = "e2e-kubernetes-workspace-managed")] - -//! E2E tests for managed workspace mode. -//! -//! The gateway is deployed with `workspace_mode = "managed"`, which -//! auto-creates a K8s namespace per workspace (`openshell-{gateway_id}-{ws}`) -//! and deletes it when the last sandbox is removed. -//! -//! Namespace cleanup after sandbox deletion is best-effort and depends on -//! controller finalization timing. These tests focus on verifiable behavior: -//! namespace creation, labels, ServiceAccount and SSH NetworkPolicy -//! provisioning, and sandbox CR placement in the correct namespace. - -use std::process::Stdio; -use std::time::Duration; - -use openshell_e2e::harness::binary::{openshell_bin, openshell_cmd}; -use openshell_e2e::harness::output::strip_ansi; - -const DURABLE_MAIN_SCRIPT: &str = r#"echo "$1"; exec sleep infinity"#; - -fn kube_context() -> String { - std::env::var("OPENSHELL_E2E_KUBE_CONTEXT_ACTIVE") - .expect("OPENSHELL_E2E_KUBE_CONTEXT_ACTIVE must be set") -} - -async fn kubectl(args: &[&str]) -> (bool, String) { - let context = kube_context(); - let output = tokio::process::Command::new("kubectl") - .arg("--context") - .arg(&context) - .args(args) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .output() - .await - .expect("failed to spawn kubectl"); - - let combined = format!( - "{}{}", - String::from_utf8_lossy(&output.stdout), - String::from_utf8_lossy(&output.stderr), - ); - (output.status.success(), combined) -} - -fn managed_namespace(workspace: &str) -> String { - format!("openshell-openshell-{workspace}") -} - -async fn run_cli(args: &[&str]) -> (bool, String) { - let mut cmd = openshell_cmd(); - cmd.args(args).stdout(Stdio::piped()).stderr(Stdio::piped()); - let output = cmd.output().await.expect("failed to spawn openshell"); - let combined = format!( - "{}{}", - String::from_utf8_lossy(&output.stdout), - String::from_utf8_lossy(&output.stderr), - ); - (output.status.success(), strip_ansi(&combined)) -} - -fn unique_workspace(prefix: &str) -> String { - let ts = std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap_or_default() - .as_millis() - % 100_000; - format!("{prefix}-{ts}") -} - -async fn wait_sandbox_gone(workspace: &str, sandbox: &str) { - let deadline = tokio::time::Instant::now() + Duration::from_secs(30); - loop { - let (ok, out) = run_cli(&["sandbox", "list", "--workspace", workspace]).await; - if ok && !out.contains(sandbox) { - return; - } - if tokio::time::Instant::now() >= deadline { - panic!( - "sandbox {sandbox} still listed in workspace {workspace} 30s after delete: {out}" - ); - } - tokio::time::sleep(Duration::from_secs(2)).await; - } -} - -struct ManagedCleanup { - workspace: String, - sandboxes: Vec, -} - -impl Drop for ManagedCleanup { - fn drop(&mut self) { - let bin = openshell_bin(); - for sb in &self.sandboxes { - let _ = std::process::Command::new(&bin) - .args(["sandbox", "delete", sb, "--workspace", &self.workspace]) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .status(); - } - let _ = std::process::Command::new(&bin) - .args(["workspace", "delete", &self.workspace]) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .status(); - let context = std::env::var("OPENSHELL_E2E_KUBE_CONTEXT_ACTIVE").unwrap_or_default(); - if !context.is_empty() { - let ns = managed_namespace(&self.workspace); - let _ = std::process::Command::new("kubectl") - .args([ - "--context", - &context, - "delete", - "namespace", - &ns, - "--ignore-not-found", - "--wait=false", - ]) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .status(); - } - } -} - -#[tokio::test] -async fn managed_creates_namespace_with_labels() { - let ws = unique_workspace("mgd"); - let ns = managed_namespace(&ws); - let _cleanup = ManagedCleanup { - workspace: ws.clone(), - sandboxes: vec!["mgd-sb".into()], - }; - - let (ok, out) = run_cli(&["workspace", "create", "--name", &ws]).await; - assert!(ok, "workspace create failed: {out}"); - - // Create a sandbox — this triggers namespace creation. - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - "mgd-sb", - "--", - "echo", - "managed-ok", - ]) - .await; - assert!(ok, "sandbox create failed: {out}"); - assert!( - out.contains("managed-ok"), - "sandbox output missing expected string: {out}" - ); - - // Verify the managed namespace was created. - let (ok, out) = kubectl(&["get", "namespace", &ns]).await; - assert!(ok, "managed namespace {ns} should exist: {out}"); - - // Verify labels on the namespace. - let (ok, label_out) = - kubectl(&["get", "namespace", &ns, "-o", "jsonpath={.metadata.labels}"]).await; - assert!(ok, "failed to read namespace labels: {label_out}"); - assert!( - label_out.contains("openshell.ai/managed-by"), - "namespace missing managed-by label: {label_out}" - ); - assert!( - label_out.contains("openshell.ai/gateway-id"), - "namespace missing gateway-id label: {label_out}" - ); - - // Verify the ServiceAccount was created in the managed namespace. - let (ok, _) = kubectl(&["get", "serviceaccount", "openshell-sandbox", "-n", &ns]).await; - assert!(ok, "ServiceAccount openshell-sandbox should exist in {ns}"); - - // Each runtime generation gets its own immutable copy of the configured - // image-pull Secret; the configured name is never created in {ns}. - let (ok, staged) = kubectl(&[ - "get", - "secret", - "-n", - &ns, - "-l", - "openshell.ai/component=image-pull", - "-o", - "jsonpath={range .items[*]}{.metadata.name} {.type} {.immutable}{\"\\n\"}{end}", - ]) - .await; - assert!( - ok && staged.contains("os-pull-") && staged.contains("kubernetes.io/dockerconfigjson true"), - "a generation image-pull Secret should exist in {ns}: {staged}" - ); - let (ok, _) = kubectl(&["get", "secret", "e2e-regcred", "-n", &ns]).await; - assert!( - !ok, - "configured image-pull Secret name must not exist in {ns}" - ); - - // Verify SSH ingress is restricted to the gateway peer. Because Kubernetes - // NetworkPolicies are allowlists, the absence of a sandbox peer here - // denies sandbox-to-sandbox TCP 2222 traffic. - let (ok, policy) = kubectl(&[ - "get", - "networkpolicy", - "openshell-sandbox-ssh", - "-n", - &ns, - "-o", - "json", - ]) - .await; - assert!( - ok, - "managed SSH NetworkPolicy should exist in {ns}: {policy}" - ); - let policy: serde_json::Value = - serde_json::from_str(&policy).expect("managed SSH NetworkPolicy should be valid JSON"); - assert_eq!( - policy["spec"]["podSelector"]["matchLabels"]["openshell.ai/managed-by"], - "openshell" - ); - assert_eq!(policy["spec"]["ingress"][0]["ports"][0]["port"], 2222); - assert_eq!( - policy["spec"]["ingress"][0]["from"][0]["namespaceSelector"]["matchLabels"]["kubernetes.io/metadata.name"], - "openshell" - ); - assert!( - policy["spec"]["ingress"][0]["from"][0]["podSelector"]["matchLabels"] - ["app.kubernetes.io/name"] - .is_string(), - "SSH ingress peer must select gateway pods: {policy}" - ); - - // Verify sandbox CR is in the managed namespace (not the gateway namespace). - let (ok, out) = kubectl(&["get", "sandbox.agents.x-k8s.io", "-n", &ns, "-o", "name"]).await; - assert!(ok, "sandbox CR should exist in namespace {ns}: {out}"); - assert!(out.contains("mgd-sb"), "sandbox CR name mismatch: {out}"); - - // Verify the sandbox is resolvable through the OpenShell control plane. - let (ok, out) = run_cli(&["sandbox", "list", "--workspace", &ws]).await; - assert!(ok, "sandbox list failed: {out}"); - assert!( - out.contains("mgd-sb"), - "sandbox list should find mgd-sb via control plane: {out}" - ); - - let (ok, out) = run_cli(&["sandbox", "get", "mgd-sb", "--workspace", &ws]).await; - assert!(ok, "sandbox get failed: {out}"); - assert!( - out.contains("mgd-sb"), - "sandbox get should resolve mgd-sb via control plane: {out}" - ); - - // Verify sandbox delete works through the control plane (uses sandbox_lookup_selector). - let (ok, out) = run_cli(&["sandbox", "delete", "mgd-sb", "--workspace", &ws]).await; - assert!(ok, "sandbox delete failed: {out}"); - - // Wait for the sandbox CR to be fully removed (deletion is asynchronous). - wait_sandbox_gone(&ws, "mgd-sb").await; -} - -#[tokio::test] -async fn managed_namespace_survives_with_remaining_sandboxes() { - let ws = unique_workspace("mgd2"); - let ns = managed_namespace(&ws); - let _cleanup = ManagedCleanup { - workspace: ws.clone(), - sandboxes: vec!["sb-a".into(), "sb-b".into()], - }; - - let (ok, out) = run_cli(&["workspace", "create", "--name", &ws]).await; - assert!(ok, "workspace create failed: {out}"); - - // Create two sandboxes. - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - "sb-a", - "--", - "echo", - "a", - ]) - .await; - assert!(ok, "sandbox sb-a create failed: {out}"); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - "sb-b", - "--", - "echo", - "b", - ]) - .await; - assert!(ok, "sandbox sb-b create failed: {out}"); - - // Delete first sandbox — namespace should survive because sb-b still exists. - let (ok, out) = run_cli(&["sandbox", "delete", "sb-a", "--workspace", &ws]).await; - assert!(ok, "sandbox sb-a delete failed: {out}"); - - // Wait for sb-a to be fully removed before checking namespace state. - wait_sandbox_gone(&ws, "sb-a").await; - - let (ok, _) = kubectl(&["get", "namespace", &ns]).await; - assert!(ok, "managed namespace {ns} should still exist with sb-b"); - - // Verify sb-b's CR is still in the managed namespace. - let (ok, out) = kubectl(&["get", "sandbox.agents.x-k8s.io", "-n", &ns, "-o", "name"]).await; - assert!(ok, "sandbox CRs should still exist in {ns}: {out}"); - assert!( - out.contains("sb-b"), - "sb-b CR should still be present: {out}" - ); - - // Verify sb-b is still resolvable through the OpenShell control plane. - let (ok, out) = run_cli(&["sandbox", "list", "--workspace", &ws]).await; - assert!(ok, "sandbox list failed: {out}"); - assert!( - out.contains("sb-b"), - "sandbox list should find sb-b via control plane: {out}" - ); -} - -#[tokio::test] -async fn managed_isolates_workspaces_into_separate_namespaces() { - let ws_a = unique_workspace("iso-a"); - let ws_b = unique_workspace("iso-b"); - let ns_a = managed_namespace(&ws_a); - let ns_b = managed_namespace(&ws_b); - let _cleanup_a = ManagedCleanup { - workspace: ws_a.clone(), - sandboxes: vec!["sb-iso-a".into()], - }; - let _cleanup_b = ManagedCleanup { - workspace: ws_b.clone(), - sandboxes: vec!["sb-iso-b".into()], - }; - - // Create two workspaces with sandboxes. - let (ok, out) = run_cli(&["workspace", "create", "--name", &ws_a]).await; - assert!(ok, "workspace A create failed: {out}"); - let (ok, out) = run_cli(&["workspace", "create", "--name", &ws_b]).await; - assert!(ok, "workspace B create failed: {out}"); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws_a, - "--name", - "sb-iso-a", - "--", - "echo", - "a", - ]) - .await; - assert!(ok, "sandbox A create failed: {out}"); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws_b, - "--name", - "sb-iso-b", - "--", - "echo", - "b", - ]) - .await; - assert!(ok, "sandbox B create failed: {out}"); - - // Verify each workspace has its own namespace. - assert_ne!(ns_a, ns_b, "namespaces should differ"); - - let (ok, _) = kubectl(&["get", "namespace", &ns_a]).await; - assert!(ok, "namespace {ns_a} should exist"); - let (ok, _) = kubectl(&["get", "namespace", &ns_b]).await; - assert!(ok, "namespace {ns_b} should exist"); - - // Verify sandbox CRs are in the correct namespaces (no cross-contamination). - let (ok, out) = kubectl(&["get", "sandbox.agents.x-k8s.io", "-n", &ns_a, "-o", "name"]).await; - assert!(ok, "failed to list CRs in {ns_a}: {out}"); - assert!(out.contains("sb-iso-a"), "sb-iso-a should be in {ns_a}"); - assert!( - !out.contains("sb-iso-b"), - "sb-iso-b should NOT be in {ns_a}" - ); - - let (ok, out) = kubectl(&["get", "sandbox.agents.x-k8s.io", "-n", &ns_b, "-o", "name"]).await; - assert!(ok, "failed to list CRs in {ns_b}: {out}"); - assert!(out.contains("sb-iso-b"), "sb-iso-b should be in {ns_b}"); - assert!( - !out.contains("sb-iso-a"), - "sb-iso-a should NOT be in {ns_b}" - ); - - // Verify workspace isolation through the OpenShell control plane. - let (ok, out) = run_cli(&["sandbox", "list", "--workspace", &ws_a]).await; - assert!(ok, "sandbox list ws_a failed: {out}"); - assert!( - out.contains("sb-iso-a"), - "sandbox list ws_a should find sb-iso-a: {out}" - ); - assert!( - !out.contains("sb-iso-b"), - "sandbox list ws_a should NOT find sb-iso-b: {out}" - ); - - let (ok, out) = run_cli(&["sandbox", "list", "--workspace", &ws_b]).await; - assert!(ok, "sandbox list ws_b failed: {out}"); - assert!( - out.contains("sb-iso-b"), - "sandbox list ws_b should find sb-iso-b: {out}" - ); - assert!( - !out.contains("sb-iso-a"), - "sandbox list ws_b should NOT find sb-iso-a: {out}" - ); -} - -#[tokio::test] -async fn managed_workspace_delete_removes_namespace() { - let ws = unique_workspace("mgddel"); - let ns = managed_namespace(&ws); - let _cleanup = ManagedCleanup { - workspace: ws.clone(), - sandboxes: vec!["del-sb".into()], - }; - - let (ok, out) = run_cli(&["workspace", "create", "--name", &ws]).await; - assert!(ok, "workspace create failed: {out}"); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - "del-sb", - "--", - "echo", - "del-ok", - ]) - .await; - assert!(ok, "sandbox create failed: {out}"); - assert!( - out.contains("del-ok"), - "sandbox output missing expected string: {out}" - ); - - let (ok, _) = kubectl(&["get", "namespace", &ns]).await; - assert!( - ok, - "managed namespace {ns} should exist after sandbox create" - ); - - let (ok, out) = run_cli(&["sandbox", "delete", "del-sb", "--workspace", &ws]).await; - assert!(ok, "sandbox delete failed: {out}"); - - wait_sandbox_gone(&ws, "del-sb").await; - - let (ok, out) = run_cli(&["workspace", "delete", &ws]).await; - assert!(ok, "workspace delete failed: {out}"); - - let deadline = tokio::time::Instant::now() + Duration::from_secs(30); - loop { - let (exists, _) = kubectl(&["get", "namespace", &ns]).await; - if !exists { - break; - } - if tokio::time::Instant::now() >= deadline { - panic!("managed namespace {ns} still exists 30s after workspace delete"); - } - tokio::time::sleep(Duration::from_secs(2)).await; - } -} - -#[tokio::test] -async fn managed_supervisor_reads_client_tls_from_its_bootstrap_secret() { - let (ok, config_out) = kubectl(&[ - "get", - "configmap", - "openshell-config", - "-n", - "openshell", - "-o", - "jsonpath={.data.gateway\\.toml}", - ]) - .await; - if !ok || !config_out.contains("client_tls_secret_name") { - eprintln!("SKIP: client_tls_secret_name not configured"); - return; - } - - let ws = unique_workspace("mgdtls"); - let ns = managed_namespace(&ws); - let _cleanup = ManagedCleanup { - workspace: ws.clone(), - sandboxes: vec!["tls-sb".into()], - }; - - let (ok, out) = run_cli(&["workspace", "create", "--name", &ws]).await; - assert!(ok, "workspace create failed: {out}"); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - "tls-sb", - "--", - "echo", - "tls-ok", - ]) - .await; - assert!(ok, "sandbox create failed: {out}"); - assert!( - out.contains("tls-ok"), - "sandbox output missing expected string: {out}" - ); - - let (ok, _) = kubectl(&["get", "secret", "openshell-client-tls", "-n", &ns]).await; - assert!( - !ok, - "client TLS Secret must not be copied into managed namespace {ns}" - ); - - let (ok, keys) = kubectl(&[ - "get", - "secret", - "-n", - &ns, - "-l", - "openshell.ai/component=supervisor-bootstrap", - "-o", - "jsonpath={.items[*].data}", - ]) - .await; - assert!( - ok && keys.contains("client-tls.crt") && keys.contains("client-ca.crt"), - "supervisor bootstrap Secret should carry client TLS material: {keys}" - ); -} - -const GATEWAY_SERVICE_ACCOUNT: &str = "system:serviceaccount:openshell:openshell"; - -async fn gateway_can(verb: &str, resource: &str, namespace: &str) -> bool { - let (_, out) = kubectl(&[ - "auth", - "can-i", - verb, - resource, - "-n", - namespace, - "--as", - GATEWAY_SERVICE_ACCOUNT, - ]) - .await; - match out.trim() { - "yes" => true, - "no" => false, - other => panic!("unexpected kubectl auth can-i output for {verb} {resource}: {other}"), - } -} - -#[tokio::test] -async fn managed_gateway_cannot_read_or_modify_workspace_secrets() { - let ns = managed_namespace(&unique_workspace("mgdrbac")); - - for verb in ["get", "patch"] { - assert!( - !gateway_can(verb, "secrets", &ns).await, - "gateway must not {verb} arbitrary Secrets in workspace namespace {ns}" - ); - assert!( - !gateway_can(verb, "secrets/unrelated-secret", &ns).await, - "gateway must not {verb} an unrelated Secret in workspace namespace {ns}" - ); - } - assert!( - !gateway_can("list", "secrets", &ns).await, - "gateway must not list Secrets in workspace namespace {ns}" - ); - for copied in ["secrets/openshell-client-tls", "secrets/e2e-regcred"] { - assert!( - !gateway_can("get", copied, &ns).await, - "gateway must not read {copied} outside its sandbox namespace" - ); - } - assert!( - gateway_can("get", "secrets", "openshell").await, - "gateway must still reach provider credential Secrets in its configured namespace" - ); -} - -#[tokio::test] -async fn managed_rejects_namespace_owned_by_different_gateway() { - let ws = unique_workspace("mgdown"); - let ns = managed_namespace(&ws); - let _cleanup = ManagedCleanup { - workspace: ws.clone(), - sandboxes: vec![], - }; - - let (ok, out) = kubectl(&["create", "namespace", &ns]).await; - assert!(ok, "failed to pre-create namespace {ns}: {out}"); - - let (ok, out) = kubectl(&[ - "label", - "namespace", - &ns, - "openshell.ai/managed-by=openshell", - "openshell.ai/gateway-id=wrong-gateway", - ]) - .await; - assert!(ok, "failed to label namespace: {out}"); - - let (ok, out) = run_cli(&["workspace", "create", "--name", &ws]).await; - assert!(ok, "workspace create failed: {out}"); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - "conflict-sb", - "--", - "echo", - "nope", - ]) - .await; - assert!( - !ok, - "sandbox create should fail for namespace owned by different gateway, but succeeded: {out}" - ); -} - -#[tokio::test] -async fn managed_full_lifecycle_with_multiple_sandboxes() { - let ws = unique_workspace("mgdlc"); - let ns = managed_namespace(&ws); - let _cleanup = ManagedCleanup { - workspace: ws.clone(), - sandboxes: vec!["lc-a".into(), "lc-b".into()], - }; - - let (ok, out) = run_cli(&["workspace", "create", "--name", &ws]).await; - assert!(ok, "workspace create failed: {out}"); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - "lc-a", - "--", - "echo", - "a", - ]) - .await; - assert!(ok, "sandbox lc-a create failed: {out}"); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - "lc-b", - "--", - "echo", - "b", - ]) - .await; - assert!(ok, "sandbox lc-b create failed: {out}"); - - let (ok, _) = kubectl(&["get", "namespace", &ns]).await; - assert!(ok, "managed namespace {ns} should exist"); - - let (ok, out) = run_cli(&["sandbox", "delete", "lc-a", "--workspace", &ws]).await; - assert!(ok, "sandbox lc-a delete failed: {out}"); - - wait_sandbox_gone(&ws, "lc-a").await; - - let (ok, _) = kubectl(&["get", "namespace", &ns]).await; - assert!( - ok, - "managed namespace {ns} should still exist with lc-b remaining" - ); - - let (ok, out) = run_cli(&["sandbox", "delete", "lc-b", "--workspace", &ws]).await; - assert!(ok, "sandbox lc-b delete failed: {out}"); - - wait_sandbox_gone(&ws, "lc-b").await; - - let (ok, out) = run_cli(&["workspace", "delete", &ws]).await; - assert!(ok, "workspace delete failed: {out}"); - - let deadline = tokio::time::Instant::now() + Duration::from_secs(30); - loop { - let (exists, _) = kubectl(&["get", "namespace", &ns]).await; - if !exists { - break; - } - if tokio::time::Instant::now() >= deadline { - panic!("managed namespace {ns} still exists 30s after full lifecycle cleanup"); - } - tokio::time::sleep(Duration::from_secs(2)).await; - } -} - -#[tokio::test] -async fn managed_stop_waits_for_workspace_pod_to_disappear() { - let (ok, sandbox_api_version) = kubectl(&[ - "get", - "crd", - "sandboxes.agents.x-k8s.io", - "-o", - "jsonpath={.spec.versions[?(@.storage==true)].name}", - ]) - .await; - assert!( - ok, - "failed to resolve Sandbox API version: {sandbox_api_version}" - ); - if sandbox_api_version.trim() != "v1alpha1" { - eprintln!("SKIP: legacy pod-disappearance fallback applies only to Sandbox API v1alpha1"); - return; - } - - let ws = unique_workspace("mgdstop"); - let ns = managed_namespace(&ws); - let sandbox = "stop-sb"; - let _cleanup = ManagedCleanup { - workspace: ws.clone(), - sandboxes: vec![sandbox.into()], - }; - - let (ok, out) = run_cli(&["workspace", "create", "--name", &ws]).await; - assert!(ok, "workspace create failed: {out}"); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - sandbox, - "--detach", - "--", - "sh", - "-c", - DURABLE_MAIN_SCRIPT, - "_", - "ready", - ]) - .await; - assert!(ok, "sandbox create failed: {out}"); - - let (ok, pod_name) = kubectl(&[ - "get", - "sandbox", - sandbox, - "-n", - &ns, - "-o", - "jsonpath={.metadata.annotations.agents\\.x-k8s\\.io/pod-name}", - ]) - .await; - assert!(ok, "failed to resolve sandbox pod name: {pod_name}"); - let pod_name = pod_name.trim(); - assert!(!pod_name.is_empty(), "sandbox pod annotation was empty"); - - let (ok, out) = run_cli(&["sandbox", "stop", sandbox, "--workspace", &ws]).await; - assert!(ok, "sandbox stop failed: {out}"); - - let (exists, out) = kubectl(&["get", "pod", pod_name, "-n", &ns]).await; - assert!( - !exists, - "sandbox stop returned before workspace pod {pod_name} disappeared: {out}" - ); -} - -#[tokio::test] -async fn managed_rejects_invalid_dns1123_sandbox_name() { - let ws = unique_workspace("mgddns"); - let _cleanup = ManagedCleanup { - workspace: ws.clone(), - sandboxes: vec![], - }; - - let (ok, out) = run_cli(&["workspace", "create", "--name", &ws]).await; - assert!(ok, "workspace create failed: {out}"); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - "my_bad_name", - "--", - "echo", - "nope", - ]) - .await; - assert!( - !ok, - "sandbox with underscore name should be rejected: {out}" - ); - assert!( - out.contains("lowercase alphanumeric"), - "error should mention character constraint: {out}" - ); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - "MyBadName", - "--", - "echo", - "nope", - ]) - .await; - assert!(!ok, "sandbox with uppercase name should be rejected: {out}"); - assert!( - out.contains("lowercase alphanumeric"), - "error should mention character constraint: {out}" - ); - - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ws, - "--name", - "trailing-", - "--", - "echo", - "nope", - ]) - .await; - assert!( - !ok, - "sandbox with trailing hyphen should be rejected: {out}" - ); - let normalized: String = out - .chars() - .filter(|c| *c != '│') - .collect::() - .split_whitespace() - .collect::>() - .join(" "); - assert!( - normalized.contains("must not start or end with a hyphen"), - "error should mention hyphen constraint: {out}" - ); -} diff --git a/e2e/rust/tests/workspace_namespace_operator.rs b/e2e/rust/tests/workspace_namespace_operator.rs deleted file mode 100644 index 926afa800c..0000000000 --- a/e2e/rust/tests/workspace_namespace_operator.rs +++ /dev/null @@ -1,514 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -#![cfg(feature = "e2e-kubernetes-workspace-operator")] - -//! E2E tests for operator workspace mode. -//! -//! The gateway is deployed with `workspace_mode = "operator"` and -//! `operator_namespace_label = "openshell.ai/e2e-operator-workspace=true"`. -//! Namespaces must be pre-provisioned and labeled before sandbox creation. -//! The gateway discovers valid namespaces via the label selector. - -use std::process::Stdio; -use std::time::Duration; - -use openshell_e2e::harness::binary::{openshell_bin, openshell_cmd}; -use openshell_e2e::harness::output::strip_ansi; - -const OPERATOR_LABEL: &str = "openshell.ai/e2e-operator-workspace=true"; -const SA_NAME: &str = "openshell-sandbox"; - -fn kube_context() -> String { - std::env::var("OPENSHELL_E2E_KUBE_CONTEXT_ACTIVE") - .expect("OPENSHELL_E2E_KUBE_CONTEXT_ACTIVE must be set") -} - -async fn kubectl(args: &[&str]) -> (bool, String) { - let context = kube_context(); - let output = tokio::process::Command::new("kubectl") - .arg("--context") - .arg(&context) - .args(args) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .output() - .await - .expect("failed to spawn kubectl"); - - let combined = format!( - "{}{}", - String::from_utf8_lossy(&output.stdout), - String::from_utf8_lossy(&output.stderr), - ); - (output.status.success(), combined) -} - -async fn run_cli(args: &[&str]) -> (bool, String) { - let mut cmd = openshell_cmd(); - cmd.args(args).stdout(Stdio::piped()).stderr(Stdio::piped()); - let output = cmd.output().await.expect("failed to spawn openshell"); - let combined = format!( - "{}{}", - String::from_utf8_lossy(&output.stdout), - String::from_utf8_lossy(&output.stderr), - ); - (output.status.success(), strip_ansi(&combined)) -} - -fn unique_namespace(prefix: &str) -> String { - let ts = std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap_or_default() - .as_millis() - % 100_000; - format!("{prefix}-{ts}") -} - -async fn wait_sandbox_gone(workspace: &str, sandbox: &str) { - let deadline = tokio::time::Instant::now() + Duration::from_secs(30); - loop { - let (ok, out) = run_cli(&["sandbox", "list", "--workspace", workspace]).await; - if ok && !out.contains(sandbox) { - return; - } - if tokio::time::Instant::now() >= deadline { - panic!( - "sandbox {sandbox} still listed in workspace {workspace} 30s after delete: {out}" - ); - } - tokio::time::sleep(Duration::from_secs(2)).await; - } -} - -async fn provision_operator_namespace(name: &str) { - let (ok, out) = kubectl(&["create", "namespace", name]).await; - assert!(ok, "failed to create namespace {name}: {out}"); - - let (ok, out) = kubectl(&["label", "namespace", name, OPERATOR_LABEL]).await; - assert!(ok, "failed to label namespace {name}: {out}"); - - let (ok, out) = install_workspace_chart(name).await; - assert!(ok, "failed to install workspace chart in {name}: {out}"); -} - -async fn install_workspace_chart(namespace: &str) -> (bool, String) { - let chart = concat!( - env!("CARGO_MANIFEST_DIR"), - "/../../deploy/helm/openshell-workspace" - ); - let output = tokio::process::Command::new("helm") - .args([ - "--kube-context", - &kube_context(), - "install", - "openshell-workspace", - chart, - "--namespace", - namespace, - "--wait", - ]) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .output() - .await - .expect("failed to spawn helm"); - let combined = format!( - "{}{}", - String::from_utf8_lossy(&output.stdout), - String::from_utf8_lossy(&output.stderr), - ); - (output.status.success(), combined) -} - -async fn delete_namespace(name: &str) { - let _ = kubectl(&[ - "delete", - "namespace", - name, - "--ignore-not-found", - "--wait=false", - ]) - .await; -} - -struct OperatorCleanup { - workspace: String, - namespace: String, - sandboxes: Vec, -} - -impl Drop for OperatorCleanup { - fn drop(&mut self) { - let bin = openshell_bin(); - for sb in &self.sandboxes { - let _ = std::process::Command::new(&bin) - .args(["sandbox", "delete", sb, "--workspace", &self.workspace]) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .status(); - } - let _ = std::process::Command::new(&bin) - .args(["workspace", "delete", &self.workspace]) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .status(); - let context = std::env::var("OPENSHELL_E2E_KUBE_CONTEXT_ACTIVE").unwrap_or_default(); - if !context.is_empty() { - let _ = std::process::Command::new("kubectl") - .args([ - "--context", - &context, - "delete", - "namespace", - &self.namespace, - "--ignore-not-found", - "--wait=false", - ]) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .status(); - } - } -} - -const GATEWAY_SERVICE_ACCOUNT: &str = "system:serviceaccount:openshell:openshell"; - -async fn gateway_can(verb: &str, resource: &str, namespace: &str) -> bool { - let (_, out) = kubectl(&[ - "auth", - "can-i", - verb, - resource, - "-n", - namespace, - "--as", - GATEWAY_SERVICE_ACCOUNT, - ]) - .await; - match out.trim() { - "yes" => true, - "no" => false, - other => panic!("unexpected kubectl auth can-i output for {verb} {resource}: {other}"), - } -} - -#[tokio::test] -async fn operator_gateway_has_no_secret_access_without_workspace_chart() { - let ns = unique_namespace("oprbac"); - - for verb in ["get", "list", "create", "patch", "delete"] { - assert!( - !gateway_can(verb, "secrets", &ns).await, - "gateway must not {verb} Secrets in namespace {ns} without the workspace chart" - ); - } - assert!( - !gateway_can("patch", "secrets/openshell-client-tls", &ns).await, - "gateway must not patch the client TLS Secret in namespace {ns} without the workspace chart" - ); -} - -#[tokio::test] -async fn operator_sandbox_in_labeled_namespace() { - let ns = unique_namespace("op"); - let _cleanup = OperatorCleanup { - workspace: ns.clone(), - namespace: ns.clone(), - sandboxes: vec!["op-sb".into()], - }; - - // Pre-provision the namespace with the operator label and ServiceAccount. - provision_operator_namespace(&ns).await; - - // Create a workspace matching the namespace name (operator mode: 1:1 mapping). - let (ok, out) = run_cli(&["workspace", "create", "--name", &ns]).await; - assert!(ok, "workspace create failed: {out}"); - - // Poll until the gateway's namespace watcher discovers the labeled namespace - // and sandbox creation succeeds (up to 30s). - let deadline = tokio::time::Instant::now() + Duration::from_secs(30); - let sandbox_out = loop { - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ns, - "--name", - "op-sb", - "--", - "echo", - "operator-ok", - ]) - .await; - if ok { - break out; - } - if tokio::time::Instant::now() >= deadline { - panic!("sandbox create did not succeed within 30s: {out}"); - } - tokio::time::sleep(Duration::from_secs(2)).await; - }; - assert!( - sandbox_out.contains("operator-ok"), - "sandbox output missing expected string: {sandbox_out}" - ); - - // Verify the sandbox CR lives in the pre-provisioned namespace. - let (ok, out) = kubectl(&["get", "sandbox.agents.x-k8s.io", "-n", &ns, "-o", "name"]).await; - assert!(ok, "sandbox CR should exist in namespace {ns}: {out}"); - assert!( - out.contains("op-sb"), - "sandbox CR name should be bare 'op-sb', got: {out}" - ); - - // Verify sandbox is resolvable through the OpenShell control plane. - let (ok, out) = run_cli(&["sandbox", "list", "--workspace", &ns]).await; - assert!(ok, "sandbox list failed: {out}"); - assert!( - out.contains("op-sb"), - "sandbox list should find op-sb via control plane: {out}" - ); - - let (ok, out) = run_cli(&["sandbox", "get", "op-sb", "--workspace", &ns]).await; - assert!(ok, "sandbox get failed: {out}"); - assert!( - out.contains("op-sb"), - "sandbox get should resolve op-sb via control plane: {out}" - ); - - // Verify sandbox delete works through the control plane. - let (ok, out) = run_cli(&["sandbox", "delete", "op-sb", "--workspace", &ns]).await; - assert!(ok, "sandbox delete failed: {out}"); - - // Wait for the sandbox CR to be fully removed (deletion is asynchronous). - wait_sandbox_gone(&ns, "op-sb").await; - - let (ok, out) = run_cli(&["workspace", "delete", &ns]).await; - assert!(ok, "workspace delete failed: {out}"); - - delete_namespace(&ns).await; -} - -#[tokio::test] -async fn operator_rejects_unlabeled_namespace() { - let ns = unique_namespace("opun"); - let _cleanup = OperatorCleanup { - workspace: ns.clone(), - namespace: ns.clone(), - sandboxes: vec![], - }; - - // Create namespace WITHOUT the operator label. - let (ok, out) = kubectl(&["create", "namespace", &ns]).await; - assert!(ok, "failed to create namespace: {out}"); - - // Create the ServiceAccount (not the label — that's the point). - let (ok, _) = kubectl(&["create", "serviceaccount", SA_NAME, "-n", &ns]).await; - assert!(ok, "failed to create SA"); - - // Create workspace. - let (ok, out) = run_cli(&["workspace", "create", "--name", &ns]).await; - assert!(ok, "workspace create failed: {out}"); - - // Attempt sandbox creation — should fail because namespace is not in the allowlist. - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ns, - "--name", - "should-fail", - "--", - "echo", - "nope", - ]) - .await; - assert!( - !ok, - "sandbox create should fail for unlabeled namespace, but succeeded: {out}" - ); - - // Clean up. - let _ = run_cli(&["workspace", "delete", &ns]).await; - delete_namespace(&ns).await; -} - -#[tokio::test] -async fn operator_rejects_nonexistent_namespace() { - let ns = unique_namespace("opne"); - let _cleanup = OperatorCleanup { - workspace: ns.clone(), - namespace: ns.clone(), - sandboxes: vec![], - }; - - // Create workspace with no matching namespace at all. - let (ok, out) = run_cli(&["workspace", "create", "--name", &ns]).await; - assert!(ok, "workspace create failed: {out}"); - - // Attempt sandbox creation — should fail. - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ns, - "--name", - "should-fail", - "--", - "echo", - "nope", - ]) - .await; - assert!( - !ok, - "sandbox create should fail for nonexistent namespace, but succeeded: {out}" - ); - - // Clean up. - let _ = run_cli(&["workspace", "delete", &ns]).await; -} - -#[tokio::test] -async fn operator_workspace_delete_preserves_namespace() { - let ns = unique_namespace("opdel"); - let _cleanup = OperatorCleanup { - workspace: ns.clone(), - namespace: ns.clone(), - sandboxes: vec!["opdel-sb".into()], - }; - - provision_operator_namespace(&ns).await; - - let (ok, out) = run_cli(&["workspace", "create", "--name", &ns]).await; - assert!(ok, "workspace create failed: {out}"); - - let deadline = tokio::time::Instant::now() + Duration::from_secs(30); - loop { - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ns, - "--name", - "opdel-sb", - "--", - "echo", - "opdel-ok", - ]) - .await; - if ok { - break; - } - if tokio::time::Instant::now() >= deadline { - panic!("sandbox create did not succeed within 30s: {out}"); - } - tokio::time::sleep(Duration::from_secs(2)).await; - } - - let (ok, out) = run_cli(&["sandbox", "delete", "opdel-sb", "--workspace", &ns]).await; - assert!(ok, "sandbox delete failed: {out}"); - - wait_sandbox_gone(&ns, "opdel-sb").await; - - let (ok, out) = run_cli(&["workspace", "delete", &ns]).await; - assert!(ok, "workspace delete failed: {out}"); - - let (ok, out) = kubectl(&["get", "namespace", &ns]).await; - assert!( - ok, - "operator namespace {ns} should still exist after workspace delete: {out}" - ); - - let (ok, label_out) = - kubectl(&["get", "namespace", &ns, "-o", "jsonpath={.metadata.labels}"]).await; - assert!(ok, "failed to read namespace labels: {label_out}"); - assert!( - label_out.contains("openshell.ai/e2e-operator-workspace"), - "operator label should be intact after workspace delete: {label_out}" - ); - - delete_namespace(&ns).await; -} - -#[tokio::test] -async fn operator_label_removal_blocks_sandbox_creation() { - let ns = unique_namespace("oplbl"); - let _cleanup = OperatorCleanup { - workspace: ns.clone(), - namespace: ns.clone(), - sandboxes: vec!["lbl-sb1".into()], - }; - - provision_operator_namespace(&ns).await; - - let (ok, out) = run_cli(&["workspace", "create", "--name", &ns]).await; - assert!(ok, "workspace create failed: {out}"); - - let deadline = tokio::time::Instant::now() + Duration::from_secs(30); - loop { - let (ok, out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ns, - "--name", - "lbl-sb1", - "--", - "echo", - "lbl-ok", - ]) - .await; - if ok { - break; - } - if tokio::time::Instant::now() >= deadline { - panic!("sandbox create did not succeed within 30s: {out}"); - } - tokio::time::sleep(Duration::from_secs(2)).await; - } - - let (ok, out) = run_cli(&["sandbox", "delete", "lbl-sb1", "--workspace", &ns]).await; - assert!(ok, "sandbox lbl-sb1 delete failed: {out}"); - - wait_sandbox_gone(&ns, "lbl-sb1").await; - - let (ok, out) = kubectl(&[ - "label", - "namespace", - &ns, - "openshell.ai/e2e-operator-workspace-", - ]) - .await; - assert!(ok, "failed to remove operator label: {out}"); - - let deadline = tokio::time::Instant::now() + Duration::from_secs(30); - loop { - let (ok, _out) = run_cli(&[ - "sandbox", - "create", - "--workspace", - &ns, - "--name", - "lbl-sb2", - "--", - "echo", - "should-fail", - ]) - .await; - if !ok { - break; - } - // Sandbox was created despite label removal — clean it up and retry. - let _ = run_cli(&["sandbox", "delete", "lbl-sb2", "--workspace", &ns]).await; - if tokio::time::Instant::now() >= deadline { - panic!( - "sandbox creation still succeeds 30s after operator label removal; \ - watcher did not remove namespace from allowlist" - ); - } - tokio::time::sleep(Duration::from_secs(2)).await; - } - - delete_namespace(&ns).await; -} diff --git a/e2e/with-kube-gateway.sh b/e2e/with-kube-gateway.sh index 4611fd137d..6acc23c96d 100755 --- a/e2e/with-kube-gateway.sh +++ b/e2e/with-kube-gateway.sh @@ -114,7 +114,7 @@ PORTFORWARD_HEALTH_LOG="${WORKDIR}/portforward-health.log" HELM_INSTALLED=0 EXTERNAL_PG_FIXTURE_DEPLOYED=0 EXTERNAL_PG_FIXTURE_SECRET="" -EXTERNAL_PG_FIXTURE_MANIFEST="${ROOT}/e2e/kubernetes/postgres-fixture.yaml" +EXTERNAL_PG_FIXTURE_MANIFEST="${ROOT}/tests/support/kube/fixtures/postgres.yaml" EXTERNAL_PG_FIXTURE_SERVICE="openshell-e2e-postgres" EXTERNAL_PG_FIXTURE_USER="openshell" EXTERNAL_PG_FIXTURE_DATABASE="openshell" @@ -479,7 +479,7 @@ deploy_vault_fixture() { helmctl upgrade --install "${VAULT_RELEASE_NAME}" openbao/openbao \ --namespace "${VAULT_NAMESPACE}" --create-namespace \ --version "${VAULT_CHART_VERSION}" \ - --values "${ROOT}/e2e/kubernetes/openbao-tls-values.yaml" \ + --values "${ROOT}/tests/support/kube/fixtures/openbao-values.yaml" \ --set "server.dev.enabled=true" \ --set "server.dev.devRootToken=${VAULT_DEV_ROOT_TOKEN}" \ --set "injector.enabled=false" \ diff --git a/tasks/rust.toml b/tasks/rust.toml index 18a2b7c77a..b24621fa02 100644 --- a/tasks/rust.toml +++ b/tasks/rust.toml @@ -42,6 +42,7 @@ run = [ "cargo clippy --manifest-path tests/suites/conformance/Cargo.toml --workspace --all-targets -- -D warnings", "cargo clippy --manifest-path tests/suites/continuity/Cargo.toml --workspace --all-targets -- -D warnings", "cargo clippy --manifest-path tests/suites/drivers/docker/Cargo.toml --workspace --all-targets -- -D warnings", + "cargo clippy --manifest-path tests/suites/drivers/kubernetes/Cargo.toml --workspace --all-targets -- -D warnings", "cargo clippy --manifest-path tests/suites/drivers/podman/Cargo.toml --workspace --all-targets -- -D warnings", "cargo clippy --manifest-path tests/suites/features/Cargo.toml --workspace --all-targets -- -D warnings", "cargo clippy --manifest-path tests/support/Cargo.toml --all-targets -- -D warnings", @@ -63,6 +64,7 @@ run = [ "cargo fmt --manifest-path tests/suites/conformance/Cargo.toml --all", "cargo fmt --manifest-path tests/suites/continuity/Cargo.toml --all", "cargo fmt --manifest-path tests/suites/drivers/docker/Cargo.toml --all", + "cargo fmt --manifest-path tests/suites/drivers/kubernetes/Cargo.toml --all", "cargo fmt --manifest-path tests/suites/drivers/podman/Cargo.toml --all", "cargo fmt --manifest-path tests/suites/features/Cargo.toml --all", "cargo fmt --manifest-path tests/support/Cargo.toml --all", @@ -83,6 +85,7 @@ run = [ "cargo fmt --manifest-path tests/suites/conformance/Cargo.toml --all -- --check", "cargo fmt --manifest-path tests/suites/continuity/Cargo.toml --all -- --check", "cargo fmt --manifest-path tests/suites/drivers/docker/Cargo.toml --all -- --check", + "cargo fmt --manifest-path tests/suites/drivers/kubernetes/Cargo.toml --all -- --check", "cargo fmt --manifest-path tests/suites/drivers/podman/Cargo.toml --all -- --check", "cargo fmt --manifest-path tests/suites/features/Cargo.toml --all -- --check", "cargo fmt --manifest-path tests/support/Cargo.toml --all -- --check", diff --git a/tasks/scripts/check_cargo_lockfile_alignment.py b/tasks/scripts/check_cargo_lockfile_alignment.py index 073a98dfdc..0ffe42b83d 100644 --- a/tasks/scripts/check_cargo_lockfile_alignment.py +++ b/tasks/scripts/check_cargo_lockfile_alignment.py @@ -40,6 +40,7 @@ "tests/suites/conformance", "tests/suites/continuity", "tests/suites/drivers/docker", + "tests/suites/drivers/kubernetes", "tests/suites/drivers/podman", "tests/suites/features", ) diff --git a/tasks/scripts/run-postgres-tests.sh b/tasks/scripts/run-postgres-tests.sh index 06464f6492..b1850e788c 100755 --- a/tasks/scripts/run-postgres-tests.sh +++ b/tasks/scripts/run-postgres-tests.sh @@ -19,7 +19,7 @@ set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "${ROOT}" -# Same pinned image as the Kubernetes e2e fixture (e2e/kubernetes/postgres-fixture.yaml). +# Same pinned image as the Kubernetes e2e fixture (tests/support/kube/fixtures/postgres.yaml). POSTGRES_IMAGE="${OPENSHELL_TEST_POSTGRES_IMAGE:-mirror.gcr.io/library/postgres:17.10-alpine3.23@sha256:979c4379dd698aba0b890599a6104e082035f98ef31d9b9291ec22f2b13059ca}" CONTAINER_NAME="" diff --git a/tasks/test.toml b/tasks/test.toml index ca254eec4d..33050a3545 100644 --- a/tasks/test.toml +++ b/tasks/test.toml @@ -290,16 +290,6 @@ description = "Run the Kubernetes HA rebalancing suite through Envoy against two env = { OPENSHELL_E2E_KUBE_EXTERNAL_POSTGRES_SECRET = "openshell-ha-pg", OPENSHELL_E2E_KUBE_EXTRA_VALUES = "deploy/helm/openshell/ci/values-high-availability.yaml", OPENSHELL_E2E_KUBE_TEST = "kubernetes_ha_rebalancing", OPENSHELL_E2E_KUBERNETES_FEATURES = "e2e,e2e-host-gateway,e2e-kubernetes,e2e-kubernetes-ha", OPENSHELL_E2E_KUBE_USE_ENVOY = "1" } run = "e2e/rust/e2e-kubernetes.sh" -["e2e:kubernetes:credential-drivers"] -description = "Run Kubernetes e2e for provider credential storage backed by Kubernetes Secrets and Vault" -env = { OPENSHELL_E2E_CREDENTIAL_DRIVERS = "1", OPENSHELL_E2E_KUBE_TEST = "credential_drivers", OPENSHELL_E2E_KUBERNETES_FEATURES = "e2e,e2e-kubernetes,e2e-kubernetes-credential-drivers" } -run = "e2e/rust/e2e-kubernetes.sh" - -["e2e:kubernetes:workspace-managed"] -description = "Run Kubernetes e2e with managed workspace mode (auto-created per-workspace namespaces)" -env = { OPENSHELL_E2E_CREDENTIAL_DRIVERS = "1", OPENSHELL_E2E_CREDENTIAL_DRIVER = "kubernetes-secrets", OPENSHELL_E2E_KUBE_EXTRA_VALUES = "deploy/helm/openshell/ci/values-workspace-managed.yaml", OPENSHELL_E2E_KUBE_IMAGE_PULL_SECRET = "e2e-regcred", OPENSHELL_E2E_KUBE_TEST = "workspace_namespace_managed", OPENSHELL_E2E_KUBERNETES_FEATURES = "e2e,e2e-kubernetes,e2e-kubernetes-workspace-managed" } -run = "e2e/rust/e2e-kubernetes.sh" - ["e2e:kubernetes:app-listener"] description = "Deploy an isolated Helm release and verify application ingress, isolation, freshness, and supervisor ownership" run = [ @@ -343,11 +333,6 @@ description = "Run node-local SPIFFE Broker coverage with gateway relocation acr env = { HELM_K3S_AGENT_COUNT = "2", OPENSHELL_E2E_SPIRE_MIN_AGENTS = "3", OPENSHELL_E2E_KUBE_SPIRE_NODE_LOCAL = "1", OPENSHELL_E2E_KUBE_EXTERNAL_POSTGRES_SECRET = "e2e-spiffe-postgres", OPENSHELL_E2E_KUBE_SPIRE_BROKER = "1", OPENSHELL_E2E_KUBE_TLS = "1", OPENSHELL_E2E_KUBE_TEST = "kubernetes_shared_supervisor_spiffe", OPENSHELL_E2E_KUBERNETES_FEATURES = "e2e,e2e-host-gateway,e2e-kubernetes,e2e-kubernetes-shared-supervisor-spiffe" } run = 'OPENSHELL_E2E_KUBE_EXTRA_VALUES="deploy/helm/openshell/ci/values-supervisor-spiffe-node-local.yaml:deploy/helm/openshell/ci/values-tls-port-forward.yaml${OPENSHELL_E2E_KUBE_EXTRA_VALUES:+:$OPENSHELL_E2E_KUBE_EXTRA_VALUES}" e2e/rust/e2e-kubernetes.sh' -["e2e:kubernetes:workspace-operator"] -description = "Run Kubernetes e2e with operator workspace mode (pre-provisioned per-workspace namespaces)" -env = { OPENSHELL_E2E_KUBE_EXTRA_VALUES = "deploy/helm/openshell/ci/values-workspace-operator.yaml", OPENSHELL_E2E_KUBE_TEST = "workspace_namespace_operator", OPENSHELL_E2E_KUBERNETES_FEATURES = "e2e,e2e-kubernetes,e2e-kubernetes-workspace-operator" } -run = "e2e/rust/e2e-kubernetes.sh" - ["e2e:kubernetes:tracing"] description = "Run Kubernetes e2e with a Jaeger collector and verify it receives gateway and Kubernetes compute-driver spans" env = { OPENSHELL_E2E_KUBE_CONFORMANCE = "0", OPENSHELL_E2E_KUBE_JAEGER = "1", OPENSHELL_E2E_KUBE_TEST = "kubernetes_tracing", OPENSHELL_E2E_KUBERNETES_FEATURES = "e2e,e2e-kubernetes,e2e-kubernetes-tracing" } diff --git a/tests/suites/conformance/src/cli.rs b/tests/suites/conformance/src/cli.rs index 9f87643763..1339000baa 100644 --- a/tests/suites/conformance/src/cli.rs +++ b/tests/suites/conformance/src/cli.rs @@ -187,6 +187,35 @@ async fn cli_no_keep_removes_sandbox_after_main_exit(cx: &mut Context) -> testki Ok(()) } +/// `sandbox create` rejects a name that isn't a DNS-1123 label: one with an +/// underscore or an uppercase letter, or one ending in a hyphen. +#[testkit::test] +async fn cli_create_rejects_invalid_sandbox_names(cx: &mut Context) -> testkit::Result { + let run_id = cx.run_id().to_string(); + for (name, expected) in [ + (format!("bad_{run_id}"), "lowercase alphanumeric"), + (format!("Bad{run_id}"), "lowercase alphanumeric"), + ( + format!("bad-{run_id}-"), + "must not start or end with a hyphen", + ), + ] { + let output = cx + .cli([ + "sandbox", "create", "--name", &name, "--no-tty", "--", "echo", "nope", + ]) + .await? + .failure()?; + testkit::ensure!( + output.report_text().contains(expected), + "`{}` should report {expected:?}: {}", + output.command, + output.output() + ); + } + Ok(()) +} + /// Fail unless the CLI printed `marker` from the main process. fn expect_streamed(output: &testkit::CliOutput, marker: &str) -> testkit::Result { testkit::ensure!( diff --git a/tests/suites/drivers/kubernetes/Cargo.lock b/tests/suites/drivers/kubernetes/Cargo.lock new file mode 100644 index 0000000000..8661e5f036 --- /dev/null +++ b/tests/suites/drivers/kubernetes/Cargo.lock @@ -0,0 +1,5042 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "annotate-snippets" +version = "0.12.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0258346f92c78dbc5b336b9a5b27c64447aa10643bc64e651db2edb145361564" +dependencies = [ + "anstyle", + "memchr", + "unicode-width 0.2.2", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "arraydeque" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" + +[[package]] +name = "asn1-rs" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f43a50ac4fdca5df8e885c21b835997f0a1cdee65494a6847694a98652d9d8" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror 2.0.20", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3109e49b1e4909e9db6515a30c633684d68cdeaa252f215214cb4fa1a5bfee2c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "aws-lc-rs" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2b2dcc879c3bae0d371e77c99f2238400ef24ec001394befa67b6e543add9e" +dependencies = [ + "aws-lc-sys", + "untrusted 0.7.1", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f09fae7be8bb3174e05c6afdb34199e6dc0c7c04ba9fa237b1967adfbde27483" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", + "pkg-config", +] + +[[package]] +name = "axum" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90" +dependencies = [ + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", +] + +[[package]] +name = "backon" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cffb0e931875b666fc4fcb20fee52e9bbd1ef836fd9e9e04ec21555f9f85f7ef" +dependencies = [ + "fastrand", + "gloo-timers", + "tokio", +] + +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +dependencies = [ + "serde_core", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cc" +version = "1.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "cmake" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" +dependencies = [ + "cc", +] + +[[package]] +name = "cmov" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "const-oid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a" + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "credential-drivers" +version = "0.0.0" +dependencies = [ + "kube-support", + "openshell-crypto", + "openshell-testkit", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "ctutils" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261af4dc7a06ea8a527a8717d8cbba3417530d6ea14e1edb3de6b67806be474f" +dependencies = [ + "cmov", +] + +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.5", +] + +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "data-encoding" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" + +[[package]] +name = "defmt" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a0795ac740cb54d7b3775c9c17345f6aaecf884c01733b39d6017738e0e3e1" +dependencies = [ + "bitflags 1.3.2", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "840bb056bd99c495c9188198a258ab787c79f306d864db3e6e8451442d6d8366" +dependencies = [ + "defmt-parser", + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "defmt-parser" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71958f69fb2de856c5dd51ac9377e986ca1aa5919f931bf5395a807277f889a0" +dependencies = [ + "thiserror 2.0.20", +] + +[[package]] +name = "der-parser" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07da5016415d5a3c4dd39b11ed26f915f52fc4e0dc197d87908bc916e51bc1a6" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.117", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common 0.1.7", +] + +[[package]] +name = "digest" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4850db49bf08e663084f7fb5c87d202ef91a3907271aff24a94eb97ff039153c" +dependencies = [ + "block-buffer 0.12.0", + "const-oid", + "crypto-common 0.2.2", + "ctutils", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "educe" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00371d2607edea062396ef1ce6ade65c8e915ac7a1277daa198208420f682c6" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" +dependencies = [ + "serde", +] + +[[package]] +name = "encoding_rs" +version = "0.8.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", +] + +[[package]] +name = "encoding_rs_io" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba3fe847045ecff794b9c138293a80db914678c453ad63fbf0c6a9eb6e00b22" +dependencies = [ + "encoding_rs", +] + +[[package]] +name = "enum-ordinalize" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89dd01549b09589510cf0647475075d12071456586d70f5c75c98ae2a5537677" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a65863d15a4ce2888bd2f0f543cc963d3879c3a022c8ee43f6141d479a3ac815" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "escape8259" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f0d310082fd5de539d4f41601182241147498444a7695c520288a0cdbead6" + +[[package]] +name = "etcetera" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de48cc4d1c1d97a20fd819def54b890cadde72ed3ad0c614822a0a433361be96" +dependencies = [ + "cfg-if", + "windows-sys 0.61.2", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + +[[package]] +name = "flume" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be" +dependencies = [ + "futures-core", + "futures-sink", + "spin", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "form_urlencoded" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "futures" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api 0.4.14", + "parking_lot 0.12.5", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasip2", + "wasip3", +] + +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "gloo-timers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "granit-parser" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f05586d4d4df3d47123207826c40b252728b438a1a07bad3c01ee6bea401df" +dependencies = [ + "arraydeque", + "smallvec", +] + +[[package]] +name = "h2" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8e5e5a340588f4452631496976cf8636d4a7ecf600239fdc27615d2530bc16" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + +[[package]] +name = "hashlink" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824e001ac4f3012dd16a264bec811403a67ca9deb6c102fc5049b32c4574b35f" +dependencies = [ + "hashbrown 0.16.1", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hickory-proto" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e2da0694c15b44c6f68a6b05e0233617008c54080e31d6eb848d858a9c5b38d" +dependencies = [ + "data-encoding", + "idna", + "ipnet", + "jni", + "once_cell", + "rand 0.10.2", + "ring", + "thiserror 2.0.20", + "tinyvec", + "tracing", + "url", +] + +[[package]] +name = "hkdf" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aaa26c720c68b866f2c96ef5c1264b3e6f473fe5d4ce61cd44bbe913e553018" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" +dependencies = [ + "digest 0.11.2", +] + +[[package]] +name = "hostname" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617aaa3557aef3810a6369d0a99fac8a080891b68bd9f9812a1eeda0c0730cbd" +dependencies = [ + "cfg-if", + "libc", + "windows-link", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hybrid-array" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707114b52a152fa7bdb290cd7cd5912d9467273b6d74e21b8d81aca1f8533f6b" +dependencies = [ + "typenum", +] + +[[package]] +name = "hyper" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-timeout" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +dependencies = [ + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.0", + "serde", + "serde_core", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "iri-string" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jiff" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b005715dcbeb0089a3c0dab99f2ff1cc3b2525323552703d648585d342a383" +dependencies = [ + "defmt", + "jiff-core 0.1.8", + "jiff-static 0.2.38", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e77cbfb9fff4798e283c2d69dff39fc2c45e7da017e5ce95b654e46ea41236" +dependencies = [ + "jiff-core 1.0.1", + "jiff-static 1.0.2", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e599b80292e597019b8b3e392de3f4bea2959ddfb8c7dff60e035e9e311a2c1b" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-core" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cc9817253cf7c7ee4684451bd327e88d6f3658014e54a29198625590650695c" +dependencies = [ + "jiff-core 0.1.8", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "jiff-static" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9067a0b23e5be3147d56b2dcf652b18e6b1364caca93fb157653b6fbcab23a9" +dependencies = [ + "jiff-core 1.0.1", + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys", + "log", + "simd_cesu8", + "thiserror 2.0.20", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.117", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.117", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce57d20d1ea864ce2ac172ab472d409214f4fd359f0b2a2775abdf522e2af99e" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "json-patch" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7421438de105a0827e44fadd05377727847d717c80ce29a229f85fd04c427b72" +dependencies = [ + "jsonptr", + "serde", + "serde_json", + "thiserror 2.0.20", +] + +[[package]] +name = "jsonpath-rust" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83bc96c838e7a3de9dc89ea291363ac073371959637e3b2207556e9320547b8" +dependencies = [ + "pest", + "pest_derive", + "regex", + "serde_json", + "thiserror 2.0.20", +] + +[[package]] +name = "jsonptr" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5a3cc660ba5d72bce0b3bb295bf20847ccbb40fd423f3f05b61273672e561fe" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "jsonwebtoken" +version = "10.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0529410abe238729a60b108898784df8984c87f6054c9c4fcacc47e4803c1ce1" +dependencies = [ + "aws-lc-rs", + "base64 0.22.1", + "getrandom 0.2.17", + "js-sys", + "pem 3.0.6", + "serde", + "serde_json", + "signature", + "simple_asn1", +] + +[[package]] +name = "k8s-openapi" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab0d13801242174b1f3966907c3f32039f2d6b36c7ce82c61225d66ed5d1eb70" +dependencies = [ + "base64 0.22.1", + "jiff 0.2.38", + "serde", + "serde_json", +] + +[[package]] +name = "kube" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f95e1a9107878bef32cfbe2e5e084584db832c9616df9981adc4673f9fb1c853" +dependencies = [ + "k8s-openapi", + "kube-client", + "kube-core", + "kube-derive", + "kube-runtime", +] + +[[package]] +name = "kube-client" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703ee17477c86501627e83492895c06ab6fc2c55a319bb2fbc582ccae739ba67" +dependencies = [ + "base64 0.23.1", + "bytes", + "either", + "futures", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-timeout", + "hyper-util", + "jiff 0.2.38", + "jsonpath-rust", + "k8s-openapi", + "kube-core", + "pem 4.0.0", + "percent-encoding", + "rustls", + "rustls-platform-verifier", + "secrecy", + "serde", + "serde-saphyr", + "serde_json", + "thiserror 2.0.20", + "tokio", + "tokio-tungstenite 0.30.0", + "tokio-util", + "tower", + "tower-http 0.7.1", + "tracing", +] + +[[package]] +name = "kube-core" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e9a9aa533b2f4106ac1ac45e168bb452325eb9e918d57335444f60bef34ffc" +dependencies = [ + "derive_more", + "form_urlencoded", + "http", + "jiff 0.2.38", + "json-patch", + "k8s-openapi", + "schemars", + "serde", + "serde-value", + "serde_json", + "thiserror 2.0.20", +] + +[[package]] +name = "kube-derive" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cedc991dbe7757a646098dead35e070e13ce66e2996b02162ac7f97eb97f4d6e" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn 3.0.5", +] + +[[package]] +name = "kube-runtime" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca78d9eeb4674eb75e381e6a956e8a5005942928dec87de4db9ef9701af8a637" +dependencies = [ + "ahash", + "async-broadcast", + "async-stream", + "backon", + "educe", + "futures", + "hashbrown 0.16.1", + "hostname", + "json-patch", + "k8s-openapi", + "kube-client", + "parking_lot 0.13.0", + "pin-project", + "serde", + "serde_json", + "thiserror 2.0.20", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "kube-support" +version = "0.0.0" +dependencies = [ + "k8s-openapi", + "kube", + "openshell-crypto", + "openshell-testkit", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f02ab6bace2054fb888a3c16f990117b579d14a3088e472d63c6011fa185c9d3" +dependencies = [ + "libc", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0e7f1cd558a82cc3af091ed13f0f03846f89851c60a10713ce5cfd484195494" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libtest-mimic" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14e6ba06f0ade6e504aff834d7c34298e5155c6baca353cc6a4aaff2f9fd7f33" +dependencies = [ + "anstream", + "anstyle", + "clap", + "escape8259", +] + +[[package]] +name = "linkme" +version = "0.3.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a4e12fd3f6b22d5bc28beccac0f53bb35db4a897c6ddb709c4a0161f72eb6e" +dependencies = [ + "linkme-impl", +] + +[[package]] +name = "linkme-impl" +version = "0.3.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cd04c256b1cd686a45898c8fd150c79b801d96a3eb7bae1075f9eb3b4b85c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "lock_api" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65d91b22da179613dcf4d6ec8349563f52a363f6849e03b00dd0a185ec4a59af" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + +[[package]] +name = "md-5" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69b6441f590336821bb897fb28fc622898ccceb1d6cea3fde5ea86b090c4de98" +dependencies = [ + "cfg-if", + "digest 0.11.2", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "miette" +version = "7.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f98efec8807c63c752b5bd61f862c165c115b0a35685bdcfd9238c7aeb592b7" +dependencies = [ + "backtrace", + "backtrace-ext", + "cfg-if", + "miette-derive", + "owo-colors", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "terminal_size", + "textwrap", + "unicode-width 0.1.14", +] + +[[package]] +name = "miette-derive" +version = "7.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db5b29714e950dbb20d5e6f74f9dcec4edbcc1067bb7f8ed198c097b8c1a818b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "multimap" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "newtype-uuid" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa56da58097c7ae893c4097bb6d91bb5f7fa330053e07e033349db4d5f83ba8" +dependencies = [ + "uuid", +] + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "noyalib" +version = "0.0.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "962838abbd8dd2cd3844d2208dc502458bba6985f8bf1dc21761b30260fcbd7f" +dependencies = [ + "hashbrown 0.17.0", + "indexmap", + "libm", + "memchr", + "rustc-hash", + "serde_core", + "smallvec", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "oauth2" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51e219e79014df21a225b1860a479e2dcd7cbd9130f4defd4bd0e191ea31d67d" +dependencies = [ + "base64 0.22.1", + "chrono", + "getrandom 0.2.17", + "http", + "rand 0.8.6", + "reqwest", + "serde", + "serde_json", + "serde_path_to_error", + "sha2 0.10.9", + "thiserror 1.0.69", + "url", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "objc2-system-configuration" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7216bd11cbda54ccabcab84d523dc93b858ec75ecfb3a7d89513fa22464da396" +dependencies = [ + "objc2-core-foundation", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + +[[package]] +name = "oid-registry" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f40cff3dde1b6087cc5d5f5d4d65712f34016a03ed60e9c08dcc392736b5b7" +dependencies = [ + "asn1-rs", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +dependencies = [ + "critical-section", + "portable-atomic", +] + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "openshell-bootstrap" +version = "0.0.0" +dependencies = [ + "bytes", + "miette", + "openshell-core", + "openshell-crypto", + "rcgen", + "serde", + "serde_json", + "tempfile", + "tokio", + "tracing", +] + +[[package]] +name = "openshell-core" +version = "0.0.0" +dependencies = [ + "async-trait", + "base64 0.22.1", + "glob", + "ipnet", + "jiff 1.0.2", + "libc", + "miette", + "nix", + "openshell-crypto", + "openshell-extension-core", + "openshell-policy-schema", + "openshell-spiffe", + "prost", + "prost-types", + "protoc-bin-vendored", + "reqwest", + "rustix", + "rustls", + "serde", + "serde_json", + "sha2 0.10.9", + "thiserror 2.0.20", + "tokio", + "tokio-stream", + "tokio-util", + "tonic", + "tonic-prost", + "tonic-prost-build", + "tonic-types", + "tracing", + "url", + "uuid", + "windows-sys 0.61.2", +] + +[[package]] +name = "openshell-crypto" +version = "0.0.0" +dependencies = [ + "aws-lc-rs", + "jsonwebtoken", + "kube", + "pem 3.0.6", + "rcgen", + "rustls", + "serde", + "sqlx", + "thiserror 2.0.20", + "tonic", + "x509-parser", +] + +[[package]] +name = "openshell-extension-core" +version = "0.0.0" +dependencies = [ + "h2", + "hyper", + "hyper-util", + "serde", + "thiserror 2.0.20", + "tokio", + "tonic", + "tower", +] + +[[package]] +name = "openshell-policy" +version = "0.0.0" +dependencies = [ + "hickory-proto", + "miette", + "openshell-core", + "openshell-policy-schema", + "prost", + "prost-types", + "serde", + "serde_json", +] + +[[package]] +name = "openshell-policy-schema" +version = "0.0.0" +dependencies = [ + "miette", + "noyalib", + "serde", + "serde_json", + "serde_path_to_error", + "thiserror 2.0.20", +] + +[[package]] +name = "openshell-providers" +version = "0.0.0" +dependencies = [ + "glob", + "noyalib", + "openshell-core", + "openshell-policy", + "prost-types", + "serde", + "serde_json", + "thiserror 2.0.20", + "url", +] + +[[package]] +name = "openshell-sdk" +version = "0.0.0" +dependencies = [ + "async-stream", + "async-trait", + "futures", + "hyper", + "hyper-util", + "miette", + "oauth2", + "openshell-core", + "openshell-crypto", + "reqwest", + "rustls", + "serde", + "thiserror 2.0.20", + "tokio", + "tokio-rustls", + "tokio-tungstenite 0.26.2", + "tonic", + "tower", + "tracing", +] + +[[package]] +name = "openshell-spiffe" +version = "0.0.0" +dependencies = [ + "async-trait", + "base64 0.22.1", + "serde", + "serde_json", + "thiserror 2.0.20", +] + +[[package]] +name = "openshell-testkit" +version = "0.0.0" +dependencies = [ + "clap", + "futures", + "libc", + "libtest-mimic", + "linkme", + "noyalib", + "openshell-bootstrap", + "openshell-core", + "openshell-crypto", + "openshell-policy", + "openshell-providers", + "openshell-sdk", + "openshell-testkit-macros", + "prost-types", + "quick-junit", + "rand 0.9.4", + "reqwest", + "rustls", + "rustls-native-certs", + "serde", + "serde_json", + "tempfile", + "tokio", + "tonic", +] + +[[package]] +name = "openshell-testkit-macros" +version = "0.0.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "owo-colors" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d211803b9b6b570f68772237e415a029d5a50c65d382910b879fb19d3271f94d" + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api 0.4.14", + "parking_lot_core 0.9.12", +] + +[[package]] +name = "parking_lot" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9cf937ca4e1d0b7578784559063422fc39ae7c5a00f02471f2614d5486fd226" +dependencies = [ + "lock_api 0.5.0", + "parking_lot_core 0.10.0", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "parking_lot_core" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cfff060068cc18aa7815010fcaf80c68c7fb9e85fc7f5c0f9bf142c21d19826" +dependencies = [ + "libc", + "redox_syscall 0.9.5", + "smallvec", + "windows-link", +] + +[[package]] +name = "pem" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" +dependencies = [ + "base64 0.22.1", + "serde_core", +] + +[[package]] +name = "pem" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d354a98a3d1251555de99e8fdd8afda05573c31b82f59063a7b0a29b5527f120" +dependencies = [ + "base64 0.23.1", + "serde_core", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pest" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662" +dependencies = [ + "memchr", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11f486f1ea21e6c10ed15d5a7c77165d0ee443402f0780849d1768e7d9d6fe77" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8040c4647b13b210a963c1ed407c1ff4fdfa01c31d6d2a098218702e6664f94f" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "pest_meta" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220" +dependencies = [ + "pest", + "sha2 0.10.9", +] + +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset", + "hashbrown 0.15.5", + "indexmap", +] + +[[package]] +name = "pin-project" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "portable-atomic" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.117", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ea70524a2f82d518bce41317d0fae74151505651af45faf1ffbd6fd33f0568" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7" +dependencies = [ + "heck", + "itertools", + "log", + "multimap", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "pulldown-cmark", + "pulldown-cmark-to-cmark", + "regex", + "syn 2.0.117", + "tempfile", +] + +[[package]] +name = "prost-derive" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "prost-types" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8991c4cbdb8bc5b11f0b074ffe286c30e523de90fee5ba8132f1399f23cb3dd7" +dependencies = [ + "prost", +] + +[[package]] +name = "protoc-bin-vendored" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1c381df33c98266b5f08186583660090a4ffa0889e76c7e9a5e175f645a67fa" +dependencies = [ + "protoc-bin-vendored-linux-aarch_64", + "protoc-bin-vendored-linux-ppcle_64", + "protoc-bin-vendored-linux-s390_64", + "protoc-bin-vendored-linux-x86_32", + "protoc-bin-vendored-linux-x86_64", + "protoc-bin-vendored-macos-aarch_64", + "protoc-bin-vendored-macos-x86_64", + "protoc-bin-vendored-win32", +] + +[[package]] +name = "protoc-bin-vendored-linux-aarch_64" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c350df4d49b5b9e3ca79f7e646fde2377b199e13cfa87320308397e1f37e1a4c" + +[[package]] +name = "protoc-bin-vendored-linux-ppcle_64" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55a63e6c7244f19b5c6393f025017eb5d793fd5467823a099740a7a4222440c" + +[[package]] +name = "protoc-bin-vendored-linux-s390_64" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dba5565db4288e935d5330a07c264a4ee8e4a5b4a4e6f4e83fad824cc32f3b0" + +[[package]] +name = "protoc-bin-vendored-linux-x86_32" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8854774b24ee28b7868cd71dccaae8e02a2365e67a4a87a6cd11ee6cdbdf9cf5" + +[[package]] +name = "protoc-bin-vendored-linux-x86_64" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b38b07546580df720fa464ce124c4b03630a6fb83e05c336fea2a241df7e5d78" + +[[package]] +name = "protoc-bin-vendored-macos-aarch_64" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89278a9926ce312e51f1d999fee8825d324d603213344a9a706daa009f1d8092" + +[[package]] +name = "protoc-bin-vendored-macos-x86_64" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81745feda7ccfb9471d7a4de888f0652e806d5795b61480605d4943176299756" + +[[package]] +name = "protoc-bin-vendored-win32" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95067976aca6421a523e491fce939a3e65249bac4b977adee0ee9771568e8aa3" + +[[package]] +name = "pulldown-cmark" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db2be46835f013dd3f4fa7f5f7402c537787b54ebb6fe2b94bbdd7e2669bb7b" +dependencies = [ + "bitflags 2.13.2", + "memchr", + "unicase", +] + +[[package]] +name = "pulldown-cmark-to-cmark" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50793def1b900256624a709439404384204a5dc3a6ec580281bfaac35e882e90" +dependencies = [ + "pulldown-cmark", +] + +[[package]] +name = "quick-junit" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bae23b8e1a59a90f7bf98caa2f4c8c2eedf6df011c6c88ed633e85a87c84526e" +dependencies = [ + "chrono", + "indexmap", + "newtype-uuid", + "quick-xml", + "strip-ansi-escapes", + "thiserror 2.0.20", + "uuid", +] + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" +dependencies = [ + "chacha20", + "getrandom 0.4.2", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rcgen" +version = "0.14.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8774e05a7d0de114588e6a28fe7e71694b82614ed569d86d8b389dfbc98b8ad8" +dependencies = [ + "aws-lc-rs", + "pem 4.0.0", + "rustls-pki-types", + "time", + "x509-parser", + "yasna", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "regex" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-native-certs", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http 0.6.8", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted 0.9.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "runtime" +version = "0.0.0" +dependencies = [ + "kube-support", + "openshell-testkit", + "serde_json", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + +[[package]] +name = "rustix" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98" +dependencies = [ + "core-foundation", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f" + +[[package]] +name = "rustls-webpki" +version = "0.103.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted 0.9.0", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" +dependencies = [ + "dyn-clone", + "ref-cast", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1c3a92094fa7d61aa124645844facb6b554dfc797136d0f5fd1f890e2bffc69" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 3.0.5", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "secrecy" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e891af845473308773346dc847b2c23ee78fe442e0472ac50e22a18a93d3ae5a" +dependencies = [ + "zeroize", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.13.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-saphyr" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d43fb82d550b07e6f929a58d7d0935182602f48ddead875f5ee313c41c8f07fe" +dependencies = [ + "annotate-snippets", + "base64 0.23.1", + "encoding_rs_io", + "granit-parser", + "nohash-hasher", + "num-traits", + "serde_core", + "smallvec", + "zmij", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "serde_derive_internals" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha1" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "digest 0.11.2", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "digest 0.11.2", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "simple_asn1" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d585997b0ac10be3c5ee635f1bab02d512760d14b7c468801ac8a01d9ae5f1d" +dependencies = [ + "num-bigint", + "num-traits", + "thiserror 2.0.20", + "time", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spin" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" +dependencies = [ + "lock_api 0.4.14", +] + +[[package]] +name = "sqlx" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb1dddfbdfe5fb99dba0541a87b2edb8adbd59e45815db22d32d4fbbb8813dd" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08f9787cc5aff062567dea2205f8ae37a617b04342633ab4f74944858ea6072" +dependencies = [ + "base64 0.22.1", + "bytes", + "cfg-if", + "crc", + "crossbeam-queue", + "either", + "event-listener", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashbrown 0.16.1", + "hashlink", + "indexmap", + "log", + "memchr", + "percent-encoding", + "rustls", + "serde", + "serde_json", + "sha2 0.11.0", + "smallvec", + "thiserror 2.0.20", + "tokio", + "tokio-stream", + "tracing", + "url", + "webpki-roots", +] + +[[package]] +name = "sqlx-macros" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf62c58a1e7fd6031ee684eee21d07572f5aebe71c273a01ae4f04eeeba47c47" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 2.0.117", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ff75c9d609ac84aa8a3e0d92b5c0c54bf541a7f70db492fb40c9a4bea792c8" +dependencies = [ + "cfg-if", + "dotenvy", + "either", + "heck", + "hex", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2 0.11.0", + "sqlx-core", + "sqlx-postgres", + "sqlx-sqlite", + "syn 2.0.117", + "thiserror 2.0.20", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19eeb93b96eb10a3a59dfb436f3daf87d2fc41168ed9e9dc153ec8257dd6a761" +dependencies = [ + "bitflags 2.13.2", + "byteorder", + "bytes", + "crc", + "digest 0.11.2", + "dotenvy", + "either", + "futures-core", + "futures-util", + "generic-array", + "log", + "percent-encoding", + "serde", + "sha1 0.11.0", + "sha2 0.11.0", + "sqlx-core", + "thiserror 2.0.20", + "tracing", +] + +[[package]] +name = "sqlx-postgres" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0e9e02f764a1fe640eeefc8eb33eeddd274204654ec9f2db8ff851a1dee2364" +dependencies = [ + "atoi", + "base64 0.22.1", + "bitflags 2.13.2", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-util", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "rand 0.10.2", + "serde", + "serde_json", + "sha2 0.11.0", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror 2.0.20", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b6b78a34ddcb1db4046d462db8f79cee811019d7297b99fca8fac5de26672e" +dependencies = [ + "atoi", + "flume", + "form_urlencoded", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "thiserror 2.0.20", + "tracing", + "url", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "strip-ansi-escapes" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a8f8038e7e7969abb3f1b7c2a811225e9296da208539e0f79c5251d6cac0025" +dependencies = [ + "vte", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.2", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "terminal_size" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" +dependencies = [ + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "textwrap" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" +dependencies = [ + "unicode-linebreak", + "unicode-width 0.2.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" +dependencies = [ + "thiserror-impl 2.0.20", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "time" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "time-macros" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce3335fa71841cda333a58d7615b03901380ecf09d59b3296d21f8bbac0dde4e" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot 0.12.5", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" +dependencies = [ + "futures-util", + "log", + "rustls", + "rustls-native-certs", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tungstenite 0.26.2", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17a073bfed563fa236697a068031408a93cd9522e08abf9933ead3e73411bd71" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.30.0", +] + +[[package]] +name = "tokio-util" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "futures-util", + "libc", + "pin-project-lite", + "slab", + "tokio", +] + +[[package]] +name = "tonic" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac2a5518c70fa84342385732db33fb3f44bc4cc748936eb5833d2df34d6445ef" +dependencies = [ + "async-trait", + "axum", + "base64 0.22.1", + "bytes", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-timeout", + "hyper-util", + "percent-encoding", + "pin-project", + "rustls-native-certs", + "socket2", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic-build" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c68f61875ac5293cf72e6c8cf0158086428c82c37229e98c840878f1706b0322" +dependencies = [ + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tonic-prost" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50849f68853be452acf590cde0b146665b8d507b3b8af17261df47e02c209ea0" +dependencies = [ + "bytes", + "prost", + "tonic", +] + +[[package]] +name = "tonic-prost-build" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "654e5643eff75d7f8c99197ce1440ed19a3474eada74c12bbac488b2cafdae27" +dependencies = [ + "prettyplease", + "proc-macro2", + "prost-build", + "prost-types", + "quote", + "syn 2.0.117", + "tempfile", + "tonic-build", +] + +[[package]] +name = "tonic-types" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab1b02061f83d519bba3caa167f88f261ef05720ab8ebc954ade70de3348e8" +dependencies = [ + "prost", + "prost-types", + "tonic", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project-lite", + "slab", + "sync_wrapper", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags 2.13.2", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08a05a66a4fdd61cbbe0a1d755ffe0ca6aba159dd4820936a0ff8a8278245b9c" +dependencies = [ + "base64 0.22.1", + "bitflags 2.13.2", + "bytes", + "http", + "http-body", + "mime", + "percent-encoding", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "tungstenite" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.9.4", + "rustls", + "rustls-pki-types", + "sha1 0.10.6", + "thiserror 2.0.20", + "utf-8", +] + +[[package]] +name = "tungstenite" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48ac77174b19c110a50ab2128b24215ac9cb40e0e12e093fb602d175c569d22" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.10.2", + "sha1 0.11.0", + "thiserror 2.0.20", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76" +dependencies = [ + "getrandom 0.4.2", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vte" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "231fdcd7ef3037e8330d8e17e61011a2c244126acc0a982f4040ac3f9f0bc077" +dependencies = [ + "memchr", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen 0.57.1", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aecb87a33d3b0c5e3b7aa46336eaf486cffafbd281b195e4c8b80d50df2351bf" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ef4c5d3d2cdf5c54f4231181768f5510842e350db025faf1f7163b1030ed928" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a690d511e3c1a8b3a55e33511e3c2c00c78415cd23650f32b808627f5696b9ed" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "411e4887f0071ef2d2164a9d5fdf2d20efbef78fccd3a78b0c10a1dc5295e48a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.5", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81941cd78d0c92026c33e5e01312845a4cb1e9af3407f9134b100dd03144103e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.13.2", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "web-sys" +version = "0.3.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbddc4a036f00ec4f18c83445bd3115cb306a91da554919a099d9222fe4a7f8" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58ec80e73fd8baf57bf0d9615554c75348bda990d6d5bbeab964dd068319fecb" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "webpki-roots" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c1c8e20c8a38fc7d65abfe74eb7280e4aa667e8eec8bc84996d2874810748d9" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "whoami" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626c4bac6755d76ffc12cb01b2eac751db1996b9e0041de9aa02c8c211ddc82c" +dependencies = [ + "libc", + "libredox", + "objc2-system-configuration", + "web-sys", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn 2.0.117", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.13.2", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "workspace-managed" +version = "0.0.0" +dependencies = [ + "kube-support", + "openshell-testkit", + "serde_json", + "tokio", +] + +[[package]] +name = "workspace-operator" +version = "0.0.0" +dependencies = [ + "kube-support", + "openshell-testkit", + "tokio", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "x509-parser" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d43b0f71ce057da06bc0851b23ee24f3f86190b07203dd8f567d0b706a185202" +dependencies = [ + "asn1-rs", + "aws-lc-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror 2.0.20", + "time", +] + +[[package]] +name = "yasna" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5f6765e852b9b4dc8e2a76843e4d64d1cea8e79bcde0b6901aea8e7c7f08282" +dependencies = [ + "bit-vec", + "time", +] + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zerofrom" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/tests/suites/drivers/kubernetes/Cargo.toml b/tests/suites/drivers/kubernetes/Cargo.toml new file mode 100644 index 0000000000..cb3a43d655 --- /dev/null +++ b/tests/suites/drivers/kubernetes/Cargo.toml @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Each driver suite is its own workspace, with its own lockfile. A package here +# holds the tests for one way of installing the gateway on Kubernetes, so a CI +# row selects the package its installer supports. +[workspace] +resolver = "2" +members = ["*"] +exclude = ["target"] diff --git a/tests/suites/drivers/kubernetes/credential-drivers/Cargo.toml b/tests/suites/drivers/kubernetes/credential-drivers/Cargo.toml new file mode 100644 index 0000000000..74ef90eefa --- /dev/null +++ b/tests/suites/drivers/kubernetes/credential-drivers/Cargo.toml @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: Apache-2.0 + +[package] +name = "credential-drivers" +description = "Kubernetes driver suite: where the gateway's credential driver stores provider credentials" +version = "0.0.0" +edition = "2024" +rust-version = "1.95" +license = "Apache-2.0" +repository = "https://github.com/ai-openshell/openshell" +publish = false + +[[test]] +name = "kubernetes-credential-drivers" +path = "tests/credential_backends.rs" +harness = false + +[dependencies] +kube-support = { path = "../../../../support/kube" } +openshell-crypto = { path = "../../../../../crates/openshell-crypto" } +openshell-testkit = { path = "../../../../testkit/testkit" } diff --git a/tests/suites/drivers/kubernetes/credential-drivers/tests/credential_backends.rs b/tests/suites/drivers/kubernetes/credential-drivers/tests/credential_backends.rs new file mode 100644 index 0000000000..b5f25ae13a --- /dev/null +++ b/tests/suites/drivers/kubernetes/credential-drivers/tests/credential_backends.rs @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: Apache-2.0 + +//! The gateway's credential driver keeps a provider's credential in its +//! backend: a Kubernetes Secret in the release's namespace with +//! `kubernetes-secrets`, or a KV entry in OpenBao with `vault`. The +//! environment names the driver in `OPENSHELL_TEST_CREDENTIAL_DRIVER`; with +//! `vault` it also publishes the OpenBao pod to read the KV entry through: +//! +//! | Variable | Meaning | +//! |---|---| +//! | `OPENSHELL_TEST_VAULT_NAMESPACE` | The namespace of the OpenBao pod | +//! | `OPENSHELL_TEST_VAULT_POD` | The OpenBao pod, which has the `bao` CLI | +//! | `OPENSHELL_TEST_VAULT_TOKEN` | A token that may read the gateway's KV entries | + +use k8s_openapi::api::core::v1::Secret; +use kube_support::{Cluster, KubeResultExt as _, k8s_openapi}; +use testkit::{Context, Error, ResultExt as _}; + +fn main() -> std::process::ExitCode { + testkit::main() +} + +const DRIVER_ENV: &str = "OPENSHELL_TEST_CREDENTIAL_DRIVER"; +const VAULT_NAMESPACE_ENV: &str = "OPENSHELL_TEST_VAULT_NAMESPACE"; +const VAULT_POD_ENV: &str = "OPENSHELL_TEST_VAULT_POD"; +const VAULT_TOKEN_ENV: &str = "OPENSHELL_TEST_VAULT_TOKEN"; +const CREDENTIAL_KEY: &str = "OPENAI_API_KEY"; + +/// Where the provider's ordinary credential is stored. Its storage object +/// is the provider itself, so both drivers name it from these fields. +struct StoredCredential { + workspace: String, + provider_id: String, + provider_name: String, +} + +impl StoredCredential { + /// The first 40 hex digits of the SHA-256 of the workspace, provider ID, + /// provider name and credential key, separated by NUL bytes. + fn hash(&self) -> testkit::Result { + let input = [ + self.workspace.as_str(), + &self.provider_id, + &self.provider_name, + CREDENTIAL_KEY, + ] + .join("\0"); + let digest = openshell_crypto::sha256(input.as_bytes()) + .map_err(|error| Error::msg(format!("hash the credential identity: {error}")))?; + Ok(digest + .iter() + .take(20) + .map(|byte| format!("{byte:02x}")) + .collect()) + } +} + +/// The credential driver the gateway runs, and how to read its backend. +enum Backend { + KubernetesSecrets(Cluster), + Vault { + cluster: Cluster, + namespace: String, + pod: String, + token: String, + }, +} + +impl Backend { + async fn from_env() -> testkit::Result { + let driver = testkit::required_env(DRIVER_ENV, "the gateway's credential driver")?; + let cluster = Cluster::from_env().await?; + match driver.as_str() { + "kubernetes-secrets" => Ok(Self::KubernetesSecrets(cluster)), + "vault" => Ok(Self::Vault { + cluster, + namespace: testkit::required_env( + VAULT_NAMESPACE_ENV, + "the namespace of the OpenBao pod", + )?, + pod: testkit::required_env(VAULT_POD_ENV, "the OpenBao pod")?, + token: testkit::required_env(VAULT_TOKEN_ENV, "an OpenBao token")?, + }), + other => Err(Error::msg(format!( + "{DRIVER_ENV} is {other}; expected kubernetes-secrets or vault" + ))), + } + } + + /// The stored credential value, or `None` if the backend has none. + async fn read(&self, credential: &StoredCredential) -> testkit::Result> { + let hash = credential.hash()?; + match self { + Self::KubernetesSecrets(cluster) => { + let name = format!("openshell-cred-{hash}"); + let Some(secret) = cluster + .api::() + .get_opt(&name) + .await + .kube_context(format!("get Secret {name}"))? + else { + return Ok(None); + }; + let value = secret + .data + .unwrap_or_default() + .remove(CREDENTIAL_KEY) + .ok_or_else(|| Error::msg(format!("Secret {name} has no {CREDENTIAL_KEY}")))?; + String::from_utf8(value.0) + .map(Some) + .map_err(|error| Error::msg(format!("Secret {name} is not UTF-8: {error}"))) + } + Self::Vault { + cluster, + namespace, + pod, + token, + } => { + let path = format!("secret/openshell/provider-credentials/{hash}"); + let token = format!("BAO_TOKEN={token}"); + let output = cluster + .exec( + namespace, + pod, + &["env", &token, "bao", "kv", "get", "-field=value", &path], + ) + .await?; + Ok(output.success.then(|| output.stdout.trim().to_string())) + } + } + } +} + +/// A provider's credential is stored in the configured backend, `provider +/// get` does not show it, and deleting the provider deletes it from the +/// backend. +#[testkit::test] +async fn provider_credential_is_stored_in_backend(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let backend = Backend::from_env().await?; + let provider = cx.name("cred"); + let value = format!("example-e2e-{}", cx.run_id()); + + cx.create_provider(&provider, "openai", &[(CREDENTIAL_KEY, &value)]) + .await?; + let shown = cx.cli(["provider", "get", &provider]).await?.success()?; + testkit::ensure!( + !shown.stdout.contains(&value) && !shown.stderr.contains(&value), + "provider get {provider} exposed the credential value" + ); + let listed = cx + .cli_find_listed(&["provider", "list"], "providers", &provider) + .await? + .ok_or_else(|| Error::msg(format!("provider list does not list {provider}")))?; + let field = |key: &str| { + listed[key] + .as_str() + .map(str::to_string) + .ok_or_else(|| Error::msg(format!("provider {provider} is listed without a {key}"))) + }; + let credential = StoredCredential { + workspace: field("workspace")?, + provider_id: field("id")?, + provider_name: provider.clone(), + }; + testkit::ensure!( + !credential.provider_id.is_empty(), + "provider {provider} is listed with an empty ID" + ); + + let stored = backend.read(&credential).await?; + testkit::ensure!( + stored.is_some(), + "the backend has no credential for provider {provider}" + ); + testkit::ensure!( + stored.as_deref() == Some(value.as_str()), + "the backend stored an unexpected value for provider {provider}" + ); + + cx.cli(["provider", "delete", &provider]) + .await? + .success() + .context(format!("delete provider {provider}"))?; + testkit::ensure!( + backend.read(&credential).await?.is_none(), + "the backend still has the credential of deleted provider {provider}" + ); + Ok(()) +} diff --git a/tests/suites/drivers/kubernetes/runtime/Cargo.toml b/tests/suites/drivers/kubernetes/runtime/Cargo.toml new file mode 100644 index 0000000000..710b86890c --- /dev/null +++ b/tests/suites/drivers/kubernetes/runtime/Cargo.toml @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: Apache-2.0 + +[package] +name = "runtime" +description = "Kubernetes driver suite: the objects the driver keeps for a sandbox, on any install" +version = "0.0.0" +edition = "2024" +rust-version = "1.95" +license = "Apache-2.0" +repository = "https://github.com/ai-openshell/openshell" +publish = false + +[[test]] +name = "kubernetes-reconcile" +path = "tests/reconcile.rs" +harness = false + +[dependencies] +kube-support = { path = "../../../../support/kube" } +openshell-testkit = { path = "../../../../testkit/testkit" } +serde_json = "1" diff --git a/tests/suites/drivers/kubernetes/runtime/tests/reconcile.rs b/tests/suites/drivers/kubernetes/runtime/tests/reconcile.rs new file mode 100644 index 0000000000..503cea684a --- /dev/null +++ b/tests/suites/drivers/kubernetes/runtime/tests/reconcile.rs @@ -0,0 +1,149 @@ +// SPDX-License-Identifier: Apache-2.0 + +//! A stopped sandbox whose stored bootstrap image predates a gateway upgrade +//! starts with the gateway's configured runtime image and keeps its identity +//! and workspace. + +use k8s_openapi::api::core::v1::Service; +use kube_support::kube::Api; +use kube_support::{Cluster, KubeResultExt as _, k8s_openapi, kube}; +use serde_json::Value; +use testkit::{Context, Error, ResultExt as _}; + +fn main() -> std::process::ExitCode { + testkit::main() +} + +const BOOTSTRAP_CONTAINER: &str = "openshell-sandbox-bootstrap"; +const STALE_IMAGE: &str = "registry.invalid/openshell/sandbox:stale"; +const MARKER: &str = "openshell-runtime-reconcile"; +const MARKER_PATH: &str = "/sandbox/.openshell-runtime-reconcile"; +const BOUNDARY_ROLE: &str = "openshell.ai/boundary-role"; + +/// The index of the stored bootstrap init container in a `Sandbox` object. +fn bootstrap_index(object: &kube::api::DynamicObject) -> testkit::Result { + object.data["spec"]["podTemplate"]["spec"]["initContainers"] + .as_array() + .ok_or_else(|| Error::msg("Sandbox object has no stored init containers"))? + .iter() + .position(|container| container["name"] == BOOTSTRAP_CONTAINER) + .ok_or_else(|| Error::msg("Sandbox object has no stored bootstrap init container")) +} + +fn bootstrap_image(object: &kube::api::DynamicObject, index: usize) -> &Value { + &object.data["spec"]["podTemplate"]["spec"]["initContainers"][index]["image"] +} + +/// The Service named `-` the driver keeps for a sandbox. +async fn service( + services: &Api, + object: &kube::api::DynamicObject, + prefix: &str, +) -> testkit::Result { + let name = format!("{prefix}-{}", kube_support::sandbox_id(object)?); + services + .get(&name) + .await + .kube_context(format!("get Service {name}")) +} + +fn role(service: &Service) -> Option<&str> { + service + .spec + .as_ref()? + .selector + .as_ref()? + .get(BOUNDARY_ROLE) + .map(String::as_str) +} + +fn cluster_ip(service: &Service) -> Option<&str> { + service.spec.as_ref()?.cluster_ip.as_deref() +} + +/// Starting a stopped sandbox whose `Sandbox` object stores a stale bootstrap +/// image restores the gateway's image and recreates a missing supervisor +/// Service, keeping the object, the workload Service and the workspace. +#[testkit::test] +async fn start_refreshes_stale_bootstrap_image(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let services: Api = cluster.api(); + let sandbox = cx + .sandbox("rc") + .command(["sleep", "infinity"]) + .create_ready() + .await?; + sandbox + .exec([ + "sh", + "-c", + &format!("printf '%s\\n' '{MARKER}' > '{MARKER_PATH}'"), + ]) + .await? + .success() + .context("write the workspace marker")?; + sandbox.stop().await?; + + // An older gateway stored its own runtime image in the resource. + let mut before = cluster.sandbox_object(sandbox.name()).await?; + let index = bootstrap_index(&before)?; + let original_image = bootstrap_image(&before, index).clone(); + let boundary = service(&services, &before, "os-boundary").await?; + let supervisor = service(&services, &before, "os-supervisor").await?; + // A legacy sandbox has no supervisor Service. Adding it on start must + // preserve the workload Service that old gateways use. + let supervisor_name = supervisor.metadata.name.clone().unwrap_or_default(); + services + .delete(&supervisor_name, &Default::default()) + .await + .kube_context(format!("delete Service {supervisor_name}"))?; + before.data["spec"]["podTemplate"]["spec"]["initContainers"][index]["image"] = + Value::from(STALE_IMAGE); + cluster.replace_sandbox_object(&before).await?; + + sandbox.start().await?; + + let marker = sandbox.exec(["cat", MARKER_PATH]).await?.success()?; + testkit::ensure!( + marker.stdout.lines().any(|line| line.trim() == MARKER), + "the workspace marker should survive the restart:\n{}", + marker.stdout + ); + let after = cluster.sandbox_object(sandbox.name()).await?; + testkit::ensure!( + after.metadata.uid == before.metadata.uid, + "the Sandbox object was replaced: {:?} became {:?}", + before.metadata.uid, + after.metadata.uid + ); + let unchanged = service(&services, &after, "os-boundary").await?; + testkit::ensure!( + unchanged.metadata.uid == boundary.metadata.uid, + "the workload Service was replaced" + ); + testkit::ensure!( + cluster_ip(&unchanged) == cluster_ip(&boundary), + "the workload Service address changed from {:?} to {:?}", + cluster_ip(&boundary), + cluster_ip(&unchanged) + ); + testkit::ensure!( + role(&unchanged) == Some("workload"), + "the workload Service selects {:?}", + role(&unchanged) + ); + let recreated = service(&services, &after, "os-supervisor").await?; + testkit::ensure!( + role(&recreated) == Some("supervisor"), + "the supervisor Service selects {:?}", + role(&recreated) + ); + let after_index = bootstrap_index(&after)?; + testkit::ensure!( + *bootstrap_image(&after, after_index) == original_image, + "start should restore the bootstrap image {original_image}, found {}", + bootstrap_image(&after, after_index) + ); + Ok(()) +} diff --git a/tests/suites/drivers/kubernetes/workspace-managed/Cargo.toml b/tests/suites/drivers/kubernetes/workspace-managed/Cargo.toml new file mode 100644 index 0000000000..0773a97c18 --- /dev/null +++ b/tests/suites/drivers/kubernetes/workspace-managed/Cargo.toml @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: Apache-2.0 + +[package] +name = "workspace-managed" +description = "Kubernetes driver suite: managed workspace mode, where the driver creates a namespace per workspace" +version = "0.0.0" +edition = "2024" +rust-version = "1.95" +license = "Apache-2.0" +repository = "https://github.com/ai-openshell/openshell" +publish = false + +[[test]] +name = "kubernetes-workspace-managed" +path = "tests/workspace_managed.rs" +harness = false + +[dependencies] +kube-support = { path = "../../../../support/kube" } +openshell-testkit = { path = "../../../../testkit/testkit" } +serde_json = "1" +tokio = { version = "1", features = ["macros"] } diff --git a/tests/suites/drivers/kubernetes/workspace-managed/tests/workspace_managed.rs b/tests/suites/drivers/kubernetes/workspace-managed/tests/workspace_managed.rs new file mode 100644 index 0000000000..a1287e6d46 --- /dev/null +++ b/tests/suites/drivers/kubernetes/workspace-managed/tests/workspace_managed.rs @@ -0,0 +1,514 @@ +// SPDX-License-Identifier: Apache-2.0 + +//! Managed workspace mode: the driver creates a namespace, +//! `openshell-{gateway ID}-{workspace}`, when a workspace gets its first +//! sandbox. It provisions the namespace's ServiceAccount, SSH NetworkPolicy, +//! and per-generation copies of the Secrets sandboxes need, keeps the +//! workspace's `Sandbox` objects there, and deletes the namespace with the +//! workspace. The gateway's ID is its Helm release name. + +use std::time::Duration; + +use k8s_openapi::api::core::v1::{ConfigMap, Namespace, Secret, ServiceAccount}; +use k8s_openapi::api::networking::v1::NetworkPolicy; +use kube_support::kube::api::ListParams; +use kube_support::{Cluster, KubeResultExt as _, k8s_openapi}; +use testkit::sdk::{DeleteOptions, ListOptions, SandboxSpec}; +use testkit::{Context, Error, Poll, ResultExt as _, Workspace}; + +fn main() -> std::process::ExitCode { + testkit::main() +} + +const IMAGE_PULL_SECRET_ENV: &str = "OPENSHELL_TEST_KUBE_IMAGE_PULL_SECRET"; +const MANAGED_BY: &str = "openshell.ai/managed-by"; +const MANAGED_BY_VALUE: &str = "openshell"; +const GATEWAY_ID: &str = "openshell.ai/gateway-id"; +const COMPONENT: &str = "openshell.ai/component"; +const CLIENT_TLS_SECRET: &str = "openshell-client-tls"; +const SSH_NETWORK_POLICY: &str = "openshell-sandbox-ssh"; +const SANDBOX_SERVICE_ACCOUNT: &str = "openshell-sandbox"; +/// How long the gateway may take to remove a sandbox, or Kubernetes a +/// namespace. Well under the runner's kill. +const REMOVE_TIMEOUT: Duration = Duration::from_secs(45); +const POLL_INTERVAL: Duration = Duration::from_secs(2); + +/// The namespace the driver manages for `workspace`. +fn managed_namespace(cluster: &Cluster, workspace: &str) -> String { + format!("openshell-{}-{workspace}", cluster.release()) +} + +/// The configured image-pull Secret, which the installer labels attachable +/// in the release's namespace. +fn image_pull_secret() -> testkit::Result { + testkit::required_env( + IMAGE_PULL_SECRET_ENV, + "the image-pull Secret the gateway is configured with", + ) +} + +/// Create workspace `cx.name(suffix)` and return it with its managed +/// namespace. Cleanup deletes the namespace after the workspace, in case the +/// gateway leaves it behind. +async fn managed_workspace( + cx: &Context, + cluster: &Cluster, + suffix: &str, +) -> testkit::Result<(Workspace, String)> { + let namespace = managed_namespace(cluster, &cx.name(suffix)); + cluster.delete_namespace_on_cleanup(cx, &namespace); + let workspace = cx.workspace(suffix).await?; + Ok((workspace, namespace)) +} + +/// Create sandbox `name` in `workspace` with the CLI, attached to a main +/// that prints `marker`, and fail unless the CLI streamed it. +async fn run_sandbox(workspace: &Workspace, name: &str, marker: &str) -> testkit::Result { + workspace.track_sandbox(name); + let output = workspace + .cli() + .run([ + "sandbox", "create", "--name", name, "--no-tty", "--", "echo", marker, + ]) + .await? + .success()?; + testkit::ensure!( + output.output().contains(marker), + "`{}` did not stream {marker:?}: {}", + output.command, + output.output() + ); + Ok(()) +} + +/// Delete sandbox `name` through the gateway and wait until it is gone. +async fn delete_sandbox(workspace: &Workspace, name: &str) -> testkit::Result { + let client = workspace.client(); + let what = format!("sandbox {name} in workspace {}", workspace.name()); + client + .delete_sandbox(name, DeleteOptions::default()) + .await + .context(format!("delete {what}"))?; + client + .wait_deleted(name, REMOVE_TIMEOUT, None) + .await + .context(format!("wait for {what} to be deleted"))?; + Ok(()) +} + +/// The sandboxes the gateway lists in `workspace`. +async fn listed_sandboxes(workspace: &Workspace) -> testkit::Result> { + Ok(workspace + .client() + .list_all_sandboxes(ListOptions::default()) + .await + .context(format!("list sandboxes in workspace {}", workspace.name()))? + .into_iter() + .map(|sandbox| sandbox.name) + .collect()) +} + +/// Fail unless `namespace` exists and is not being deleted. +async fn expect_namespace(cluster: &Cluster, namespace: &str) -> testkit::Result { + let found = cluster + .get_namespace(namespace) + .await? + .ok_or_else(|| Error::msg(format!("managed namespace {namespace} does not exist")))?; + testkit::ensure!( + found.metadata.deletion_timestamp.is_none(), + "managed namespace {namespace} is being deleted" + ); + Ok(found) +} + +/// Wait until `namespace` is gone. +async fn wait_namespace_gone(cluster: &Cluster, namespace: &str) -> testkit::Result { + testkit::poll_until( + &format!("managed namespace {namespace} to be deleted"), + REMOVE_TIMEOUT, + POLL_INTERVAL, + async || { + Ok(match cluster.get_namespace(namespace).await? { + None => Poll::Ready(()), + Some(found) => Poll::Pending(format!( + "phase {:?}", + found.status.and_then(|status| status.phase) + )), + }) + }, + ) + .await +} + +/// Delete `workspace` with the CLI. +async fn delete_workspace(cx: &Context, workspace: &Workspace) -> testkit::Result { + cx.cli(["workspace", "delete", workspace.name()]) + .await? + .success()?; + Ok(()) +} + +/// A workspace's first sandbox creates its namespace, labelled for this +/// gateway, with the sandbox ServiceAccount, a generation copy of the +/// image-pull Secret (never the configured Secret itself), and an SSH +/// NetworkPolicy that admits only gateway pods. The `Sandbox` object lives +/// there, and the gateway gets, lists and deletes the sandbox. +#[testkit::test] +async fn managed_creates_namespace_with_labels(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let regcred = image_pull_secret()?; + let (workspace, namespace) = managed_workspace(cx, &cluster, "mgd").await?; + let sandbox = cx.name("mgdsb"); + run_sandbox(&workspace, &sandbox, "managed-ok").await?; + + let found = expect_namespace(&cluster, &namespace).await?; + let labels = found.metadata.labels.unwrap_or_default(); + testkit::ensure!( + labels.get(MANAGED_BY).map(String::as_str) == Some(MANAGED_BY_VALUE), + "namespace {namespace} has {MANAGED_BY}={:?}; expected {MANAGED_BY_VALUE}", + labels.get(MANAGED_BY) + ); + testkit::ensure!( + labels.get(GATEWAY_ID).map(String::as_str) == Some(cluster.release()), + "namespace {namespace} has {GATEWAY_ID}={:?}; expected {}", + labels.get(GATEWAY_ID), + cluster.release() + ); + + cluster + .api_in::(&namespace) + .get_opt(SANDBOX_SERVICE_ACCOUNT) + .await + .kube_context(format!( + "get ServiceAccount {SANDBOX_SERVICE_ACCOUNT} in {namespace}" + ))? + .ok_or_else(|| { + Error::msg(format!( + "ServiceAccount {SANDBOX_SERVICE_ACCOUNT} does not exist in {namespace}" + )) + })?; + + // Each runtime generation gets its own immutable copy of the configured + // image-pull Secret; the configured name is never created here. + let secrets = cluster.api_in::(&namespace); + let staged = secrets + .list(&ListParams::default().labels(&format!("{COMPONENT}=image-pull"))) + .await + .kube_context(format!("list image-pull Secrets in {namespace}"))?; + let staged: Vec<_> = staged + .items + .iter() + .map(|secret| { + ( + secret.metadata.name.clone().unwrap_or_default(), + secret.type_.clone().unwrap_or_default(), + secret.immutable, + ) + }) + .collect(); + testkit::ensure!( + staged.iter().any(|(name, kind, immutable)| { + name.starts_with("os-pull-") + && kind == "kubernetes.io/dockerconfigjson" + && *immutable == Some(true) + }), + "no immutable generation image-pull Secret os-pull-* in {namespace}: {staged:?}" + ); + let copied = secrets + .get_opt(®cred) + .await + .kube_context(format!("get Secret {regcred} in {namespace}"))?; + testkit::ensure!( + copied.is_none(), + "the configured image-pull Secret {regcred} must not exist in {namespace}" + ); + + // NetworkPolicies are allowlists, so admitting only gateway pods on the + // SSH port denies sandbox-to-sandbox SSH. + let policy = cluster + .api_in::(&namespace) + .get_opt(SSH_NETWORK_POLICY) + .await + .kube_context(format!( + "get NetworkPolicy {SSH_NETWORK_POLICY} in {namespace}" + ))? + .ok_or_else(|| { + Error::msg(format!( + "NetworkPolicy {SSH_NETWORK_POLICY} does not exist in {namespace}" + )) + })?; + let spec = serde_json::to_value(&policy.spec).context("serialize the NetworkPolicy spec")?; + testkit::ensure!( + spec["podSelector"]["matchLabels"][MANAGED_BY] == MANAGED_BY_VALUE, + "SSH NetworkPolicy must select sandbox pods: {spec}" + ); + let ingress = &spec["ingress"][0]; + testkit::ensure!( + ingress["ports"][0]["port"] == 2222, + "SSH NetworkPolicy must admit port 2222: {spec}" + ); + let peer = &ingress["from"][0]; + testkit::ensure!( + peer["namespaceSelector"]["matchLabels"]["kubernetes.io/metadata.name"] + == cluster.namespace(), + "SSH ingress peer must select the gateway's namespace {}: {spec}", + cluster.namespace() + ); + testkit::ensure!( + peer["podSelector"]["matchLabels"]["app.kubernetes.io/name"].is_string(), + "SSH ingress peer must select gateway pods: {spec}" + ); + + let objects = cluster.sandbox_object_names_in(&namespace).await?; + testkit::ensure!( + objects.contains(&sandbox), + "no Sandbox object {sandbox} in {namespace}: {objects:?}" + ); + + let listed = listed_sandboxes(&workspace).await?; + testkit::ensure!( + listed.contains(&sandbox), + "the gateway does not list {sandbox}: {listed:?}" + ); + let got = workspace + .client() + .get_sandbox(&sandbox) + .await + .context(format!("get sandbox {sandbox}"))?; + testkit::ensure!( + got.name == sandbox, + "sandbox get returned {}; expected {sandbox}", + got.name + ); + delete_sandbox(&workspace, &sandbox).await +} + +/// Two workspaces get separate namespaces, each holding only its own +/// sandbox's `Sandbox` object, and the gateway lists each sandbox only in its +/// workspace. +#[testkit::test] +async fn managed_isolates_workspaces_into_separate_namespaces(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let (ws_a, ns_a) = managed_workspace(cx, &cluster, "isoa").await?; + let (ws_b, ns_b) = managed_workspace(cx, &cluster, "isob").await?; + let (sb_a, sb_b) = (cx.name("sba"), cx.name("sbb")); + tokio::try_join!( + run_sandbox(&ws_a, &sb_a, "a"), + run_sandbox(&ws_b, &sb_b, "b"), + )?; + + testkit::ensure!(ns_a != ns_b, "both workspaces map to namespace {ns_a}"); + for (workspace, namespace, own, other) in + [(&ws_a, &ns_a, &sb_a, &sb_b), (&ws_b, &ns_b, &sb_b, &sb_a)] + { + expect_namespace(&cluster, namespace).await?; + let objects = cluster.sandbox_object_names_in(namespace).await?; + testkit::ensure!( + objects.contains(own) && !objects.contains(other), + "{namespace} should hold the Sandbox object for {own} and not {other}: {objects:?}" + ); + let listed = listed_sandboxes(workspace).await?; + testkit::ensure!( + listed.contains(own) && !listed.contains(other), + "workspace {} should list {own} and not {other}: {listed:?}", + workspace.name() + ); + } + Ok(()) +} + +/// With client TLS configured, a managed namespace gets no copy of the +/// client TLS Secret; the supervisor bootstrap Secret carries only the +/// gateway CA from it. +#[testkit::test] +async fn managed_supervisor_reads_client_tls_from_its_bootstrap_secret( + cx: &mut Context, +) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let config_name = format!("{}-config", cluster.release()); + let config = cluster + .api::() + .get(&config_name) + .await + .kube_context(format!("get ConfigMap {config_name}"))?; + let gateway_toml = config + .data + .as_ref() + .and_then(|data| data.get("gateway.toml")) + .ok_or_else(|| Error::msg(format!("ConfigMap {config_name} has no gateway.toml")))?; + testkit::ensure!( + gateway_toml.contains("client_tls_secret_name") && gateway_toml.contains(CLIENT_TLS_SECRET), + "the gateway must be configured with client_tls_secret_name {CLIENT_TLS_SECRET}; enable gateway mTLS" + ); + let source = cluster + .api::() + .get(CLIENT_TLS_SECRET) + .await + .kube_context(format!("get Secret {CLIENT_TLS_SECRET}"))?; + let ca = source + .data + .as_ref() + .and_then(|data| data.get("ca.crt")) + .ok_or_else(|| Error::msg(format!("Secret {CLIENT_TLS_SECRET} has no ca.crt")))?; + + let (workspace, namespace) = managed_workspace(cx, &cluster, "mtls").await?; + run_sandbox(&workspace, &cx.name("tlssb"), "tls-ok").await?; + + let secrets = cluster.api_in::(&namespace); + let copied = secrets + .get_opt(CLIENT_TLS_SECRET) + .await + .kube_context(format!("get Secret {CLIENT_TLS_SECRET} in {namespace}"))?; + testkit::ensure!( + copied.is_none(), + "client TLS Secret {CLIENT_TLS_SECRET} must not be copied into {namespace}" + ); + let bootstrap = secrets + .list(&ListParams::default().labels(&format!("{COMPONENT}=supervisor-bootstrap"))) + .await + .kube_context(format!("list supervisor bootstrap Secrets in {namespace}"))?; + let keys: Vec> = bootstrap + .items + .iter() + .map(|secret| secret.data.iter().flatten().map(|(key, _)| key).collect()) + .collect(); + testkit::ensure!( + bootstrap.items.iter().any(|secret| { + let data = secret.data.clone().unwrap_or_default(); + data.get("client-ca.crt") == Some(ca) + && !data.contains_key("client-tls.crt") + && !data.contains_key("client-tls.key") + }), + "a supervisor bootstrap Secret in {namespace} should carry the gateway CA as client-ca.crt and no client key pair; keys: {keys:?}" + ); + Ok(()) +} + +/// The gateway's ServiceAccount can't read, list or modify Secrets in a +/// workspace namespace, including the names of Secrets it copies from its own +/// namespace, but still reads Secrets in its own namespace. +#[testkit::test] +async fn managed_gateway_cannot_read_or_modify_workspace_secrets( + cx: &mut Context, +) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let regcred = image_pull_secret()?; + let namespace = managed_namespace(&cluster, &cx.name("rbac")); + + for verb in ["get", "patch"] { + testkit::ensure!( + !cluster.gateway_can(verb, "secrets", &namespace).await?, + "the gateway must not {verb} arbitrary Secrets in workspace namespace {namespace}" + ); + testkit::ensure!( + !cluster + .gateway_can(verb, "secrets/unrelated-secret", &namespace) + .await?, + "the gateway must not {verb} an unrelated Secret in workspace namespace {namespace}" + ); + } + testkit::ensure!( + !cluster.gateway_can("list", "secrets", &namespace).await?, + "the gateway must not list Secrets in workspace namespace {namespace}" + ); + for copied in [CLIENT_TLS_SECRET, regcred.as_str()] { + testkit::ensure!( + !cluster + .gateway_can("get", &format!("secrets/{copied}"), &namespace) + .await?, + "the gateway must not read Secret {copied} in workspace namespace {namespace}" + ); + } + testkit::ensure!( + cluster + .gateway_can("get", "secrets", cluster.namespace()) + .await?, + "the gateway must still read provider credential Secrets in {}", + cluster.namespace() + ); + Ok(()) +} + +/// Creating a sandbox fails when the workspace's namespace already exists, +/// labelled as managed by another gateway. +#[testkit::test] +async fn managed_rejects_namespace_owned_by_different_gateway(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let namespace = managed_namespace(&cluster, &cx.name("own")); + cluster + .create_namespace( + cx, + &namespace, + &[ + (MANAGED_BY, MANAGED_BY_VALUE), + (GATEWAY_ID, "wrong-gateway"), + ], + ) + .await?; + let workspace = cx.workspace("own").await?; + let sandbox = cx.name("ownsb"); + workspace.track_sandbox(&sandbox); + + let created = workspace + .client() + .create_sandbox(SandboxSpec { + name: Some(sandbox.clone()), + command: vec!["echo".to_string(), "nope".to_string()], + ..SandboxSpec::default() + }) + .await; + match created { + Ok(created) => Err(Error::msg(format!( + "sandbox {} was created in namespace {namespace}, owned by another gateway", + created.name + ))), + Err(error) => { + let error = Error::from(error); + testkit::ensure!( + error.to_string().contains("not owned by this gateway"), + "sandbox create failed for another reason than namespace ownership: {error}" + ); + Ok(()) + } + } +} + +/// A managed namespace stays while any of its workspace's sandboxes remain, +/// keeping the remaining `Sandbox` object, and deleting the emptied +/// workspace deletes the namespace. +#[testkit::test] +async fn managed_full_lifecycle_with_multiple_sandboxes(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let (workspace, namespace) = managed_workspace(cx, &cluster, "lc").await?; + let (first, second) = (cx.name("lca"), cx.name("lcb")); + tokio::try_join!( + run_sandbox(&workspace, &first, "a"), + run_sandbox(&workspace, &second, "b"), + )?; + expect_namespace(&cluster, &namespace).await?; + + delete_sandbox(&workspace, &first).await?; + expect_namespace(&cluster, &namespace) + .await + .context(format!("{second} remains in the workspace"))?; + let objects = cluster.sandbox_object_names_in(&namespace).await?; + testkit::ensure!( + objects.contains(&second), + "the Sandbox object for {second} should remain in {namespace}: {objects:?}" + ); + let listed = listed_sandboxes(&workspace).await?; + testkit::ensure!( + listed.contains(&second), + "the gateway should still list {second}: {listed:?}" + ); + + delete_sandbox(&workspace, &second).await?; + delete_workspace(cx, &workspace).await?; + wait_namespace_gone(&cluster, &namespace).await +} diff --git a/tests/suites/drivers/kubernetes/workspace-operator/Cargo.toml b/tests/suites/drivers/kubernetes/workspace-operator/Cargo.toml new file mode 100644 index 0000000000..b5e1cfe6a0 --- /dev/null +++ b/tests/suites/drivers/kubernetes/workspace-operator/Cargo.toml @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: Apache-2.0 + +[package] +name = "workspace-operator" +description = "Kubernetes driver suite: operator workspace mode, where an operator provisions each workspace namespace" +version = "0.0.0" +edition = "2024" +rust-version = "1.95" +license = "Apache-2.0" +repository = "https://github.com/ai-openshell/openshell" +publish = false + +[[test]] +name = "kubernetes-workspace-operator" +path = "tests/workspace_operator.rs" +harness = false + +[dependencies] +kube-support = { path = "../../../../support/kube" } +openshell-testkit = { path = "../../../../testkit/testkit" } +tokio = { version = "1", features = ["process"] } diff --git a/tests/suites/drivers/kubernetes/workspace-operator/tests/workspace_operator.rs b/tests/suites/drivers/kubernetes/workspace-operator/tests/workspace_operator.rs new file mode 100644 index 0000000000..aa017fead8 --- /dev/null +++ b/tests/suites/drivers/kubernetes/workspace-operator/tests/workspace_operator.rs @@ -0,0 +1,339 @@ +// SPDX-License-Identifier: Apache-2.0 + +//! Operator workspace mode: the gateway runs with `workspace_mode = +//! "operator"` and places a workspace's sandboxes in the namespace of the +//! same name, but only while an operator has labelled it +//! `openshell.ai/e2e-operator-workspace=true`. The gateway discovers those +//! namespaces through the label and never creates or deletes them, and it +//! may touch Secrets in them only through the RBAC the +//! `openshell-workspace` chart installs. + +use std::time::Duration; + +use k8s_openapi::api::core::v1::ServiceAccount; +use k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta; +use kube_support::kube::api::PostParams; +use kube_support::{Cluster, KubeResultExt as _, k8s_openapi}; +use testkit::sdk::{DeleteOptions, ExecOptions, ListOptions, SandboxRef, SandboxSpec}; +use testkit::{ + Context, EXEC_TIMEOUT, Error, GrpcCode, Poll, READY_TIMEOUT, ResultExt as _, Workspace, +}; + +fn main() -> std::process::ExitCode { + testkit::main() +} + +const OPERATOR_LABEL: &str = "openshell.ai/e2e-operator-workspace"; +const SANDBOX_SERVICE_ACCOUNT: &str = "openshell-sandbox"; +const WORKSPACE_CHART_ENV: &str = "OPENSHELL_TEST_KUBE_WORKSPACE_CHART"; +/// How long the gateway's namespace watcher may take to follow a label. +const WATCH_TIMEOUT: Duration = Duration::from_secs(30); +const WATCH_INTERVAL: Duration = Duration::from_secs(2); +/// Shorter than testkit's delete timeout, to fit inside the runner's kill. +const DELETE_WAIT: Duration = Duration::from_secs(60); + +fn idle_spec(name: &str) -> SandboxSpec { + SandboxSpec { + name: Some(name.to_string()), + command: vec!["sleep".to_string(), "infinity".to_string()], + ..SandboxSpec::default() + } +} + +/// Create namespace `name` with the operator label and install the +/// `openshell-workspace` chart in it, as an operator provisions a workspace. +async fn provision_operator_namespace( + cx: &Context, + cluster: &Cluster, + name: &str, +) -> testkit::Result { + cluster + .create_namespace(cx, name, &[(OPERATOR_LABEL, "true")]) + .await?; + install_workspace_chart(cluster, name).await +} + +/// Install the `openshell-workspace` chart in `namespace`, bound to the +/// gateway's ServiceAccount. Deleting the namespace removes the release. +async fn install_workspace_chart(cluster: &Cluster, namespace: &str) -> testkit::Result { + let chart = testkit::required_env( + WORKSPACE_CHART_ENV, + "the packaged openshell-workspace Helm chart", + )?; + let kubeconfig = testkit::required_env( + kube_support::KUBECONFIG_ENV, + "a kubeconfig for the gateway's cluster", + )?; + let output = tokio::process::Command::new("helm") + .args(["install", "openshell-workspace", &chart]) + .args(["--kubeconfig", &kubeconfig, "--namespace", namespace]) + .args(["--wait", "--timeout", "60s"]) + .arg("--set") + .arg(format!("gateway.serviceAccount.name={}", cluster.release())) + .arg("--set") + .arg(format!( + "gateway.serviceAccount.namespace={}", + cluster.namespace() + )) + .kill_on_drop(true) + .output() + .await + .context("run helm install")?; + testkit::ensure!( + output.status.success(), + "helm install of {chart} in namespace {namespace} failed with {}:\n{}{}", + output.status, + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + ); + Ok(()) +} + +/// Create sandbox `name` in `workspace`, retrying until the gateway's +/// namespace watcher admits the workspace's namespace. +async fn create_when_admitted(workspace: &Workspace, name: &str) -> testkit::Result { + workspace.track_sandbox(name); + let client = workspace.client(); + testkit::poll_until( + &format!("workspace {} to admit sandbox {name}", workspace.name()), + WATCH_TIMEOUT, + WATCH_INTERVAL, + async || { + Ok(match client.create_sandbox(idle_spec(name)).await { + Ok(sandbox) => Poll::Ready(sandbox), + Err(error) => Poll::Pending(error.to_string()), + }) + }, + ) + .await +} + +/// Fail unless the gateway refuses to create sandbox `name` in `workspace`. +async fn expect_create_rejected(workspace: &Workspace, name: &str, why: &str) -> testkit::Result { + workspace.track_sandbox(name); + match workspace.client().create_sandbox(idle_spec(name)).await { + Ok(sandbox) => Err(Error::msg(format!( + "sandbox create should fail for {why}, but created {} in workspace {}", + sandbox.name, + workspace.name() + ))), + Err(error) => expect_not_admitted(error.into()), + } +} + +/// Fail unless `error` is the gateway refusing a sandbox because the +/// workspace's namespace is not admitted. +fn expect_not_admitted(error: Error) -> testkit::Result { + testkit::ensure!( + error.grpc_code() == Some(GrpcCode::FailedPrecondition), + "sandbox create should fail with FailedPrecondition: {error}" + ); + Ok(()) +} + +/// Delete sandbox `name` in `workspace` and wait until it is gone. +async fn delete_sandbox(workspace: &Workspace, name: &str) -> testkit::Result { + let client = workspace.client(); + client + .delete_sandbox(name, DeleteOptions::default()) + .await + .context(format!("delete sandbox {name}"))?; + client + .wait_deleted(name, DELETE_WAIT, None) + .await + .context(format!("wait for sandbox {name} to be deleted")) +} + +/// Without the workspace chart, the gateway's ServiceAccount has no access +/// to Secrets in a namespace, including the client TLS Secret. +#[testkit::test] +async fn gateway_has_no_secret_access_without_workspace_chart(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let namespace = cx.name("rbac"); + for verb in ["get", "list", "create", "patch", "delete"] { + testkit::ensure!( + !cluster.gateway_can(verb, "secrets", &namespace).await?, + "the gateway must not {verb} Secrets in namespace {namespace} without the workspace chart" + ); + } + testkit::ensure!( + !cluster + .gateway_can("patch", "secrets/openshell-client-tls", &namespace) + .await?, + "the gateway must not patch the client TLS Secret in namespace {namespace} without the workspace chart" + ); + Ok(()) +} + +/// A sandbox in a workspace whose labelled namespace an operator +/// provisioned runs there under its bare name, and the gateway lists, gets +/// and deletes it. +#[testkit::test] +async fn sandbox_runs_in_labelled_namespace(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let namespace = cx.name("op"); + provision_operator_namespace(cx, &cluster, &namespace).await?; + let workspace = cx.workspace("op").await?; + let client = workspace.client(); + let name = cx.name("sb"); + + let created = create_when_admitted(&workspace, &name).await?; + client + .wait_ready(&name, READY_TIMEOUT) + .await + .context(format!("wait for sandbox {name} to be ready"))?; + let options = ExecOptions { + timeout: Some(EXEC_TIMEOUT), + ..ExecOptions::default() + }; + let output = client + .exec( + &name, + &["echo".to_string(), "operator-ok".to_string()], + options, + ) + .await + .context(format!("exec in sandbox {name}"))?; + let stdout = String::from_utf8_lossy(&output.stdout); + testkit::ensure!( + output.exit_code == 0 && stdout.contains("operator-ok"), + "exec in sandbox {name} exited {} with stdout {stdout:?}", + output.exit_code + ); + + let objects = cluster.sandbox_object_names_in(&namespace).await?; + testkit::ensure!( + objects.contains(&name), + "namespace {namespace} should hold a Sandbox object named {name}; found {objects:?}" + ); + let listed = client + .list_all_sandboxes(ListOptions::default()) + .await + .context(format!("list sandboxes in workspace {namespace}"))?; + testkit::ensure!( + listed.iter().any(|sandbox| sandbox.name == name), + "workspace {namespace} does not list sandbox {name}" + ); + let found = client + .get_sandbox(&name) + .await + .context(format!("get sandbox {name}"))?; + testkit::ensure!( + found.id == created.id, + "get sandbox {name} returned ID {}; created {}", + found.id, + created.id + ); + + delete_sandbox(&workspace, &name).await +} + +/// The gateway refuses a sandbox in a workspace whose namespace exists, with +/// the sandbox ServiceAccount, but lacks the operator label. +#[testkit::test] +async fn rejects_unlabelled_namespace(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let namespace = cx.name("opun"); + cluster.create_namespace(cx, &namespace, &[]).await?; + let account = ServiceAccount { + metadata: ObjectMeta { + name: Some(SANDBOX_SERVICE_ACCOUNT.to_string()), + ..ObjectMeta::default() + }, + ..ServiceAccount::default() + }; + cluster + .api_in::(&namespace) + .create(&PostParams::default(), &account) + .await + .kube_context(format!( + "create ServiceAccount {SANDBOX_SERVICE_ACCOUNT} in {namespace}" + ))?; + let workspace = cx.workspace("opun").await?; + + expect_create_rejected(&workspace, &cx.name("sb"), "an unlabelled namespace").await +} + +/// The gateway refuses a sandbox in a workspace that has no namespace. +#[testkit::test] +async fn rejects_missing_namespace(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let workspace = cx.workspace("opne").await?; + + expect_create_rejected(&workspace, &cx.name("sb"), "a missing namespace").await +} + +/// Deleting a workspace leaves its operator-provisioned namespace and the +/// namespace's operator label in place. +#[testkit::test] +async fn workspace_delete_preserves_namespace(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let namespace = cx.name("opdel"); + provision_operator_namespace(cx, &cluster, &namespace).await?; + let workspace = cx.workspace("opdel").await?; + let name = cx.name("sb"); + + create_when_admitted(&workspace, &name).await?; + delete_sandbox(&workspace, &name).await?; + workspace + .cli() + .run(["workspace", "delete", &namespace]) + .await? + .success()?; + + let found = cluster.get_namespace(&namespace).await?.ok_or_else(|| { + Error::msg(format!( + "operator namespace {namespace} should still exist after workspace delete" + )) + })?; + let labels = found.metadata.labels.unwrap_or_default(); + testkit::ensure!( + labels.get(OPERATOR_LABEL).map(String::as_str) == Some("true"), + "the operator label should be intact after workspace delete; labels are {labels:?}" + ); + Ok(()) +} + +/// Removing the operator label from a namespace stops the gateway from +/// creating sandboxes in its workspace. +#[testkit::test] +async fn label_removal_blocks_sandbox_creation(cx: &mut Context) -> testkit::Result { + cx.expect_compute_driver("kubernetes").await?; + let cluster = Cluster::from_env().await?; + let namespace = cx.name("oplbl"); + provision_operator_namespace(cx, &cluster, &namespace).await?; + let workspace = cx.workspace("oplbl").await?; + let first = cx.name("sb1"); + + create_when_admitted(&workspace, &first).await?; + delete_sandbox(&workspace, &first).await?; + + cluster + .update_namespace_labels(&namespace, |labels| { + labels.remove(OPERATOR_LABEL); + }) + .await?; + + let second = cx.name("sb2"); + workspace.track_sandbox(&second); + let client = workspace.client(); + testkit::poll_until( + &format!("the gateway to stop admitting namespace {namespace}"), + WATCH_TIMEOUT, + WATCH_INTERVAL, + async || match client.create_sandbox(idle_spec(&second)).await { + Err(error) => expect_not_admitted(error.into()).map(Poll::Ready), + Ok(_) => { + delete_sandbox(&workspace, &second).await?; + Ok(Poll::Pending(format!( + "sandbox {second} was created after the label was removed" + ))) + } + }, + ) + .await +} diff --git a/tests/support/Cargo.lock b/tests/support/Cargo.lock index 83e25ef4da..cd604e8186 100644 --- a/tests/support/Cargo.lock +++ b/tests/support/Cargo.lock @@ -526,6 +526,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "const-oid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a" + [[package]] name = "container-engine-support" version = "0.0.0" @@ -790,6 +796,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4850db49bf08e663084f7fb5c87d202ef91a3907271aff24a94eb97ff039153c" dependencies = [ "block-buffer 0.12.0", + "const-oid", "crypto-common 0.2.2", "ctutils", ] @@ -1309,7 +1316,7 @@ dependencies = [ "tempfile", "tokio", "tokio-rustls", - "tungstenite", + "tungstenite 0.26.2", ] [[package]] @@ -1908,6 +1915,7 @@ dependencies = [ "serde_json", "thiserror 2.0.20", "tokio", + "tokio-tungstenite 0.30.0", "tokio-util", "tower", "tower-http 0.7.1", @@ -1974,6 +1982,19 @@ dependencies = [ "tracing", ] +[[package]] +name = "kube-support" +version = "0.0.0" +dependencies = [ + "k8s-openapi", + "kube", + "openshell-crypto", + "openshell-testkit", + "serde", + "serde_json", + "tokio", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -2582,7 +2603,7 @@ dependencies = [ "thiserror 2.0.20", "tokio", "tokio-rustls", - "tokio-tungstenite", + "tokio-tungstenite 0.26.2", "tonic", "tower", "tracing", @@ -4337,7 +4358,19 @@ dependencies = [ "rustls-pki-types", "tokio", "tokio-rustls", - "tungstenite", + "tungstenite 0.26.2", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17a073bfed563fa236697a068031408a93cd9522e08abf9933ead3e73411bd71" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.30.0", ] [[package]] @@ -4624,6 +4657,22 @@ dependencies = [ "utf-8", ] +[[package]] +name = "tungstenite" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48ac77174b19c110a50ab2128b24215ac9cb40e0e12e093fb602d175c569d22" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.10.2", + "sha1 0.11.0", + "thiserror 2.0.20", +] + [[package]] name = "typenum" version = "1.20.1" diff --git a/tests/support/kube/Cargo.toml b/tests/support/kube/Cargo.toml new file mode 100644 index 0000000000..725d46e21c --- /dev/null +++ b/tests/support/kube/Cargo.toml @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: Apache-2.0 + +[package] +name = "kube-support" +description = "Kubernetes client for driver suites, built from the cluster access a test environment publishes" +version = "0.0.0" +edition = "2024" +rust-version = "1.95" +license = "Apache-2.0" +repository = "https://github.com/ai-openshell/openshell" +publish = false + +[dependencies] +k8s-openapi = { version = "0.29", features = ["v1_33"] } +kube = { version = "=5.2.0", default-features = false, features = ["client", "rustls-tls", "aws-lc-rs", "ws"] } +openshell-crypto = { path = "../../../crates/openshell-crypto" } +openshell-testkit = { path = "../../testkit/testkit" } +serde = "1" +serde_json = "1" +tokio = { version = "1", features = ["io-util", "macros"] } diff --git a/e2e/kubernetes/openbao-tls-values.yaml b/tests/support/kube/fixtures/openbao-values.yaml similarity index 100% rename from e2e/kubernetes/openbao-tls-values.yaml rename to tests/support/kube/fixtures/openbao-values.yaml diff --git a/e2e/kubernetes/postgres-fixture.yaml b/tests/support/kube/fixtures/postgres.yaml similarity index 100% rename from e2e/kubernetes/postgres-fixture.yaml rename to tests/support/kube/fixtures/postgres.yaml diff --git a/tests/support/kube/src/lib.rs b/tests/support/kube/src/lib.rs new file mode 100644 index 0000000000..59c935920e --- /dev/null +++ b/tests/support/kube/src/lib.rs @@ -0,0 +1,383 @@ +// SPDX-License-Identifier: Apache-2.0 + +//! Kubernetes access for driver suites. +//! +//! A Kubernetes environment publishes how tests reach its cluster: +//! +//! | Variable | Meaning | +//! |---|---| +//! | `OPENSHELL_TEST_KUBECONFIG` | A kubeconfig file whose current context is the cluster the gateway runs in | +//! | `OPENSHELL_TEST_KUBE_NAMESPACE` | The namespace of the gateway's Helm release, where it creates sandboxes | +//! | `OPENSHELL_TEST_KUBE_RELEASE` | The gateway's Helm release name | +//! +//! Under `openshell-test-runner`, the tmachine `k3s` and `k3s-ha` installers +//! publish them (`tests/tmachine/ansible/playbooks/openshell-k3s.yaml`). The +//! client is built only from these variables; it never reads `KUBECONFIG` or +//! `~/.kube/config`, so a test can't reach a cluster the environment didn't +//! name. A missing variable fails the test; it never skips it. + +use std::collections::BTreeMap; +use std::fmt; + +use k8s_openapi::api::core::v1::Namespace; +use k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta; +use kube::api::{ApiResource, DeleteParams, DynamicObject, ListParams, PostParams}; +use kube::config::{KubeConfigOptions, Kubeconfig}; +use kube::{Api, Client, Config}; +use testkit::{Error, Result}; + +pub use k8s_openapi; +pub use kube; + +pub const KUBECONFIG_ENV: &str = "OPENSHELL_TEST_KUBECONFIG"; +pub const NAMESPACE_ENV: &str = "OPENSHELL_TEST_KUBE_NAMESPACE"; +pub const RELEASE_ENV: &str = "OPENSHELL_TEST_KUBE_RELEASE"; + +/// The Agent Sandbox API group the Kubernetes driver stores sandboxes in. +pub const SANDBOX_GROUP: &str = "agents.x-k8s.io"; +/// The label the driver puts on each sandbox's objects with its name. +pub const SANDBOX_NAME_LABEL: &str = "openshell.ai/sandbox-name"; +/// The label the driver puts on each sandbox's objects with its ID. +pub const SANDBOX_ID_LABEL: &str = "openshell.ai/sandbox-id"; + +/// Add context to a Kubernetes client result. +pub trait KubeResultExt { + fn kube_context(self, context: impl fmt::Display) -> Result; +} + +impl KubeResultExt for kube::Result { + fn kube_context(self, context: impl fmt::Display) -> Result { + self.map_err(|error| Error::msg(format!("{context}: {error}"))) + } +} + +/// The cluster the gateway runs in, and the release's namespace. +#[derive(Clone)] +pub struct Cluster { + client: Client, + namespace: String, + release: String, +} + +impl Cluster { + /// Connect to the cluster the environment publishes. + pub async fn from_env() -> Result { + let path = testkit::required_env(KUBECONFIG_ENV, "a kubeconfig for the gateway's cluster")?; + let namespace = + testkit::required_env(NAMESPACE_ENV, "the namespace of the gateway's Helm release")?; + let release = testkit::required_env(RELEASE_ENV, "the gateway's Helm release name")?; + let kubeconfig = Kubeconfig::read_from(&path) + .map_err(|error| Error::msg(format!("read {KUBECONFIG_ENV} {path}: {error}")))?; + let config = Config::from_custom_kubeconfig(kubeconfig, &KubeConfigOptions::default()) + .await + .map_err(|error| Error::msg(format!("load {KUBECONFIG_ENV} {path}: {error}")))?; + openshell_crypto::tls::ensure_default_provider(); + let client = Client::try_from(config).kube_context("build the Kubernetes client")?; + Ok(Self { + client, + namespace, + release, + }) + } + + pub fn client(&self) -> &Client { + &self.client + } + + pub fn namespace(&self) -> &str { + &self.namespace + } + + pub fn release(&self) -> &str { + &self.release + } + + /// An API for namespaced objects in the release's namespace. + pub fn api(&self) -> Api + where + K: kube::Resource, + ::DynamicType: Default, + { + Api::namespaced(self.client.clone(), &self.namespace) + } + + /// An API for namespaced objects in another namespace. + pub fn api_in(&self, namespace: &str) -> Api + where + K: kube::Resource, + ::DynamicType: Default, + { + Api::namespaced(self.client.clone(), namespace) + } + + /// An API for cluster-scoped objects. + pub fn cluster_api(&self) -> Api + where + K: kube::Resource, + ::DynamicType: Default, + { + Api::all(self.client.clone()) + } + + /// The gateway's ServiceAccount, as Kubernetes authorizes it. The chart + /// names it after the release. + pub fn gateway_service_account(&self) -> String { + format!("system:serviceaccount:{}:{}", self.namespace, self.release) + } + + /// Whether the gateway's ServiceAccount may `verb` `resource` in + /// `namespace`, as `kubectl auth can-i --as` answers it. `resource` is a + /// plural resource name, optionally followed by `/`, such as + /// `secrets/openshell-client-tls`. + pub async fn gateway_can(&self, verb: &str, resource: &str, namespace: &str) -> Result { + use k8s_openapi::api::authorization::v1::{ + ResourceAttributes, SubjectAccessReview, SubjectAccessReviewSpec, + }; + let (resource_name, object_name) = match resource.split_once('/') { + Some((resource, name)) => (resource, Some(name.to_string())), + None => (resource, None), + }; + let user = self.gateway_service_account(); + let review = SubjectAccessReview { + spec: SubjectAccessReviewSpec { + user: Some(user.clone()), + groups: Some(vec![ + "system:serviceaccounts".to_string(), + format!("system:serviceaccounts:{}", self.namespace), + "system:authenticated".to_string(), + ]), + resource_attributes: Some(ResourceAttributes { + namespace: Some(namespace.to_string()), + verb: Some(verb.to_string()), + resource: Some(resource_name.to_string()), + name: object_name, + ..ResourceAttributes::default() + }), + ..SubjectAccessReviewSpec::default() + }, + ..SubjectAccessReview::default() + }; + let review = Api::::all(self.client.clone()) + .create(&PostParams::default(), &review) + .await + .kube_context(format!( + "review whether {user} can {verb} {resource} in {namespace}" + ))?; + Ok(review.status.is_some_and(|status| status.allowed)) + } + + /// The namespace `name`, if it exists. + pub async fn get_namespace(&self, name: &str) -> Result> { + self.cluster_api::() + .get_opt(name) + .await + .kube_context(format!("get namespace {name}")) + } + + /// Create namespace `name` with `labels`, and delete it when the test + /// ends. The delete is registered first, so it also covers a create the + /// API server applied but reported as failed. + pub async fn create_namespace( + &self, + cx: &testkit::Context, + name: &str, + labels: &[(&str, &str)], + ) -> Result { + self.delete_namespace_on_cleanup(cx, name); + let namespace = Namespace { + metadata: ObjectMeta { + name: Some(name.to_string()), + labels: Some( + labels + .iter() + .map(|(key, value)| ((*key).to_string(), (*value).to_string())) + .collect(), + ), + ..ObjectMeta::default() + }, + ..Namespace::default() + }; + self.cluster_api::() + .create(&PostParams::default(), &namespace) + .await + .kube_context(format!("create namespace {name}")) + } + + /// Delete namespace `name`, if it exists, when the test ends, without + /// waiting for it to go. + pub fn delete_namespace_on_cleanup(&self, cx: &testkit::Context, name: &str) { + let api = self.cluster_api::(); + let owned = name.to_string(); + cx.on_cleanup(format!("delete namespace {name}"), async move || match api + .delete(&owned, &DeleteParams::default()) + .await + { + Ok(_) => Ok(()), + Err(kube::Error::Api(status)) if status.code == 404 => Ok(()), + Err(error) => Err(Error::msg(format!("delete namespace {owned}: {error}"))), + }); + } + + /// Replace the labels of namespace `name` with what `update` leaves of + /// them. + pub async fn update_namespace_labels( + &self, + name: &str, + update: impl FnOnce(&mut BTreeMap), + ) -> Result { + let api = self.cluster_api::(); + let mut namespace = api + .get(name) + .await + .kube_context(format!("get namespace {name}"))?; + update(namespace.metadata.labels.get_or_insert_default()); + api.replace(name, &PostParams::default(), &namespace) + .await + .kube_context(format!("replace namespace {name}")) + } + + /// The names of the Agent Sandbox `Sandbox` objects in `namespace`. + pub async fn sandbox_object_names_in(&self, namespace: &str) -> Result> { + let list = self + .sandbox_api_in(namespace) + .await? + .list(&ListParams::default()) + .await + .kube_context(format!("list Sandbox objects in {namespace}"))?; + Ok(list + .items + .into_iter() + .filter_map(|object| object.metadata.name) + .collect()) + } + + /// The Agent Sandbox `Sandbox` resource at the version the cluster + /// prefers, so tests follow the installed Agent Sandbox release. + pub async fn sandbox_resource_type(&self) -> Result { + let group = kube::discovery::group(&self.client, SANDBOX_GROUP) + .await + .kube_context(format!("discover API group {SANDBOX_GROUP}"))?; + let (resource, _) = group.recommended_kind("Sandbox").ok_or_else(|| { + Error::msg(format!("API group {SANDBOX_GROUP} serves no Sandbox kind")) + })?; + Ok(resource) + } + + /// The API for Agent Sandbox `Sandbox` objects in `namespace`. + pub async fn sandbox_api_in(&self, namespace: &str) -> Result> { + let resource = self.sandbox_resource_type().await?; + Ok(Api::namespaced_with( + self.client.clone(), + namespace, + &resource, + )) + } + + /// The one Agent Sandbox `Sandbox` object the driver keeps for the + /// sandbox named `name` in the release's namespace. + pub async fn sandbox_object(&self, name: &str) -> Result { + self.sandbox_object_in(&self.namespace, name).await + } + + /// The one Agent Sandbox `Sandbox` object the driver keeps for the + /// sandbox named `name` in `namespace`. + pub async fn sandbox_object_in(&self, namespace: &str, name: &str) -> Result { + let api = self.sandbox_api_in(namespace).await?; + let list = api + .list(&ListParams::default().labels(&format!("{SANDBOX_NAME_LABEL}={name}"))) + .await + .kube_context(format!("list Sandbox objects for {name} in {namespace}"))?; + match <[DynamicObject; 1]>::try_from(list.items) { + Ok([object]) => Ok(object), + Err(items) => Err(Error::msg(format!( + "expected one Sandbox object for {name} in {namespace}, found {}", + items.len() + ))), + } + } + + /// Replace a `Sandbox` object with `object`, which must carry the + /// resource version it was read at. + pub async fn replace_sandbox_object(&self, object: &DynamicObject) -> Result { + let namespace = object + .metadata + .namespace + .as_deref() + .unwrap_or(&self.namespace); + let name = object + .metadata + .name + .as_deref() + .ok_or_else(|| Error::msg("Sandbox object has no name"))?; + self.sandbox_api_in(namespace) + .await? + .replace(name, &PostParams::default(), object) + .await + .kube_context(format!("replace Sandbox object {namespace}/{name}")) + } +} + +/// The sandbox ID the driver labelled `object` with. +pub fn sandbox_id(object: &DynamicObject) -> Result<&str> { + object + .metadata + .labels + .as_ref() + .and_then(|labels| labels.get(SANDBOX_ID_LABEL)) + .map(String::as_str) + .ok_or_else(|| Error::msg(format!("Sandbox object has no {SANDBOX_ID_LABEL} label"))) +} + +/// The buffered result of a command run in a pod with [`Cluster::exec`]. +#[derive(Debug)] +pub struct PodExecOutput { + pub stdout: String, + pub stderr: String, + /// Whether the command exited 0. + pub success: bool, +} + +impl Cluster { + /// Run `argv` in the first container of pod `pod` in `namespace`, as + /// `kubectl exec` does, and buffer its output. A non-zero exit is + /// returned, not raised. + pub async fn exec(&self, namespace: &str, pod: &str, argv: &[&str]) -> Result { + use k8s_openapi::api::core::v1::Pod; + use kube::api::AttachParams; + use tokio::io::AsyncReadExt as _; + + let what = format!("exec {argv:?} in pod {namespace}/{pod}"); + let mut process = self + .api_in::(namespace) + .exec(pod, argv.iter().copied(), &AttachParams::default()) + .await + .kube_context(&what)?; + let status = process + .take_status() + .ok_or_else(|| Error::msg(format!("{what}: no exit status")))?; + let mut stdout_reader = process + .stdout() + .ok_or_else(|| Error::msg(format!("{what}: no stdout")))?; + let mut stderr_reader = process + .stderr() + .ok_or_else(|| Error::msg(format!("{what}: no stderr")))?; + let mut stdout = Vec::new(); + let mut stderr = Vec::new(); + let (read_stdout, read_stderr) = tokio::join!( + stdout_reader.read_to_end(&mut stdout), + stderr_reader.read_to_end(&mut stderr) + ); + read_stdout.map_err(|error| Error::msg(format!("{what}: read stdout: {error}")))?; + read_stderr.map_err(|error| Error::msg(format!("{what}: read stderr: {error}")))?; + let status = status.await; + process + .join() + .await + .map_err(|error| Error::msg(format!("{what}: {error}")))?; + Ok(PodExecOutput { + stdout: String::from_utf8_lossy(&stdout).into_owned(), + stderr: String::from_utf8_lossy(&stderr).into_owned(), + success: status.is_some_and(|status| status.status.as_deref() == Some("Success")), + }) + } +} diff --git a/tests/testkit/testkit/src/workspace.rs b/tests/testkit/testkit/src/workspace.rs index b068ffb94d..bdf00e754e 100644 --- a/tests/testkit/testkit/src/workspace.rs +++ b/tests/testkit/testkit/src/workspace.rs @@ -7,7 +7,7 @@ use std::collections::HashMap; use std::time::{Duration, Instant}; use openshell_sdk::raw::proto; -use openshell_sdk::{DeleteOptions, OpenShellClient}; +use openshell_sdk::{DeleteOptions, OpenShellClient, WorkspaceScopedClient}; use crate::cleanup::Cleanup; use crate::cli::Cli; @@ -72,6 +72,17 @@ impl Workspace { &self.name } + /// A gateway client scoped to the workspace. Track what it creates with + /// [`Workspace::track_sandbox`] and [`Workspace::track_provider`]. + pub fn client(&self) -> WorkspaceScopedClient { + self.client.workspace(&self.name) + } + + /// The CLI pointed at the workspace. + pub fn cli(&self) -> &Cli { + &self.cli + } + /// Delete sandbox `name` in the workspace when the test ends, before the /// workspace. Call it before the sandbox is created, by whoever creates /// it, so cleanup deletes it even if the test fails first. diff --git a/tests/tmachine/ansible/playbooks/files/k3s-values-ha.yaml b/tests/tmachine/ansible/playbooks/files/k3s-values-ha.yaml new file mode 100644 index 0000000000..f99f47a69b --- /dev/null +++ b/tests/tmachine/ansible/playbooks/files/k3s-values-ha.yaml @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Helm values for the k3s-ha installer: three gateway replicas sharing the +# PostgreSQL database the postgres fixture stages (k3s-postgres.yaml). +replicaCount: 3 +workload: + kind: deployment +server: + externalDbSecret: openshell-e2e-postgres-credentials diff --git a/tests/tmachine/ansible/playbooks/k3s-namespace.yaml b/tests/tmachine/ansible/playbooks/k3s-namespace.yaml new file mode 100644 index 0000000000..48d7d54da6 --- /dev/null +++ b/tests/tmachine/ansible/playbooks/k3s-namespace.yaml @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Create namespace `k3s_namespace` for a fixture an installer stages before +# OpenShell. Include it before the fixture's first kubectl call: the install +# layer boots fresh, so the K3s API may still be starting. +--- +- name: Apply namespace {{ k3s_namespace }} + become: true + ansible.builtin.command: + argv: [/usr/local/bin/k3s, kubectl, apply, --filename, "-"] + stdin: | + apiVersion: v1 + kind: Namespace + metadata: + name: {{ k3s_namespace }} + register: k3s_namespace_apply + until: k3s_namespace_apply.rc == 0 + retries: 30 + delay: 2 diff --git a/tests/tmachine/ansible/playbooks/k3s-openbao.yaml b/tests/tmachine/ansible/playbooks/k3s-openbao.yaml new file mode 100644 index 0000000000..4fc330cb42 --- /dev/null +++ b/tests/tmachine/ansible/playbooks/k3s-openbao.yaml @@ -0,0 +1,133 @@ +# SPDX-License-Identifier: Apache-2.0 + +# A k3s installer fixture: an OpenBao development server for the gateway's +# Vault credential driver (deploy/helm/openshell/ci/values-credential-driver-vault.yaml). +# It serves TLS from its own CA, published to the gateway namespace as +# ConfigMap openbao-ca, and lets ServiceAccount openshell/openshell log in with +# role openshell-gateway. The setup layer (k3s.yaml) staged the chart, its +# values and its image. +--- +- name: Stage OpenBao for the Vault credential driver + hosts: all + become: true + gather_facts: false + vars: + openbao_token: root + openbao_exec: [/usr/local/bin/k3s, kubectl, --namespace, openbao, exec, --stdin, openbao-0, --] + openbao_cli: "{{ openbao_exec + ['env', 'BAO_TOKEN=' ~ openbao_token, 'bao'] }}" + tasks: + - name: Wait for SSH + ansible.builtin.wait_for_connection: + + - name: Create the fixture namespaces + ansible.builtin.include_tasks: k3s-namespace.yaml + vars: + k3s_namespace: "{{ item }}" + loop: [openbao, openshell] + + # The setup layer rendered the chart with the same values to pull its image. + - name: Install OpenBao + ansible.builtin.command: + argv: + - /usr/local/bin/helm + - install + - openbao + - /var/lib/openshell/k3s/openbao.tgz + - --namespace=openbao + - --values=/var/lib/openshell/k3s/openbao-values.yaml + - --set=server.dev.enabled=true + - --set=server.dev.devRootToken={{ openbao_token }} + - --set=injector.enabled=false + - --wait + - --timeout=5m + environment: + KUBECONFIG: /etc/rancher/k3s/k3s.yaml + + - name: Wait for the OpenBao server + ansible.builtin.command: + argv: + - /usr/local/bin/k3s + - kubectl + - --namespace=openbao + - wait + - --for=condition=Ready + - pod/openbao-0 + - --timeout=300s + changed_when: false + + - name: Read the OpenBao CA + ansible.builtin.command: + argv: "{{ openbao_exec + ['cat', '/openbao/tls/vault-ca.pem'] }}" + register: openbao_ca + changed_when: false + + - name: Publish the OpenBao CA to the gateway + ansible.builtin.command: + argv: + - /usr/local/bin/k3s + - kubectl + - --namespace=openshell + - create + - configmap + - openbao-ca + - --from-literal=ca.crt={{ openbao_ca.stdout }} + + # The name the gateway uses, which OpenBao's development certificate covers. + - name: Alias OpenBao in the gateway namespace + ansible.builtin.command: + argv: + - /usr/local/bin/k3s + - kubectl + - --namespace=openshell + - create + - service + - externalname + - openbao-0 + - --external-name=openbao-0.openbao-internal.openbao.svc.cluster.local + + # A development server may already mount secret/ as KV version 2. + - name: Enable the KV store + ansible.builtin.command: + argv: "{{ openbao_cli + ['secrets', 'enable', '-path=secret', 'kv-v2'] }}" + register: openbao_kv + failed_when: openbao_kv.rc != 0 and 'path is already in use' not in openbao_kv.stderr + + - name: Enable Kubernetes auth + ansible.builtin.command: + argv: "{{ openbao_cli + ['auth', 'enable', 'kubernetes'] }}" + + - name: Configure Kubernetes auth + ansible.builtin.command: + argv: >- + {{ openbao_cli + ['write', 'auth/kubernetes/config', + 'kubernetes_host=https://kubernetes.default.svc', + 'kubernetes_ca_cert=@/var/run/secrets/kubernetes.io/serviceaccount/ca.crt'] }} + + - name: Write the provider storage policy + ansible.builtin.command: + argv: "{{ openbao_cli + ['policy', 'write', 'openshell-provider-storage', '-'] }}" + stdin: | + path "secret/data/openshell/provider-credentials/*" { + capabilities = ["create", "read", "update", "delete"] + } + path "secret/metadata/openshell/provider-credentials/*" { + capabilities = ["read", "delete", "list"] + } + + - name: Bind the gateway ServiceAccount to the policy + ansible.builtin.command: + argv: >- + {{ openbao_cli + ['write', 'auth/kubernetes/role/openshell-gateway', + 'bound_service_account_names=openshell', + 'bound_service_account_namespaces=openshell', + 'policies=openshell-provider-storage', + 'ttl=1h'] }} + + - name: Publish OpenBao test variables + ansible.builtin.include_tasks: test-env.yaml + vars: + test_env_name: vault + test_env_vars: + OPENSHELL_TEST_VAULT_NAMESPACE: openbao + OPENSHELL_TEST_VAULT_POD: openbao-0 + OPENSHELL_TEST_VAULT_TOKEN: "{{ openbao_token }}" diff --git a/tests/tmachine/ansible/playbooks/k3s-postgres.yaml b/tests/tmachine/ansible/playbooks/k3s-postgres.yaml new file mode 100644 index 0000000000..ff0ba48113 --- /dev/null +++ b/tests/tmachine/ansible/playbooks/k3s-postgres.yaml @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: Apache-2.0 + +# A k3s installer fixture: the PostgreSQL database an HA gateway shares +# between its replicas. The setup layer (k3s.yaml) staged the manifest and its +# image. +--- +- name: Stage PostgreSQL for the gateway + hosts: all + become: true + gather_facts: false + tasks: + - name: Wait for SSH + ansible.builtin.wait_for_connection: + + - name: Create the OpenShell namespace + ansible.builtin.include_tasks: k3s-namespace.yaml + vars: + k3s_namespace: openshell + + - name: Apply PostgreSQL fixture + ansible.builtin.command: + argv: + - /usr/local/bin/k3s + - kubectl + - --namespace + - openshell + - apply + - --filename + - /var/lib/openshell/k3s/postgres.yaml + + # Gateway Pods that start before the database crash-loop with growing backoff. + - name: Wait for PostgreSQL + ansible.builtin.command: + argv: + - /usr/local/bin/k3s + - kubectl + - --namespace + - openshell + - rollout + - status + - deployment/openshell-e2e-postgres + - --timeout=300s + changed_when: false diff --git a/tests/tmachine/ansible/playbooks/k3s-regcred.yaml b/tests/tmachine/ansible/playbooks/k3s-regcred.yaml new file mode 100644 index 0000000000..741790090f --- /dev/null +++ b/tests/tmachine/ansible/playbooks/k3s-regcred.yaml @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: Apache-2.0 + +# A k3s installer fixture: an image pull Secret sandboxes may attach, for a +# gateway configured with `image_pull_secrets: [e2e-regcred]`. The registry is +# never contacted; tests check where the driver copies the Secret. +--- +- name: Stage an image pull Secret for sandboxes + hosts: all + become: true + gather_facts: false + tasks: + - name: Wait for SSH + ansible.builtin.wait_for_connection: + + - name: Create the OpenShell namespace + ansible.builtin.include_tasks: k3s-namespace.yaml + vars: + k3s_namespace: openshell + + - name: Apply the image pull Secret + ansible.builtin.command: + argv: [/usr/local/bin/k3s, kubectl, --namespace, openshell, apply, --filename, "-"] + stdin: | + apiVersion: v1 + kind: Secret + metadata: + name: e2e-regcred + labels: + openshell.ai/sandbox-attachable: "true" + type: kubernetes.io/dockerconfigjson + stringData: + .dockerconfigjson: '{"auths":{"registry.example.test":{"username":"e2e-user","password":"e2e-password","auth":"ZTJlLXVzZXI6ZTJlLXBhc3N3b3Jk"}}}' diff --git a/tests/tmachine/ansible/playbooks/k3s-workspace-chart.yaml b/tests/tmachine/ansible/playbooks/k3s-workspace-chart.yaml new file mode 100644 index 0000000000..4a40fcf028 --- /dev/null +++ b/tests/tmachine/ansible/playbooks/k3s-workspace-chart.yaml @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: Apache-2.0 + +# A k3s installer fixture: the openshell-workspace chart, which an operator +# installs into each namespace it provisions for a workspace. Tests install it +# themselves, so this only gives them the packaged chart. +--- +- name: Give tests the workspace chart + hosts: all + become: true + gather_facts: false + tasks: + - name: Wait for SSH + ansible.builtin.wait_for_connection: + + # test-env.yaml creates /etc/openshell-test, so publish before copying. + - name: Publish the workspace chart test variable + ansible.builtin.include_tasks: test-env.yaml + vars: + test_env_name: workspace-chart + test_env_vars: + OPENSHELL_TEST_KUBE_WORKSPACE_CHART: /etc/openshell-test/openshell-workspace.tgz + + - name: Copy the workspace chart + ansible.builtin.copy: + src: "{{ openshell_workspace_helm_chart }}" + dest: /etc/openshell-test/openshell-workspace.tgz + owner: tmachine + group: tmachine + mode: "0644" diff --git a/tests/tmachine/ansible/playbooks/k3s.yaml b/tests/tmachine/ansible/playbooks/k3s.yaml index 50b7eb15f0..1a28a9e617 100644 --- a/tests/tmachine/ansible/playbooks/k3s.yaml +++ b/tests/tmachine/ansible/playbooks/k3s.yaml @@ -77,6 +77,60 @@ environment: DESIRED_VERSION: "v{{ helm_version }}" + # Installers run on every CI run, because their layer holds per-commit + # images, but this layer is cached. Stage what installers deploy besides + # OpenShell here, so they need no network: the Agent Sandbox manifest, the + # fixture charts and the images of everything they deploy. + - name: Create the K3s staging directory + ansible.builtin.file: + path: /var/lib/openshell/k3s + state: directory + mode: "0755" + + - name: Stage the Agent Sandbox manifest and fixtures + ansible.builtin.copy: + src: "{{ item.src }}" + dest: "/var/lib/openshell/k3s/{{ item.name }}" + mode: "0644" + loop: + - name: agent-sandbox.yaml + src: "{{ agent_sandbox_manifest }}" + - name: openbao.tgz + src: "{{ openbao_chart }}" + - name: openbao-values.yaml + src: "{{ openbao_fixture_values }}" + - name: postgres.yaml + src: "{{ postgres_fixture }}" + + # The installer (k3s-openbao.yaml) sets the same values. + - name: Render the OpenBao fixture + ansible.builtin.command: + argv: + - /usr/local/bin/helm + - template + - openbao + - /var/lib/openshell/k3s/openbao.tgz + - --values=/var/lib/openshell/k3s/openbao-values.yaml + - --set=server.dev.enabled=true + - --set=injector.enabled=false + register: k3s_openbao_render + changed_when: false + + - name: Pull the images the staged manifests use + vars: + k3s_staged_manifests: >- + {{ lookup('ansible.builtin.file', agent_sandbox_manifest) }} + {{ lookup('ansible.builtin.file', postgres_fixture) }} + {{ k3s_openbao_render.stdout }} + k3s_image_pattern: 'image:[ \t]*"?([^\s"]+)' + ansible.builtin.command: + argv: [/usr/local/bin/k3s, crictl, pull, "{{ item }}"] + loop: "{{ k3s_staged_manifests | regex_findall(k3s_image_pattern) | unique }}" + register: k3s_image_pull + until: k3s_image_pull.rc == 0 + retries: 5 + delay: 10 + # This layer is cached across runs, so it must not carry cluster # credentials: every disk built on it would share one CA, token and admin # kubeconfig. Stop K3s and delete the state it created on first start, diff --git a/tests/tmachine/ansible/playbooks/openshell-k3s-ha.yaml b/tests/tmachine/ansible/playbooks/openshell-k3s-ha.yaml deleted file mode 100644 index 3518cc1a7f..0000000000 --- a/tests/tmachine/ansible/playbooks/openshell-k3s-ha.yaml +++ /dev/null @@ -1,106 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - ---- -- name: Stage PostgreSQL for the HA gateway - hosts: all - become: true - gather_facts: false - tasks: - - name: Wait for SSH - ansible.builtin.wait_for_connection: - - # The install layer boots fresh, so the K3s API may still be starting. - - name: Apply OpenShell namespace - ansible.builtin.command: - argv: [/usr/local/bin/k3s, kubectl, apply, --filename, "-"] - stdin: | - apiVersion: v1 - kind: Namespace - metadata: - name: openshell - register: k3s_namespace - until: k3s_namespace.rc == 0 - retries: 30 - delay: 2 - - - name: Apply PostgreSQL fixture - ansible.builtin.command: - argv: [/usr/local/bin/k3s, kubectl, --namespace, openshell, apply, --filename, "-"] - stdin: "{{ lookup('ansible.builtin.file', openshell_postgres_fixture) }}" - - # Gateway Pods that start before the database crash-loop with growing backoff. - - name: Wait for PostgreSQL - ansible.builtin.command: - argv: - - /usr/local/bin/k3s - - kubectl - - --namespace - - openshell - - rollout - - status - - deployment/openshell-e2e-postgres - - --timeout=300s - changed_when: false - -- import_playbook: openshell-k3s.yaml - vars: - openshell_k3s_helm_values_overlay: | - replicaCount: 3 - workload: - kind: deployment - server: - externalDbSecret: openshell-e2e-postgres-credentials - disableTls: false - -- name: Register the HA gateway over mTLS - hosts: all - become: true - gather_facts: false - tasks: - # The chart's server certificate covers the Service DNS name but not its - # ClusterIP, and the node resolver cannot reach cluster DNS. - - name: Resolve the gateway Service name to its ClusterIP - ansible.builtin.lineinfile: - path: /etc/hosts - regexp: '\sopenshell\.openshell\.svc\.cluster\.local$' - line: "{{ k3s_gateway_ip }} openshell.openshell.svc.cluster.local" - - - name: Read chart client TLS Secret - ansible.builtin.command: - argv: [/usr/local/bin/k3s, kubectl, --namespace, openshell, get, secret, openshell-client-tls, --output, json] - register: k3s_client_tls - changed_when: false - no_log: true - - - name: Create guest mTLS directory - ansible.builtin.file: - path: /home/tmachine/.config/openshell/gateways/tmachine/mtls - state: directory - owner: tmachine - group: tmachine - mode: "0700" - - - name: Write guest client TLS bundle - ansible.builtin.copy: - content: "{{ (k3s_client_tls.stdout | from_json).data[item] | b64decode }}" - dest: "/home/tmachine/.config/openshell/gateways/tmachine/mtls/{{ item }}" - owner: tmachine - group: tmachine - mode: "0600" - loop: [ca.crt, tls.crt, tls.key] - no_log: true - - # The base playbook registered a plaintext endpoint; replace it. - - name: Remove baseline guest gateway registration - become: false - ansible.builtin.command: - argv: [/usr/local/bin/openshell, gateway, remove, tmachine] - - - name: Register guest gateway - ansible.builtin.include_role: - name: openshell_client - apply: - become: false - vars: - openshell_client_gateway_endpoint: "https://openshell.openshell.svc.cluster.local:{{ k3s_gateway_port }}" diff --git a/tests/tmachine/ansible/playbooks/openshell-k3s.yaml b/tests/tmachine/ansible/playbooks/openshell-k3s.yaml index 7a1fab8ed1..7e1cabbd90 100644 --- a/tests/tmachine/ansible/playbooks/openshell-k3s.yaml +++ b/tests/tmachine/ansible/playbooks/openshell-k3s.yaml @@ -2,10 +2,22 @@ # SPDX-License-Identifier: Apache-2.0 --- +# The installer's inputs (tests/tmachine/config.nix, k3sInstaller) shape the +# install: +# +# - openshell_k3s_values_: Helm values files, applied in order after the +# base values below. +# - openshell_k3s_tls: "true" serves the gateway over mTLS and registers the +# client with the chart's client certificate. +# - openshell_k3s_test_env_: published to tests as . - name: Install OpenShell on K3s hosts: all become: true gather_facts: false + vars: + k3s_tls: "{{ openshell_k3s_tls | default(false) | bool }}" + k3s_values: "{{ query('ansible.builtin.varnames', '^openshell_k3s_values_[0-9]+$') | sort }}" + k3s_test_env_inputs: "{{ query('ansible.builtin.varnames', '^openshell_k3s_test_env_') | sort }}" tasks: - name: Wait for SSH ansible.builtin.wait_for_connection: @@ -127,16 +139,18 @@ server: auth: allowUnauthenticatedUsers: true - disableTls: true + disableTls: {{ (not k3s_tls) | string | lower }} hostGatewayIP: "{{ k3s_node_ip }}" telemetryEnabled: false - - name: Write OpenShell Helm values overlay + - name: Copy the installer's Helm values ansible.builtin.copy: - dest: /var/lib/openshell/artifacts/values-overlay.yaml + src: "{{ lookup('ansible.builtin.vars', item) }}" + dest: "/var/lib/openshell/artifacts/{{ item }}.yaml" mode: "0600" - content: "{{ openshell_k3s_helm_values_overlay | default('{}') }}" + loop: "{{ k3s_values }}" + # Staged by the setup layer (k3s.yaml). - name: Install Agent Sandbox ansible.builtin.command: argv: @@ -144,7 +158,7 @@ - kubectl - apply - --filename - - "https://github.com/kubernetes-sigs/agent-sandbox/releases/download/v{{ agent_sandbox_version }}/manifest.yaml" + - /var/lib/openshell/k3s/agent-sandbox.yaml - name: Wait for Agent Sandbox CRD ansible.builtin.command: @@ -172,23 +186,51 @@ - name: Install OpenShell Helm chart ansible.builtin.command: - argv: - - /usr/local/bin/helm - - install - - openshell - - /var/lib/openshell/artifacts/helm-chart.tgz - - --namespace - - openshell - - --create-namespace - - --values - - /var/lib/openshell/artifacts/values.yaml - - --values - - /var/lib/openshell/artifacts/values-overlay.yaml - - --wait - - --timeout=5m + argv: >- + {{ + ['/usr/local/bin/helm', 'install', 'openshell', + '/var/lib/openshell/artifacts/helm-chart.tgz', + '--namespace', 'openshell', '--create-namespace', + '--values', '/var/lib/openshell/artifacts/values.yaml'] + + (k3s_values + | map('regex_replace', '^', '--values=/var/lib/openshell/artifacts/') + | map('regex_replace', '$', '.yaml') | list) + + ['--wait', '--timeout=5m'] + }} environment: KUBECONFIG: /etc/rancher/k3s/k3s.yaml + # The Kubernetes driver suite inspects the objects the driver keeps for + # its sandboxes. See tests/support/kube. test-env.yaml creates + # /etc/openshell-test, so publish before copying the kubeconfig there. + - name: Publish Kubernetes test variables + ansible.builtin.include_tasks: test-env.yaml + vars: + test_env_name: kube + test_env_vars: + OPENSHELL_TEST_KUBECONFIG: /etc/openshell-test/kubeconfig + OPENSHELL_TEST_KUBE_NAMESPACE: openshell + OPENSHELL_TEST_KUBE_RELEASE: openshell + + - name: Publish the installer's test variables + ansible.builtin.include_tasks: test-env.yaml + vars: + test_env_name: installer + test_env_vars: >- + {{ dict(k3s_test_env_inputs + | map('regex_replace', '^openshell_k3s_test_env_', '') + | zip(query('ansible.builtin.vars', *k3s_test_env_inputs))) }} + when: k3s_test_env_inputs | length > 0 + + - name: Give the test user the cluster's kubeconfig + ansible.builtin.copy: + src: /etc/rancher/k3s/k3s.yaml + remote_src: true + dest: /etc/openshell-test/kubeconfig + owner: tmachine + group: tmachine + mode: "0600" + - name: Discover the gateway ClusterIP and gRPC port ansible.builtin.command: argv: @@ -222,6 +264,56 @@ k3s_gateway_port: "{{ gateway_port }}" k3s_gateway_authority: "{{ ('[' ~ gateway_ip ~ ']') if ':' in gateway_ip else gateway_ip }}:{{ gateway_port }}" + # The chart's server certificate covers the Service DNS name but not its + # ClusterIP, and the node resolver cannot reach cluster DNS. + - name: Resolve the gateway Service name to its ClusterIP + ansible.builtin.lineinfile: + path: /etc/hosts + regexp: '\sopenshell\.openshell\.svc\.cluster\.local$' + line: "{{ k3s_gateway_ip }} openshell.openshell.svc.cluster.local" + when: k3s_tls + + - name: Read chart client TLS Secret + ansible.builtin.command: + argv: [/usr/local/bin/k3s, kubectl, --namespace, openshell, get, secret, openshell-client-tls, --output, json] + register: k3s_client_tls + changed_when: false + no_log: true + when: k3s_tls + + # The client registers the gateway after this, so create every directory + # it writes to as the test user. + - name: Create guest mTLS directory + ansible.builtin.file: + path: "/home/tmachine/{{ item }}" + state: directory + owner: tmachine + group: tmachine + loop: + - .config + - .config/openshell + - .config/openshell/gateways + - .config/openshell/gateways/tmachine + - .config/openshell/gateways/tmachine/mtls + when: k3s_tls + + - name: Restrict guest mTLS directory + ansible.builtin.file: + path: /home/tmachine/.config/openshell/gateways/tmachine/mtls + mode: "0700" + when: k3s_tls + + - name: Write guest client TLS bundle + ansible.builtin.copy: + content: "{{ (k3s_client_tls.stdout | from_json).data[item] | b64decode }}" + dest: "/home/tmachine/.config/openshell/gateways/tmachine/mtls/{{ item }}" + owner: tmachine + group: tmachine + mode: "0600" + loop: [ca.crt, tls.crt, tls.key] + no_log: true + when: k3s_tls + # Deployment readiness doesn't establish that the controller reconciles # Sandboxes. This checks the installed cluster; a booted guest restarts the # controller, so the test runner checks again after it boots @@ -233,6 +325,9 @@ hosts: all gather_facts: false vars: - openshell_client_gateway_endpoint: "http://{{ k3s_gateway_authority }}" + openshell_client_gateway_endpoint: >- + {{ ('https://openshell.openshell.svc.cluster.local:' ~ k3s_gateway_port) + if openshell_k3s_tls | default(false) | bool + else ('http://' ~ k3s_gateway_authority) }} roles: - openshell_client diff --git a/tests/tmachine/artifacts.nix b/tests/tmachine/artifacts.nix index 9f09e539ad..44ee3df1f3 100644 --- a/tests/tmachine/artifacts.nix +++ b/tests/tmachine/artifacts.nix @@ -513,6 +513,7 @@ rec { mkdir -p artifacts/helm helm package deploy/helm/openshell --destination artifacts/helm + helm package deploy/helm/openshell-workspace --destination artifacts/helm ''; }; diff --git a/tests/tmachine/config.nix b/tests/tmachine/config.nix index 02d563d366..b94361b8f4 100644 --- a/tests/tmachine/config.nix +++ b/tests/tmachine/config.nix @@ -75,6 +75,18 @@ let url = "https://raw.githubusercontent.com/k3s-io/k3s/v${pkgs.lib.escapeURL k3sVersion}/install.sh"; sha256 = "9ca7930c31179d83bc13de20078fd8ad3e1ee00875b31f39a7e524ca4ef7d9de"; }}"; + # What k3s installers deploy besides OpenShell, staged in the cached setup + # layer with the images it uses (ansible/playbooks/k3s.yaml). + agent_sandbox_manifest = "${pkgs.fetchurl { + url = "https://github.com/kubernetes-sigs/agent-sandbox/releases/download/v0.5.0/manifest.yaml"; + sha256 = "ccfe3649de8b33f0ee0ec635e2c7b40e1c468ad9fde6aac7c7379501327d9c4c"; + }}"; + openbao_chart = "${pkgs.fetchurl { + url = "https://github.com/openbao/openbao-helm/releases/download/openbao-0.28.3/openbao-0.28.3.tgz"; + sha256 = "8612ab52ca1383b61dbf54c0a40691aaeba2bb9f4e542134c9ad06fce15a907c"; + }}"; + openbao_fixture_values = "../support/kube/fixtures/openbao-values.yaml"; + postgres_fixture = "../support/kube/fixtures/postgres.yaml"; }; # The setup of an environment built on `parent`: its playbooks and inputs, # then `extra`'s. A parent with a compute driver also passes it as @@ -91,7 +103,6 @@ let # Every installer loads the sandbox workload image tests run python3 in. e2ePythonImage = "../../artifacts/images/openshell-e2e-python-dev.tar"; k3sInputs = { - agent_sandbox_version = "0.5.0"; openshell_cli_binary = "../../artifacts/binaries/${muslTarget}/openshell"; openshell_e2e_python_image = e2ePythonImage; openshell_gateway_image = "../../artifacts/images/openshell-gateway-tmachine.tar"; @@ -99,6 +110,43 @@ let openshell_sandbox_image = "../../artifacts/images/openshell-sandbox-tmachine.tar"; openshell_supervisor_image = "../../artifacts/images/openshell-supervisor-tmachine.tar"; }; + # An installer that deploys OpenShell on k3s with the Helm chart + # (ansible/playbooks/openshell-k3s.yaml). Each `fixtures` entry names a + # playbook, ansible/playbooks/k3s-.yaml, that stages something the + # gateway depends on first. `values` are Helm values files applied in order + # after the base values, `tls` serves the gateway over mTLS, and `testEnv` + # is published to tests. Each installer is one disk layer, so installers + # share playbooks, not work. + k3sInstaller = + { + name, + fixtures ? [ ], + values ? [ ], + tls ? false, + testEnv ? { }, + inputs ? { }, + }: + { + inherit name; + use_galaxy = false; + playbooks = map (fixture: "ansible/playbooks/k3s-${fixture}.yaml") fixtures ++ [ + "ansible/playbooks/openshell-k3s.yaml" + ]; + inputs = + k3sInputs + // inputs + // pkgs.lib.optionalAttrs tls { openshell_k3s_tls = "true"; } + // builtins.listToAttrs ( + pkgs.lib.imap0 (index: file: { + name = "openshell_k3s_values_${pkgs.lib.fixedWidthNumber 2 index}"; + value = file; + }) values + ) + // pkgs.lib.mapAttrs' ( + name: pkgs.lib.nameValuePair "openshell_k3s_test_env_${name}" + ) testEnv; + }; + chartValues = file: "../../deploy/helm/openshell/ci/${file}"; fedoraPodman = podman: { machine = "fedora"; driver = "podman"; @@ -213,20 +261,41 @@ let ++ podmanUsernsEnvironments; installers = [ - { - name = "k3s"; - use_galaxy = false; - playbooks = [ "ansible/playbooks/openshell-k3s.yaml" ]; - inputs = k3sInputs; - } - { + (k3sInstaller { name = "k3s"; }) + (k3sInstaller { name = "k3s-ha"; - use_galaxy = false; - playbooks = [ "ansible/playbooks/openshell-k3s-ha.yaml" ]; - inputs = k3sInputs // { - openshell_postgres_fixture = "../../e2e/kubernetes/postgres-fixture.yaml"; - }; - } + fixtures = [ "postgres" ]; + values = [ "ansible/playbooks/files/k3s-values-ha.yaml" ]; + tls = true; + }) + (k3sInstaller { + name = "k3s-workspace-managed"; + fixtures = [ "regcred" ]; + values = [ + (chartValues "values-workspace-managed.yaml") + (chartValues "values-credential-driver-kubernetes-secrets.yaml") + ]; + # The supervisor reads the client certificate only with TLS on. + tls = true; + testEnv.OPENSHELL_TEST_KUBE_IMAGE_PULL_SECRET = "e2e-regcred"; + }) + (k3sInstaller { + name = "k3s-workspace-operator"; + fixtures = [ "workspace-chart" ]; + values = [ (chartValues "values-workspace-operator.yaml") ]; + inputs.openshell_workspace_helm_chart = "../../artifacts/helm/openshell-workspace-0.0.0.tgz"; + }) + (k3sInstaller { + name = "k3s-credentials-secrets"; + values = [ (chartValues "values-credential-driver-kubernetes-secrets.yaml") ]; + testEnv.OPENSHELL_TEST_CREDENTIAL_DRIVER = "kubernetes-secrets"; + }) + (k3sInstaller { + name = "k3s-credentials-vault"; + fixtures = [ "openbao" ]; + values = [ (chartValues "values-credential-driver-vault.yaml") ]; + testEnv.OPENSHELL_TEST_CREDENTIAL_DRIVER = "vault"; + }) { name = "none"; use_galaxy = false;