Skip to content

fix: leave the namespace to the environment in a restricted render - #58

Merged
antoinetoussaint-byte merged 1 commit into
mainfrom
fix/restricted-render-omits-namespace
Sep 23, 2026
Merged

antoinetoussaint-byte merged 1 commit into
mainfrom
fix/restricted-render-omits-namespace

Conversation

@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor

Summary

A restricted render of a python-fastapi service always included a cluster-scoped Namespace. codefly deploy gitops render then refused it:

cannot execute command
  ↳ cluster-scoped Namespace is outside an AppProject contract

That happens for every composition that renders without --app-project. The same composition renders go-grpc services without trouble, because go-grpc's base kustomization.yaml.tmpl has listed namespace.yaml only {{- if not .Restricted }} since #52. Here base/kustomization.yaml was a plain file, so the namespace was always listed.

This change makes the base kustomization a template with that same condition. The ephemeral local apply still creates the namespace. A restricted render leaves it to the environment that owns it, so two owners no longer compete over one Namespace's labels.

Classification: a fix, in the agent that renders the object. No CLI or core change.

How it was found

The model gateway module (obin-ai/module-model-gateway) is the first python-fastapi service a composition renders for a hosted cell. codefly deploy gitops render model --env local (CLI 0.1.160, this agent at 0.0.106) built and pushed the image and then refused the Namespace. With --app-project the render completed. It emitted base/namespace.yaml beside the CLI-projected ServiceAccount and the restricted secretKeyRef environment.

Test plan

  • TestRestrictedDeploymentLeavesTheNamespaceToTheEnvironment: renders through core's KustomizeDeploy. A restricted profile lists no namespace.yaml and an ephemeral local apply still does. The test fails against the previous template.
  • go test ./ -run 'TestOwnedManifestsAreTransportNeutral|TestRestricted|TestDeployment|TestGRPC': pass. The template comment is kept free of delivery vocabulary, which the conformance test enforces.
  • gofmt -l . and go vet ./: clean.
  • Full go test ./: every test passes except TestImageSBOMInventoriesTheBuiltImage. It fails on this host because syft cannot reach the Docker daemon ("docker not available"). That is environmental and unrelated. Nothing here touches the image or the SBOM path.

Not verified

  • I did not re-run a full codefly deploy gitops render against a locally built agent with this change. The claim that the render passes without --app-project is inferred from the render error and from the go-grpc precedent.
  • Releasing this needs an agent release (0.0.107). A consuming service then moves its agent.version to it.

🤖 Generated with Claude Code

The base kustomization always listed namespace.yaml, so a restricted
render (what codefly deploy gitops render produces) carried a
cluster-scoped Namespace. The CLI refuses one outside an AppProject
contract, so every composition rendering a python-fastapi service
without --app-project failed, while the same composition rendered
go-grpc services, which already omit it when .Restricted.

Template the base kustomization the way go-grpc does: the Namespace is
created only by the ephemeral local apply.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@antoinetoussaint-byte
antoinetoussaint-byte merged commit 14173c2 into main Sep 23, 2026
3 checks passed
@antoinetoussaint-byte
antoinetoussaint-byte deleted the fix/restricted-render-omits-namespace branch September 23, 2026 18:59
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.

1 participant