fix(api): accept scalar dynamicConfig values#133
Merged
Conversation
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>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Applying a
TemporalClusterwith scalardynamicConfigvalues fails validation:DynamicConfigValue.Valuewas aruntime.RawExtension, which controller-gen renders astype: object+x-kubernetes-preserve-unknown-fields: true. The apiserver's structural-schema validation then rejects any scalar (bool/number/string), so keys likehistory.enableTransitionHistory,history.enableChasm, andactivity.enableStandalone(which take boolean values) cannot be applied.Fix
Switch the field to schemaless JSON:
The generated CRD now emits
x-kubernetes-preserve-unknown-fields: truewithouttype: object, so scalars, objects, and arrays are all accepted. The consumer keeps readingv.Value.Raw, so dynamic-config rendering is unchanged.Changes
api/v1alpha1/shared_types.go—runtime.RawExtension→apiextensionsv1.JSON+Schemaless.temporalcluster_controller_test.gothat creates a cluster with scalardynamicConfigvalues (bool/number/string) against the real CRD.Verification
make build,make lint(0 issues)go test ./internal/temporal/... ./internal/controller/...(incl. new envtest) — pass