CRD: preserve unknown fields and add to all category

This commit is contained in:
Felix Kunde
2020-11-13 16:28:53 +01:00
parent 49158ecb68
commit b58c25ed07
7 changed files with 26 additions and 4 deletions
+8 -4
View File
@@ -2,6 +2,7 @@ package v1
import (
acidzalando "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do"
"github.com/zalando/postgres-operator/pkg/util"
apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -111,8 +112,9 @@ var minDisable = -1.0
// PostgresCRDResourceValidation to check applied manifest parameters
var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
OpenAPIV3Schema: &apiextv1.JSONSchemaProps{
Type: "object",
Required: []string{"kind", "apiVersion", "spec"},
Type: "object",
XPreserveUnknownFields: util.True(),
Required: []string{"kind", "apiVersion", "spec"},
Properties: map[string]apiextv1.JSONSchemaProps{
"kind": {
Type: "string",
@@ -779,8 +781,9 @@ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
// OperatorConfigCRDResourceValidation to check applied manifest parameters
var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{
OpenAPIV3Schema: &apiextv1.JSONSchemaProps{
Type: "object",
Required: []string{"kind", "apiVersion", "configuration"},
Type: "object",
XPreserveUnknownFields: util.True(),
Required: []string{"kind", "apiVersion", "configuration"},
Properties: map[string]apiextv1.JSONSchemaProps{
"kind": {
Type: "string",
@@ -1394,6 +1397,7 @@ func buildCRD(name, kind, plural, short string, columns []apiextv1.CustomResourc
Plural: plural,
ShortNames: []string{short},
Kind: kind,
Categories: []string{"all"},
},
Scope: apiextv1.NamespaceScoped,
Versions: []apiextv1.CustomResourceDefinitionVersion{