-
Notifications
You must be signed in to change notification settings - Fork 51
test(bdd): single-cluster PKI feature with a secured LLM invoke #1075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
along-2017
wants to merge
8
commits into
main
Choose a base branch
from
test/bdd/pki-single-cluster
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+433
−0
Draft
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a650f62
test(bdd): single-cluster PKI feature with a secured LLM invoke
along-2017 96b364f
test(bdd): make the agentConfig replacement position-independent
along-2017 29d7084
test(bdd): supply the required PKI render values
along-2017 a389a1b
test(bdd): rename the PKI feature and tighten comments
along-2017 5407a56
test(bdd): rely on the api chart's worker client sidecar default
along-2017 8014347
test(bdd): pin the migrations tag through the shared knob
along-2017 96318c3
test(bdd): address review on the trust script and wiring test
along-2017 786f13c
Revert "test(bdd): pin the migrations tag through the shared knob"
along-2017 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,207 @@ | ||
| @ncp-local @single-cluster @helmfile @pki | ||
| Feature: Install a local single-cluster NVCF stack with PKI-secured LLM transport | ||
| As a self-managed NVCF operator, | ||
| I want the Helmfile workflow with the LLM PKI addon enabled, | ||
| so that an LLM function answers invocations over a QUIC tunnel whose | ||
| trust chain is issued by the stack's own PKI. | ||
|
|
||
| # This feature owns its Helmfile environment (local-bdd-pki) so the | ||
| # default fixtures and the non-PKI features stay unchanged. PKI | ||
| # enablement is an install-time value: addons.llm.pki.enabled gates | ||
| # the nvcf-pki release and the stargate Certificate at render. | ||
| # The compute plane's trust configuration is written by | ||
| # tests/bdd/scripts/write-transport-trust-env.sh after the control | ||
| # plane is installed, because the trust bundle (the OpenBao root CA | ||
| # public cert plus its nvcf-trust-bundle-v1 fingerprint) only exists | ||
| # once OpenBao is up. The script replaces the fixture's agentConfig | ||
| # block, which also drops stargateQUICInsecure: the tunnel runs in | ||
| # secure mode and NVCA rejects bundle trust combined with insecure | ||
| # QUIC. | ||
|
|
||
| Rule: Helmfile installs the control plane with the LLM PKI addon | ||
|
|
||
| Background: | ||
| Given these environment variables are set: | ||
| | name | | ||
| | NGC_API_KEY | | ||
| | SAMPLE_NGC_ORG | | ||
| | SAMPLE_NGC_TEAM | | ||
| And I copy the file "tests/bdd/fixtures/self-managed-local-bdd.yaml" to "deploy/stacks/self-managed/environments/local-bdd-pki.yaml" | ||
| # PKI render contract: dnsNames must cover the router's | ||
| # advertised hostname (single replica advertises its plain | ||
| # service DNS name); allowedDomains constrains the OpenBao | ||
| # signing role; the PKI provisioning hook needs the | ||
| # nvcf-openbao-migrations tag (same image the openbao chart | ||
| # runs, whose published default is pinned here). | ||
| And I update yaml file "deploy/stacks/self-managed/environments/local-bdd-pki.yaml" with keys: | ||
| | global.imagePullSecrets[0].name | nvcr-pull-secret | | ||
| | global.helm.sources.repository | ${SAMPLE_NGC_ORG}/${SAMPLE_NGC_TEAM} | | ||
| | global.image.repository | ${SAMPLE_NGC_ORG}/${SAMPLE_NGC_TEAM} | | ||
| | api.env.NVCF_SIDECARS_LLM_ROUTER_CLIENT_IMAGE | nvcr.io/${SAMPLE_NGC_ORG}/${SAMPLE_NGC_TEAM}/stargate-client:0.2.0 | | ||
| | addons.llm.pki.enabled | true | | ||
| | addons.llm.pki.dnsNames[0] | llm-request-router.nvcf.svc.cluster.local | | ||
| | addons.llm.pki.allowedDomains | nvcf.svc.cluster.local | | ||
| | addons.llm.pki.image.tag | 0.16.2 | | ||
| | observability.profile | disabled | | ||
| And I copy the file "tests/bdd/fixtures/nvcf-compute-plane-local-bdd.yaml" to "deploy/stacks/nvcf-compute-plane/environments/local-bdd-pki.yaml" | ||
| And I update yaml file "deploy/stacks/nvcf-compute-plane/environments/local-bdd-pki.yaml" with keys: | ||
| | global.imagePullSecrets[0].name | nvcr-pull-secret | | ||
| | global.helm.sources.repository | ${SAMPLE_NGC_ORG}/${SAMPLE_NGC_TEAM} | | ||
| | global.image.repository | ${SAMPLE_NGC_ORG}/${SAMPLE_NGC_TEAM} | | ||
| | observability.profile | disabled | | ||
| And I copy the file "deploy/stacks/self-managed/secrets/secrets.yaml.template" to "deploy/stacks/self-managed/secrets/local-bdd-pki-secrets.yaml" | ||
| And I substitute "REPLACE_WITH_BASE64_DOCKER_CREDENTIAL" in file "deploy/stacks/self-managed/secrets/local-bdd-pki-secrets.yaml" with base64 of "$oauthtoken:${NGC_API_KEY}" | ||
| # Conflict precheck: ncp-local-cp's k3d serverlb claims | ||
| # 0.0.0.0:8080/8443/10081, NATS on 4222, and the worker | ||
| # callback port 10086, overlapping host ports single-cluster | ||
| # ncp-local needs. Fail loudly so the operator runs | ||
| # `make -C tools/ncp-local-cluster destroy-multicluster` | ||
| # before retrying. `k3d cluster get` exits 1 when absent (k3d v5). | ||
| Given I run command "k3d cluster get ncp-local-cp" | ||
| And the command exit code should be 1 | ||
| And a single-cluster ncp-local cluster is running | ||
| And the "nvcr-pull-secret" image pull secret exists in namespaces: | ||
| | cassandra-system | | ||
| | nats-system | | ||
| | nvcf | | ||
| | api-keys | | ||
| | ess | | ||
| | sis | | ||
| | vault-system | | ||
| | nvca-operator | | ||
| | cert-manager | | ||
|
|
||
| @llm-pki-install | ||
| Scenario: Operator installs the control plane with the PKI addon enabled | ||
| When I run command "make -C deploy/stacks/self-managed install HELMFILE_ENV=local-bdd-pki" | ||
|
|
||
| Then the command exit code should be 0 | ||
|
|
||
| Then these Helm releases should be deployed using context "k3d-ncp-local": | ||
| | name | namespace | | ||
| | nats | nats-system | | ||
| | cert-manager | cert-manager | | ||
| | openbao-server | vault-system | | ||
| | nvcf-pki | cert-manager | | ||
| | cassandra | cassandra-system | | ||
| | api-keys | api-keys | | ||
| | sis | sis | | ||
| | api | nvcf | | ||
| | nvct-api | nvcf | | ||
| | invocation-service | nvcf | | ||
| | grpc-proxy | nvcf | | ||
| | ess-api | ess | | ||
| | notary-service | nvcf | | ||
| | admin-issuer-proxy | api-keys | | ||
| | reval | nvcf | | ||
| | nats-auth-callout-service | nats-system | | ||
| | ingress | envoy-gateway-system | | ||
| | llm-request-router | nvcf | | ||
| | llm-api-gateway | nvcf | | ||
|
|
||
| # The issuer and the stargate leaf are functional gates for the | ||
| # secure tunnel: the router cannot serve TLS before cert-manager | ||
| # writes the stargate-quic-tls Secret. | ||
| When I run command "kubectl wait clusterissuer nvcf-openbao-pki --for=condition=Ready --timeout=5m" | ||
| Then the command exit code should be 0 | ||
|
|
||
| When I run command "kubectl wait certificate stargate-quic-tls -n nvcf --for=condition=Ready --timeout=5m" | ||
| Then the command exit code should be 0 | ||
|
|
||
| Rule: The compute plane installs with bundle trust distributed from OpenBao | ||
|
|
||
| Background: | ||
| Given these environment variables are set: | ||
| | name | | ||
| | NVCF_CLI | | ||
| | REPO_ROOT | | ||
| # This rule depends on the earlier control-plane install scenario | ||
| # in the same feature run. The @llm-pki-nvca scenario is not a | ||
| # standalone tag target. | ||
|
|
||
| @llm-pki-nvca | ||
| Scenario: Operator registers the cluster and installs NVCA with bundle trust | ||
| When I run command: | ||
| """ | ||
| make -C deploy/stacks/nvcf-compute-plane register-cluster CLUSTER_NAME=ncp-local NVCF_CLI=${NVCF_CLI} NVCF_CLI_CONFIG=${REPO_ROOT}/tests/bdd/fixtures/nvcf-cli-local.yaml | ||
| """ | ||
| Then the command exit code should be 0 | ||
| And file "deploy/stacks/nvcf-compute-plane/registration/ncp-local-register-values.yaml" should exist | ||
|
|
||
| # Fetch the root CA public cert from OpenBao, compute the | ||
| # canonical fingerprint, and write the transportTLS bundle block | ||
| # into the compute environment authored by the Background. | ||
| When I run command: | ||
| """ | ||
| tests/bdd/scripts/write-transport-trust-env.sh deploy/stacks/nvcf-compute-plane/environments/local-bdd-pki.yaml | ||
| """ | ||
| Then the command exit code should be 0 | ||
| And the command output should contain "wrote transportTLS bundle config" | ||
|
|
||
| When I run command: | ||
| """ | ||
| make -C deploy/stacks/nvcf-compute-plane install CLUSTER_NAME=ncp-local HELMFILE_ENV=local-bdd-pki NVCF_CLI=${NVCF_CLI} NVCF_CLI_CONFIG=${REPO_ROOT}/tests/bdd/fixtures/nvcf-cli-local.yaml | ||
| """ | ||
| Then the command exit code should be 0 | ||
|
|
||
| Then these Helm releases should be deployed using context "k3d-ncp-local": | ||
| | name | namespace | | ||
| | nvca-operator | nvca-operator | | ||
|
|
||
| When I run command "kubectl rollout status deployment/nvca-operator -n nvca-operator --timeout=10m" | ||
| Then the command exit code should be 0 | ||
|
|
||
| When I run command "kubectl wait nvcfbackend ncp-local -n nvca-operator --for=jsonpath={.status.agentStatus}=healthy --timeout=10m" | ||
| Then the command exit code should be 0 | ||
|
|
||
| Rule: An LLM function answers invocations over the secured tunnel | ||
|
|
||
| # Depends on the earlier install and registration scenarios in this | ||
| # feature run; not a standalone tag target. The scenario body is | ||
| # the same as the non-PKI feature's LLM scenario: the invoke | ||
| # succeeding here proves the trust chain end to end, because the | ||
| # worker's tunnel to stargate runs in secure mode and validates | ||
| # the served certificate chain against the injected root. | ||
| @llm-function-type | ||
| Scenario: Operator creates, deploys, and invokes an LLM-type function over the secured tunnel | ||
| When I run command: | ||
| """ | ||
| ${NVCF_CLI} --config ${REPO_ROOT}/tests/bdd/fixtures/nvcf-cli-local.yaml function create --name bdd-pki-openai-compatible-sample --image nvcr.io/${SAMPLE_NGC_ORG}/${SAMPLE_NGC_TEAM}/nvcf-openai-compatible-sample:local --function-type LLM --inference-url /v1/chat/completions --inference-port 8000 --health-uri /health --health-port 8000 --health-timeout PT30S --llm-model 'name=openai-compatible-sample,uris=/v1/chat/completions|/v1/embeddings,routingMethod=round_robin' | ||
| """ | ||
| Then the command exit code should be 0 | ||
|
|
||
| When I run command: | ||
| """ | ||
| ${NVCF_CLI} --config ${REPO_ROOT}/tests/bdd/fixtures/nvcf-cli-local.yaml function deploy create --gpu H100 --instance-type NCP.GPU.H100_8x --backend ncp-local --regions us-west-1 --min-instances 1 --max-instances 1 --timeout 900 | ||
| """ | ||
| Then the command exit code should be 0 | ||
|
|
||
| When I run command: | ||
| """ | ||
| ${NVCF_CLI} --config ${REPO_ROOT}/tests/bdd/fixtures/nvcf-cli-local.yaml api-key generate --description bdd-pki-openai-compatible-sample --for function --scopes invoke_function,list_functions,queue_details,list_functions_details | ||
| """ | ||
| Then the command exit code should be 0 | ||
|
|
||
| When I run command: | ||
| """ | ||
| ${NVCF_CLI} --config ${REPO_ROOT}/tests/bdd/fixtures/nvcf-cli-local.yaml function invoke --inference-url /v1/chat/completions --model-name openai-compatible-sample --request-body '{"messages":[{"role":"user","content":"bdd-pki-llm"}]}' --timeout 120 | ||
| """ | ||
| Then the command exit code should be 0 | ||
| And the command output should contain "chat.completion" | ||
| And the command output should contain "fixed 128-byte response" | ||
|
|
||
| # curl reports only the status code so the assertion cannot | ||
| # match response-body noise. | ||
| When I run command: | ||
| """ | ||
| curl -s -o /dev/null -w "%{http_code}" -X POST http://llm.localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"unauthenticated/check","messages":[]}' | ||
| """ | ||
| Then the command exit code should be 0 | ||
| And the command output should contain "401" | ||
|
|
||
| # Leave the GPU capacity free, same as the non-PKI feature. | ||
| When I run command: | ||
| """ | ||
| ${NVCF_CLI} --config ${REPO_ROOT}/tests/bdd/fixtures/nvcf-cli-local.yaml function delete --deployment-only | ||
| """ | ||
| Then the command exit code should be 0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.