Skip to content

fix(api): accept scalar dynamicConfig values#133

Merged
bmorton merged 1 commit into
mainfrom
fix/dynamicconfig-scalar-values
Jul 24, 2026
Merged

fix(api): accept scalar dynamicConfig values#133
bmorton merged 1 commit into
mainfrom
fix/dynamicconfig-scalar-values

Conversation

@bmorton

@bmorton bmorton commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Problem

Applying a TemporalCluster with scalar dynamicConfig values fails validation:

TemporalCluster ... is invalid: spec.dynamicConfig.values.activity.enableStandalone[0].value:
Invalid value: "boolean": ... in body must be of type object: "boolean" ...

DynamicConfigValue.Value was a runtime.RawExtension, which controller-gen renders as type: object + x-kubernetes-preserve-unknown-fields: true. The apiserver's structural-schema validation then rejects any scalar (bool/number/string), so keys like history.enableTransitionHistory, history.enableChasm, and activity.enableStandalone (which take boolean values) cannot be applied.

Fix

Switch the field to schemaless JSON:

// +kubebuilder:validation:Schemaless
// +kubebuilder:pruning:PreserveUnknownFields
Value apiextensionsv1.JSON `json:"value"`

The generated CRD now emits x-kubernetes-preserve-unknown-fields: true without type: object, so scalars, objects, and arrays are all accepted. The consumer keeps reading v.Value.Raw, so dynamic-config rendering is unchanged.

Changes

  • api/v1alpha1/shared_types.goruntime.RawExtensionapiextensionsv1.JSON + Schemaless.
  • Regenerated CRD manifests, Helm chart, and API reference docs.
  • Added an envtest regression in temporalcluster_controller_test.go that creates a cluster with scalar dynamicConfig values (bool/number/string) against the real CRD.

Verification

  • make build, make lint (0 issues)
  • go test ./internal/temporal/... ./internal/controller/... (incl. new envtest) — pass
  • WASM preview build compiles (API stays WASM-safe)

DynamicConfigValue.Value used runtime.RawExtension, which controller-gen
renders as `type: object` + x-kubernetes-preserve-unknown-fields. The
apiserver's structural-schema validation then rejects scalar values
(bool/number/string), breaking apply of keys like
history.enableTransitionHistory, history.enableChasm, and
activity.enableStandalone.

Switch to apiextensionsv1.JSON with +kubebuilder:validation:Schemaless so
the CRD emits x-kubernetes-preserve-unknown-fields without type: object.
The consumer keeps using .Raw, so rendering is unchanged.

Regenerate CRD manifests, Helm chart, and API docs, and add an envtest
regression that creates a cluster with scalar dynamicConfig values.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 86e9f3de-efd7-4bbd-ad90-e0f91579ee25
Signed-off-by: Brian Morton <brian@mmmhm.com>
@bmorton
bmorton merged commit d959157 into main Jul 24, 2026
15 checks passed
@bmorton
bmorton deleted the fix/dynamicconfig-scalar-values branch July 24, 2026 02:46
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