CRD: preserve unknown fields and add to all category (#1212)

* CRD: preserve unknown fields and add to all category

* allow Pg13

* left over
This commit is contained in:
Felix Kunde 2020-11-16 10:29:01 +01:00 committed by GitHub
parent a7f453352a
commit 3e42e8a896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 4 deletions

View File

@ -15,6 +15,8 @@ spec:
singular: operatorconfiguration singular: operatorconfiguration
shortNames: shortNames:
- opconfig - opconfig
categories:
- all
scope: Namespaced scope: Namespaced
versions: versions:
- name: v1 - name: v1
@ -45,6 +47,7 @@ spec:
schema: schema:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
x-preserve-unknown-fields: true
required: required:
- kind - kind
- apiVersion - apiVersion

View File

@ -15,6 +15,8 @@ spec:
singular: postgresql singular: postgresql
shortNames: shortNames:
- pg - pg
categories:
- all
scope: Namespaced scope: Namespaced
versions: versions:
- name: v1 - name: v1
@ -57,6 +59,7 @@ spec:
schema: schema:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
x-preserve-unknown-fields: true
required: required:
- kind - kind
- apiVersion - apiVersion
@ -320,6 +323,7 @@ spec:
- "10" - "10"
- "11" - "11"
- "12" - "12"
- "13"
parameters: parameters:
type: object type: object
additionalProperties: additionalProperties:

View File

@ -15,6 +15,8 @@ spec:
singular: postgresteam singular: postgresteam
shortNames: shortNames:
- pgteam - pgteam
categories:
- all
scope: Namespaced scope: Namespaced
versions: versions:
- name: v1 - name: v1
@ -25,6 +27,7 @@ spec:
schema: schema:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
x-preserve-unknown-fields: true
required: required:
- kind - kind
- apiVersion - apiVersion

View File

@ -11,6 +11,8 @@ spec:
singular: operatorconfiguration singular: operatorconfiguration
shortNames: shortNames:
- opconfig - opconfig
categories:
- all
scope: Namespaced scope: Namespaced
versions: versions:
- name: v1 - name: v1
@ -41,6 +43,7 @@ spec:
schema: schema:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
x-preserve-unknown-fields: true
required: required:
- kind - kind
- apiVersion - apiVersion

View File

@ -11,6 +11,8 @@ spec:
singular: postgresql singular: postgresql
shortNames: shortNames:
- pg - pg
categories:
- all
scope: Namespaced scope: Namespaced
versions: versions:
- name: v1 - name: v1
@ -53,6 +55,7 @@ spec:
schema: schema:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
x-preserve-unknown-fields: true
required: required:
- kind - kind
- apiVersion - apiVersion
@ -316,6 +319,7 @@ spec:
- "10" - "10"
- "11" - "11"
- "12" - "12"
- "13"
parameters: parameters:
type: object type: object
additionalProperties: additionalProperties:

View File

@ -11,6 +11,8 @@ spec:
singular: postgresteam singular: postgresteam
shortNames: shortNames:
- pgteam - pgteam
categories:
- all
scope: Namespaced scope: Namespaced
versions: versions:
- name: v1 - name: v1
@ -21,6 +23,7 @@ spec:
schema: schema:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
x-preserve-unknown-fields: true
required: required:
- kind - kind
- apiVersion - apiVersion

View File

@ -2,6 +2,7 @@ package v1
import ( import (
acidzalando "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do" 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" apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
) )
@ -112,6 +113,7 @@ var minDisable = -1.0
var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
OpenAPIV3Schema: &apiextv1.JSONSchemaProps{ OpenAPIV3Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
XPreserveUnknownFields: util.True(),
Required: []string{"kind", "apiVersion", "spec"}, Required: []string{"kind", "apiVersion", "spec"},
Properties: map[string]apiextv1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"kind": { "kind": {
@ -412,6 +414,9 @@ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
{ {
Raw: []byte(`"12"`), Raw: []byte(`"12"`),
}, },
{
Raw: []byte(`"13"`),
},
}, },
}, },
"parameters": { "parameters": {
@ -780,6 +785,7 @@ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{
OpenAPIV3Schema: &apiextv1.JSONSchemaProps{ OpenAPIV3Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
XPreserveUnknownFields: util.True(),
Required: []string{"kind", "apiVersion", "configuration"}, Required: []string{"kind", "apiVersion", "configuration"},
Properties: map[string]apiextv1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"kind": { "kind": {
@ -1394,6 +1400,7 @@ func buildCRD(name, kind, plural, short string, columns []apiextv1.CustomResourc
Plural: plural, Plural: plural,
ShortNames: []string{short}, ShortNames: []string{short},
Kind: kind, Kind: kind,
Categories: []string{"all"},
}, },
Scope: apiextv1.NamespaceScoped, Scope: apiextv1.NamespaceScoped,
Versions: []apiextv1.CustomResourceDefinitionVersion{ Versions: []apiextv1.CustomResourceDefinitionVersion{