Skip to content

feat(custom): support governed identity and ingress mTLS - #366

Merged
FumingZhang merged 7 commits into
mainfrom
feat/custom-identity-mtls
Oct 30, 2026
Merged

FumingZhang merged 7 commits into
mainfrom
feat/custom-identity-mtls

Conversation

@FumingZhang

Copy link
Copy Markdown
Member

Summary

Complete three related capabilities for policy-governed Custom Agents in one PR:

  • Reuse the existing approved Entra workload projection and retained ServiceAccount ownership. Keep the exchange token out of initializers and the separate terminal; preserve headless images without inventing a port.
  • Enable Custom Agent Identity and native Connections behind explicit Operator/Broker/Portal runtime allowlists. Retain current-workload verification, owner bindings, credential-policy readback and provider-token exclusion. Expose the qualified creation/connection controls in Portal, and add a lazy, bounded MCP adapter to the real Pi SDK for HTTP and TUI sessions.
  • Support approved Custom HTTP ingress mTLS, including private Portal Chat and the separate terminal. Give Portal its own client credential and workload-selected destination policy instead of sharing the Gateway key. Retain namespace-scoped source grants, immutable source identities and the existing grant journal. Explicit probe arguments make old probe images fail rather than silently claim HTTP-only TLS readiness; TLS helpers have an explicit non-root UID.

The common executor remains the only lifecycle/authorization authority. No provider token is returned to a Custom workload, and an enable flag alone never grants a connection or cloud permission.

Related issue

Follows the agreed Custom common-executor scope in #354 and the public Agent Harness contract. The requested remaining identity/Connections/mTLS work is kept in this single PR rather than introducing another lifecycle engine.

Main was integrated again after #357 and #359 merged. The final branch includes those prerequisites, and the feature patch-id is unchanged by that integration. Their repairs are not duplicated in this PR's diff against main. Other outstanding migration, Kubernetes/FQDN and obsolete-infra work is not included.

Validation

Commands are shown relative to the checkout root. Offline Go checks selected Go 1.27.3 with GOPROXY=off GOSUMDB=off GOTOOLCHAIN=local GOWORK=off GOFLAGS='-mod=readonly -p=2' GOMAXPROCS=4 GOTELEMETRY=off. Isolated API-server checks used KUBECONFIG=/dev/null USE_EXISTING_CLUSTER=false and KUBEBUILDER_ASSETS pointing to the checksum-pinned Kubernetes 1.37.0 bundle. Other tools: Helm 3.22.0, Node 24.18.0, npm 12.0.1, Envoy 1.36.3 and Hugo 0.164.0 extended.

Command: go -C app/cetirun-operator test ./internal/helm ./internal/sandboxworkload ./internal/sandboxpolicy ./internal/admission ./internal/ingressmtls ./internal/terminal ./cmd/loopback-probe -count=1 -timeout=10m
Result: passed. Historical chart reconstruction retains its original byte/hash assertions.

Command: go -C app/cetirun-operator test ./internal/controller -run 'TestCommonCustom|TestNativeEntra|TestNativeConnections|TestReconciledSandboxIngressMTLS|TestCustomAgentIdentity|TestParseConnectionsMCPRuntimeTypes' -count=1 -timeout=10m
Result: passed.

Command: go -C app/cetirun-operator test ./internal/controller -run 'Test.*ConnectionsMCP' -count=1 -timeout=5m
Result: passed, including unchanged default runtime allowlists and explicit Custom opt-in.

Command: go -C app/cetirun-operator test ./internal/controller -run '^TestCommonCustom' -count=1 -timeout=10m
Result: passed again after integrating current main, including the new identity, TLS, lifecycle and combined-capability cases.

Command: go -C app/cetirun-operator test -tags=envtest ./internal/controller -run '^(TestCommonCustom(Terminal)?APIServer|TestNativeEntraCommonRuntimeAPIServer|TestNativeConnectionsServedCurrentSourceProof|TestReconciledSandboxIngressMTLSAPIServer|TestContainerSandboxIngressMTLSAPIServer)$/^(custom|kata|container)$' -count=1 -timeout=10m
Result: passed after main integration. Covers actual local API identities, binding/admission, token requests/TokenReviews, Custom credential-policy evidence, TLS source drift, and both Custom TLS backends. Scheduler/kubelet/directory/provider observations remain synthetic.

Command: go -C app/cetirun-operator test -tags=envoy ./internal/ingressmtls -run '^TestEnvoyFinalHopMTLS$' -count=1 -timeout=5m
Result: passed with CETIRUN_ENVOY_BINARY set to the separately checksum-verified Envoy. Real loopback handshakes cover managed/Custom/terminal endpoints, approved Portal identity, wrong/missing/expired material, plaintext denial, cleanup and coordinated rotation.

Command: go -C app/cetirun-operator test -race ./internal/sandboxpolicy ./internal/sandboxworkload ./internal/ingressmtls ./internal/terminal ./cmd/loopback-probe -count=1
Result: passed.

Command: go -C app/cetirun-operator test -race ./internal/controller -run '^TestCommonCustom(MTLSEndpoints|IdentityProjections|AllCapabilitiesCompose)$' -count=1 -timeout=10m
Result: passed.

Command: go -C app/cetirun-agent-broker test ./... -count=1
Result: passed, including Custom provider opt-in/current-authority and independent personal-provider cases.

Command: go -C app/cetirun-agent-broker test -race ./internal/broker -count=1
Result: passed.

Command: go -C app/cetirun-connections-mcp test ./... -count=1
Result: passed.

Command: go -C app/cetirun-portal test ./... -count=1
Result: passed again on the final integrated source and real built frontend assets.

Command: go -C app/cetirun-operator vet ./...
Result: passed.
Command: go -C app/cetirun-agent-broker vet ./...
Result: passed.
Command: go -C app/cetirun-connections-mcp vet ./...
Result: passed.
Command: go -C app/cetirun-portal vet ./...
Result: passed.

Command: make -C app/cetirun-operator build build-terminal
Result: passed, including static manager, terminal and loopback-probe binaries.
Command: go -C app/cetirun-agent-broker build ./...
Result: passed.
Command: go -C app/cetirun-connections-mcp build ./...
Result: passed.
Command: make -C app/cetirun-portal build
Result: passed.

Command: npm --prefix app/cetirun-portal/web test -- --run src/components/__tests__/CreateForm src/components/OverviewSection.test.tsx
Result: passed: 69 component tests and 34 license-generator tests.
Command: npm --prefix app/cetirun-portal/web run build
Result: passed, including TypeScript and production license output. Existing bundle-size advisory remains.
Command: npm --prefix examples/pi-agent test
Result: 25 passed; four existing built-image-only tests explicitly skipped.
Command: npm --prefix examples/pi-agent run check
Result: passed.

Command: python3 -B -m unittest discover -s scripts/tests -p test_custom_initialization.py -v
Result: passed: 25 initialization tests.
Command: make version-check license-check
Result: passed.
Command: make docs-check HUGO=/workspace/cetirun/site/.bin/hugo
Result: passed again after main integration: 106 tests, 43 generated HTML pages, and source headers.
Command: git diff --cached --check
Result: passed.

Explicit Custom allowlist Helm renders also passed for Operator, Broker and Portal using synthetic settings. Initially missing frontend/Pi dependencies were restored from their existing lockfiles and local cache. Missing API-server/Envoy tools were provisioned separately at documented versions/checksums; no shared installation or dependency versions were changed.

Not run: full repository make check/test/lint, the complete Operator/controller/envtest matrix, container image builds, live cluster deployment, actual Istio/SDS/Cilium/Kata/runc/CSI qualification, real federation/OAuth/GitHub App/OBO/provider calls, or full live model/tool acceptance. These need separately authorized environments and prerequisites. Local TLS and synthetic API tests are not security certification or maintainer acceptance.

Compatibility and operational impact

  • No CRD, module dependency, release-version or cloud-resource changes.
  • Custom Connections/Agent Identity remain off by default and require explicit runtime allowlists plus the existing common-executor configuration. Unbound/legacy Custom retains its rejection boundary.
  • Generic Entra SDK projection and Broker Agent Identity/Connections remain distinct. Portal creation now follows the Operator's identity permission contract instead of requiring an unrelated Entra projection merely to request Agent Identity.
  • Custom HTTP mTLS requires an approved image honoring the loopback contract and a matching updated terminal/probe image. Headless images have no application HTTP endpoint and cannot request this ingress opt-in; desktop remains unsupported.
  • Private Chat adds only approved, exactly owned destination policies and name/namespace-scoped credential-source reads. The Portal mesh/SDS setup and externally provisioned certificates remain administrator prerequisites.
  • Upgrade Operator/admission, strict expectation readers, runtime Chart, terminal/probe image, Broker, Portal and the selected Custom client together before enabling the new combination. Old readers reject the optional typed Custom TLS plan rather than silently ignore it.
  • Certificate changes retain the existing coordinated stop/change/resume workflow. No restart-free rotation, cloud permission provisioning, or immediate revocation of already-issued external tokens is claimed.

Checklist

  • The change is focused and preserves unrelated work.
  • Tests cover the changed behavior, or I explained why no new test is needed.
  • Documentation and examples match any public behavior changes.
  • Generated artifacts were updated from source, or none are affected.
  • Dependency changes include lockfiles, source attribution, and license information, or none are affected.
  • I checked the diff and attachments for secrets, private endpoints or identifiers, customer data, agent conversations, and internal information.
  • I followed the applicable CLA instructions, or asked a maintainer about an unclear check.
  • I identified checks that need credentials or a live environment and did not run them without authorization.

FumingZhang and others added 5 commits October 30, 2026 01:35
Reuse approved Entra projection, native Broker/Connections authorization and scoped TLS endpoints for common-executor Custom agents. Preserve legacy boundaries, provider-token exclusion, image entrypoints and retained ownership; add Portal and Pi client integration with offline regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Integrate the merged Custom model-selection and bound-Pod topology repairs. Revalidate the combined Custom identity, TLS, terminal, and served-admission paths without changing the focused feature patch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve Custom identity and ingress mTLS conflicts with upstream Gateway initialization and Kubernetes access. Preserve suspended grant handling, approved cross-namespace TLS controls and the upstream Gateway regression test import.

Keep the existing PR history; the merged tree matches the locally validated integration exactly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Return a fresh fetch Response for each Team options request and explicitly qualify Custom in the Gateway catalog. Assert that required identity stays locked on and creation submits the permitted identity and model sources exactly once.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve the runtime chart schema and immutable chart reconstruction conflicts by retaining Custom ingress server names alongside managed observed-SNI capture controls. Preserve both features and the original historical byte/hash assertions.

Validated offline chart rendering, full Helm and proxy packages, Custom and observed-SNI controller regressions, isolated API admission, operator vet/build, and Portal creation tests/build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
FumingZhang and others added 2 commits October 30, 2026 10:55
Match the Gateway-only runtime chart contract in the unified release inventory. This unblocks the actual eight-chart packaging regression shared by policy/helper CI and the runtime image job without changing image scan gates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the protected per-Agent TLS plan to verify the approved Cilium listener and Service target port, while keeping the Portal's HTTP-to-mesh route and ordinary Chat behavior. Share the API listener port with the compiler and reject mismatched identities, hosts, backends and plaintext targets.

Exercise compiler-generated mTLS policy output through Chat resolution, observation, model listing and completion dispatch. Keep the synthetic fixture checked against the real compiler and document regeneration; no Portal certificate reads or credential sharing are introduced.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@feiskyer Pengfei Ni (feiskyer) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@FumingZhang
FumingZhang merged commit 439a125 into main Oct 30, 2026
35 checks passed
@FumingZhang
FumingZhang deleted the feat/custom-identity-mtls branch October 30, 2026 13:09
FumingZhang added a commit that referenced this pull request Oct 30, 2026
Resolve #369 against merged #366 while preserving explicit capture probes, terminal TLS separation and CAS retries. Reuse the shared Chat TLS port and retain both compiled and drift regression tests, including the approved Secret source references.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants