Skip to content

Commit 3e42e8a

Browse files
authored
CRD: preserve unknown fields and add to all category (zalando#1212)
* CRD: preserve unknown fields and add to all category * allow Pg13 * left over
1 parent a7f4533 commit 3e42e8a

File tree

7 files changed

+31
-4
lines changed

7 files changed

+31
-4
lines changed

charts/postgres-operator/crds/operatorconfigurations.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ spec:
1515
singular: operatorconfiguration
1616
shortNames:
1717
- opconfig
18+
categories:
19+
- all
1820
scope: Namespaced
1921
versions:
2022
- name: v1
@@ -45,6 +47,7 @@ spec:
4547
schema:
4648
openAPIV3Schema:
4749
type: object
50+
x-preserve-unknown-fields: true
4851
required:
4952
- kind
5053
- apiVersion

charts/postgres-operator/crds/postgresqls.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ spec:
1515
singular: postgresql
1616
shortNames:
1717
- pg
18+
categories:
19+
- all
1820
scope: Namespaced
1921
versions:
2022
- name: v1
@@ -57,6 +59,7 @@ spec:
5759
schema:
5860
openAPIV3Schema:
5961
type: object
62+
x-preserve-unknown-fields: true
6063
required:
6164
- kind
6265
- apiVersion
@@ -320,6 +323,7 @@ spec:
320323
- "10"
321324
- "11"
322325
- "12"
326+
- "13"
323327
parameters:
324328
type: object
325329
additionalProperties:

charts/postgres-operator/crds/postgresteams.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ spec:
1515
singular: postgresteam
1616
shortNames:
1717
- pgteam
18+
categories:
19+
- all
1820
scope: Namespaced
1921
versions:
2022
- name: v1
@@ -25,6 +27,7 @@ spec:
2527
schema:
2628
openAPIV3Schema:
2729
type: object
30+
x-preserve-unknown-fields: true
2831
required:
2932
- kind
3033
- apiVersion

manifests/operatorconfiguration.crd.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ spec:
1111
singular: operatorconfiguration
1212
shortNames:
1313
- opconfig
14+
categories:
15+
- all
1416
scope: Namespaced
1517
versions:
1618
- name: v1
@@ -41,6 +43,7 @@ spec:
4143
schema:
4244
openAPIV3Schema:
4345
type: object
46+
x-preserve-unknown-fields: true
4447
required:
4548
- kind
4649
- apiVersion

manifests/postgresql.crd.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ spec:
1111
singular: postgresql
1212
shortNames:
1313
- pg
14+
categories:
15+
- all
1416
scope: Namespaced
1517
versions:
1618
- name: v1
@@ -53,6 +55,7 @@ spec:
5355
schema:
5456
openAPIV3Schema:
5557
type: object
58+
x-preserve-unknown-fields: true
5659
required:
5760
- kind
5861
- apiVersion
@@ -316,6 +319,7 @@ spec:
316319
- "10"
317320
- "11"
318321
- "12"
322+
- "13"
319323
parameters:
320324
type: object
321325
additionalProperties:

manifests/postgresteam.crd.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ spec:
1111
singular: postgresteam
1212
shortNames:
1313
- pgteam
14+
categories:
15+
- all
1416
scope: Namespaced
1517
versions:
1618
- name: v1
@@ -21,6 +23,7 @@ spec:
2123
schema:
2224
openAPIV3Schema:
2325
type: object
26+
x-preserve-unknown-fields: true
2427
required:
2528
- kind
2629
- apiVersion

pkg/apis/acid.zalan.do/v1/crds.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package v1
22

33
import (
44
acidzalando "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do"
5+
"github.com/zalando/postgres-operator/pkg/util"
56
apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
67
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
78
)
@@ -111,8 +112,9 @@ var minDisable = -1.0
111112
// PostgresCRDResourceValidation to check applied manifest parameters
112113
var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
113114
OpenAPIV3Schema: &apiextv1.JSONSchemaProps{
114-
Type: "object",
115-
Required: []string{"kind", "apiVersion", "spec"},
115+
Type: "object",
116+
XPreserveUnknownFields: util.True(),
117+
Required: []string{"kind", "apiVersion", "spec"},
116118
Properties: map[string]apiextv1.JSONSchemaProps{
117119
"kind": {
118120
Type: "string",
@@ -412,6 +414,9 @@ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
412414
{
413415
Raw: []byte(`"12"`),
414416
},
417+
{
418+
Raw: []byte(`"13"`),
419+
},
415420
},
416421
},
417422
"parameters": {
@@ -779,8 +784,9 @@ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
779784
// OperatorConfigCRDResourceValidation to check applied manifest parameters
780785
var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{
781786
OpenAPIV3Schema: &apiextv1.JSONSchemaProps{
782-
Type: "object",
783-
Required: []string{"kind", "apiVersion", "configuration"},
787+
Type: "object",
788+
XPreserveUnknownFields: util.True(),
789+
Required: []string{"kind", "apiVersion", "configuration"},
784790
Properties: map[string]apiextv1.JSONSchemaProps{
785791
"kind": {
786792
Type: "string",
@@ -1394,6 +1400,7 @@ func buildCRD(name, kind, plural, short string, columns []apiextv1.CustomResourc
13941400
Plural: plural,
13951401
ShortNames: []string{short},
13961402
Kind: kind,
1403+
Categories: []string{"all"},
13971404
},
13981405
Scope: apiextv1.NamespaceScoped,
13991406
Versions: []apiextv1.CustomResourceDefinitionVersion{

0 commit comments

Comments
 (0)