Skip to content

feat(crd): define Namespace spec and validation - #25

Merged
jaypipes merged 4 commits into
mainfrom
tomba/define-namespace-spec
Oct 15, 2026
Merged

jaypipes merged 4 commits into
mainfrom
tomba/define-namespace-spec

Conversation

@tomba7

@tomba7 tomba7 commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Part of #5

What was changed

  • Defined NamespaceSpec for the Namespace CRD. Each field maps to its corresponding field in the Temporal Cloud namespace proto.
  • Added gdt validation tests.

Why?

  • Users need a typed spec to declare Temporal Cloud Namespaces before the controller can reconcile them.

Validation Trade-offs considered

  1. Validate in the CRD
    • Pro: instant feedback, since kubectl apply rejects a bad manifest before anything reaches Temporal Cloud.
    • Con: Cloud-defined limits (tag rules, metadata.name format, retention range) are only documented on the Cloud docs site, not in the proto, so a CRD copy can drift stricter than Cloud and block valid configs.
  2. Validate in Temporal Cloud
    • Pro: always matches Cloud's current rules, and keeps the CRD and its tests small.
    • Con: slower feedback, since errors show in the CR's status at reconcile time rather than at apply.

This PR mostly starts with option 2, with the CRD checking only structure and rules that don't depend on Cloud policy. We'll add stricter CRD checks as we test against Temporal Cloud and iterate.

Testing

  • On a kind cluster with the operator deployed, make test-e2e passes.
  • kubectl explain namespaces.spec --api-version=cloud.temporal.io/v1alpha1 shows each field's Cloud mapping.

@tomba7
tomba7 requested a review from jaypipes as a code owner October 13, 2026 05:25
@tomba7
tomba7 requested review from jaypipes, niyomukiza-mechack and zainawaisn and a balanced review from Copilot and removed request for jaypipes October 13, 2026 05:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The broad public CRD contract and immutable CEL rules warrant final human validation against the Temporal Cloud API.

0 open findings

What changed in this PR

Defines the typed Namespace CRD specification, schema validation, examples, and end-to-end validation coverage.

Changes:

  • Adds Namespace API types and generated CRD/deep-copy artifacts.
  • Adds structural, enum, uniqueness, capacity, and update validation.
  • Documents and tests valid and invalid Namespace manifests.
File Description
api/​cloud/​v1alpha1/​namespace.go Defines Namespace specification types and validation markers.
api/​cloud/​v1alpha1/​zz_generated.deepcopy.go Adds generated deep-copy support.
deploy/​kustomize/​crd/​bases/​cloud.temporal.io_namespaces.yaml Publishes the generated CRD schema.
examples/​namespace.yaml Provides an example Namespace manifest.
README.md Documents creation and validation.
test/​e2e/​namespace/​validation.yaml Tests CRD validation behavior.
test/​e2e/​namespace/​testdata/​minimal.yaml Supplies the minimal valid fixture.
test/​e2e/​namespace/​happy-default.yaml Updates the lifecycle test for required fields.
.mk/​test.mk Adds the validation test target.
.mk/​gen.mk Enables generated CRD descriptions.
.gitignore Ignores IDE metadata.
Files not reviewed (1)
  • api/cloud/v1alpha1/zz_generated.deepcopy.go: Generated file

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/e2e/namespace/validation.yaml Outdated
Comment thread api/cloud/v1alpha1/namespace.go Outdated
Comment thread test/e2e/namespace/validation.yaml Outdated
Comment thread test/e2e/namespace/manifests/minimal.yaml
Comment thread test/e2e/namespace/validation.yaml Outdated
@tomba7
tomba7 requested a review from jaypipes October 14, 2026 18:21
Comment thread api/cloud/v1alpha1/namespace.go
Comment thread .mk/test.mk
@jaypipes
jaypipes merged commit 894d63d into main Oct 15, 2026
8 checks passed
@jaypipes
jaypipes deleted the tomba/define-namespace-spec branch October 15, 2026 08:32
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.

3 participants