Skip to content

Commit

Permalink
🐛 Add XPreserveUnknownFields to runtime.RawExtension (#683)
Browse files Browse the repository at this point in the history
* Add XPreserveUnknownFields to runtime.RawExtension

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: tests

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: generate crd manifests

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
  • Loading branch information
eddycharly committed Jun 14, 2022
1 parent d97fa93 commit 529c857
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/crd/known_types.go
Expand Up @@ -74,7 +74,8 @@ var KnownPackages = map[string]PackageOverride{
"k8s.io/apimachinery/pkg/runtime": func(p *Parser, pkg *loader.Package) {
p.Schemata[TypeIdent{Name: "RawExtension", Package: pkg}] = apiext.JSONSchemaProps{
// TODO(directxman12): regexp validation for this (or get kube to support it as a format value)
Type: "object",
Type: "object",
XPreserveUnknownFields: boolPtr(true),
}
p.AddPackage(pkg) // get the rest of the types
},
Expand Down
1 change: 1 addition & 0 deletions pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml
Expand Up @@ -134,6 +134,7 @@ spec:
embeddedResource:
type: object
x-kubernetes-embedded-resource: true
x-kubernetes-preserve-unknown-fields: true
failedJobsHistoryLimit:
description: The number of failed finished jobs to retain. This is
a pointer to distinguish between explicit zero and not specified.
Expand Down

0 comments on commit 529c857

Please sign in to comment.