Skip to content

Commit

Permalink
Merge pull request #1874 from Elbehery/add_BackendQuotaGiB_example
Browse files Browse the repository at this point in the history
ETCD-520: add BackendQuotaGiB example
  • Loading branch information
openshift-merge-bot[bot] committed May 7, 2024
2 parents d591253 + a782226 commit 62b890e
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tests:
kind: StableConfigType
spec:
immutableField: foo
nonZeroDefault: 8
- name: With an EvolvingUnion, Should not allow a TechPreview enum value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -40,6 +41,7 @@ tests:
celUnion:
type: EmptyMember
immutableField: foo
nonZeroDefault: 8
- name: With an CEL validated Discrminated union, should allow an empty member with the empty type value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -55,6 +57,7 @@ tests:
celUnion:
type: EmptyMember
immutableField: foo
nonZeroDefault: 8
- name: With an CEL validated Discrminated union, should allow a required member with the required type value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -72,6 +75,7 @@ tests:
type: RequiredMember
requiredMember: foo
immutableField: foo
nonZeroDefault: 8
- name: With an CEL validated Discrminated union, should not allow omitting required member with the required type value
initial: |
apiVersion: example.openshift.io/v1
Expand Down Expand Up @@ -118,6 +122,7 @@ tests:
type: OptionalMember
optionalMember: foo
immutableField: foo
nonZeroDefault: 8
- name: With an CEL validated Discrminated union, should allow omitting the optional member with the optional type value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -133,6 +138,7 @@ tests:
celUnion:
type: OptionalMember
immutableField: foo
nonZeroDefault: 8
- name: With an CEL validated Discrminated union, should not allow the optional member without the optional type value
initial: |
apiVersion: example.openshift.io/v1
Expand Down Expand Up @@ -183,6 +189,7 @@ tests:
spec:
immutableField: foo
optionalImmutableField: foo
nonZeroDefault: 8
- name: Should not allow changing the optional immutable field
initial: |
apiVersion: example.openshift.io/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tests:
spec:
stableField: "Allowed"
immutableField: foo
nonZeroDefault: 8
- name: With an EvolvingUnion, Should allow an empty enum value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -31,6 +32,7 @@ tests:
evolvingUnion:
type: ""
immutableField: foo
nonZeroDefault: 8
- name: With an EvolvingUnion, Should allow a Stable enum value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -46,6 +48,7 @@ tests:
evolvingUnion:
type: StableValue
immutableField: foo
nonZeroDefault: 8
- name: With an CEL validated Discrminated union, should allow an empty member with the empty type value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -61,6 +64,7 @@ tests:
celUnion:
type: EmptyMember
immutableField: foo
nonZeroDefault: 8
- name: With an CEL validated Discrminated union, should allow an empty member with the empty type value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -76,6 +80,7 @@ tests:
celUnion:
type: EmptyMember
immutableField: foo
nonZeroDefault: 8
- name: With an CEL validated Discrminated union, should allow a required member with the required type value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -93,6 +98,7 @@ tests:
type: RequiredMember
requiredMember: foo
immutableField: foo
nonZeroDefault: 8
- name: With an CEL validated Discrminated union, should not allow omitting required member with the required type value
initial: |
apiVersion: example.openshift.io/v1
Expand Down Expand Up @@ -139,6 +145,7 @@ tests:
type: OptionalMember
optionalMember: foo
immutableField: foo
nonZeroDefault: 8
- name: With an CEL validated Discrminated union, should allow omitting the optional member with the optional type value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -154,6 +161,7 @@ tests:
celUnion:
type: OptionalMember
immutableField: foo
nonZeroDefault: 8
- name: With an CEL validated Discrminated union, should not allow the optional member without the optional type value
initial: |
apiVersion: example.openshift.io/v1
Expand Down Expand Up @@ -204,6 +212,7 @@ tests:
spec:
immutableField: foo
optionalImmutableField: foo
nonZeroDefault: 8
- name: Should not allow changing the optional immutable field
initial: |
apiVersion: example.openshift.io/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ tests:
spec:
stableField: "Allowed"
immutableField: foo
nonZeroDefault: 8
- name: Should persist a tech preview field
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -30,6 +31,7 @@ tests:
spec:
coolNewField: "Invalid"
immutableField: foo
nonZeroDefault: 8
- name: With an EvolvingUnion, Should allow an empty enum value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -45,6 +47,7 @@ tests:
evolvingUnion:
type: ""
immutableField: foo
nonZeroDefault: 8
- name: With an EvolvingUnion, Should allow a Stable enum value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -60,6 +63,7 @@ tests:
evolvingUnion:
type: StableValue
immutableField: foo
nonZeroDefault: 8
- name: With an EvolvingUnion, Should allow a TechPreview enum value
initial: |
apiVersion: example.openshift.io/v1
Expand All @@ -75,6 +79,7 @@ tests:
evolvingUnion:
type: TechPreviewOnlyValue
immutableField: foo
nonZeroDefault: 8
onUpdate:
- name: Should not allow removal of a tech preview field
initial: |
Expand Down
9 changes: 9 additions & 0 deletions example/v1/types_stable.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ type StableConfigTypeSpec struct {
// celUnion demonstrates how to validate a discrminated union using CEL
// +optional
CELUnion CELUnion `json:"celUnion,omitempty"`

// nonZeroDefault is a demonstration of creating an integer field that has a non zero default.
// It required two default tags (one for CRD generation, one for client generation) and must have `omitempty` and be optional.
// A minimum value is added to demonstrate that a zero value would not be accepted.
// +kubebuilder:default:=8
// +default=8
// +kubebuilder:validation:Minimum:=8
// +optional
NonZeroDefault int32 `json:"nonZeroDefault,omitempty"`
}

type EvolvingUnion struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ spec:
x-kubernetes-validations:
- message: immutableField is immutable
rule: self == oldSelf
nonZeroDefault:
default: 8
description: nonZeroDefault is a demonstration of creating an integer
field that has a non zero default. It required two default tags
(one for CRD generation, one for client generation) and must have
`omitempty` and be optional. A minimum value is added to demonstrate
that a zero value would not be accepted.
format: int32
minimum: 8
type: integer
optionalImmutableField:
description: optionalImmutableField is a field that is immutable once
set. It is optional but may not be changed once set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ spec:
x-kubernetes-validations:
- message: immutableField is immutable
rule: self == oldSelf
nonZeroDefault:
default: 8
description: nonZeroDefault is a demonstration of creating an integer
field that has a non zero default. It required two default tags
(one for CRD generation, one for client generation) and must have
`omitempty` and be optional. A minimum value is added to demonstrate
that a zero value would not be accepted.
format: int32
minimum: 8
type: integer
optionalImmutableField:
description: optionalImmutableField is a field that is immutable once
set. It is optional but may not be changed once set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ spec:
x-kubernetes-validations:
- message: immutableField is immutable
rule: self == oldSelf
nonZeroDefault:
default: 8
description: nonZeroDefault is a demonstration of creating an integer
field that has a non zero default. It required two default tags
(one for CRD generation, one for client generation) and must have
`omitempty` and be optional. A minimum value is added to demonstrate
that a zero value would not be accepted.
format: int32
minimum: 8
type: integer
optionalImmutableField:
description: optionalImmutableField is a field that is immutable once
set. It is optional but may not be changed once set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ spec:
x-kubernetes-validations:
- message: immutableField is immutable
rule: self == oldSelf
nonZeroDefault:
default: 8
description: nonZeroDefault is a demonstration of creating an integer
field that has a non zero default. It required two default tags
(one for CRD generation, one for client generation) and must have
`omitempty` and be optional. A minimum value is added to demonstrate
that a zero value would not be accepted.
format: int32
minimum: 8
type: integer
optionalImmutableField:
description: optionalImmutableField is a field that is immutable once
set. It is optional but may not be changed once set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ spec:
x-kubernetes-validations:
- message: immutableField is immutable
rule: self == oldSelf
nonZeroDefault:
default: 8
description: nonZeroDefault is a demonstration of creating an integer
field that has a non zero default. It required two default tags
(one for CRD generation, one for client generation) and must have
`omitempty` and be optional. A minimum value is added to demonstrate
that a zero value would not be accepted.
format: int32
minimum: 8
type: integer
optionalImmutableField:
description: optionalImmutableField is a field that is immutable once
set. It is optional but may not be changed once set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ spec:
x-kubernetes-validations:
- message: immutableField is immutable
rule: self == oldSelf
nonZeroDefault:
default: 8
description: nonZeroDefault is a demonstration of creating an integer
field that has a non zero default. It required two default tags
(one for CRD generation, one for client generation) and must have
`omitempty` and be optional. A minimum value is added to demonstrate
that a zero value would not be accepted.
format: int32
minimum: 8
type: integer
optionalImmutableField:
description: optionalImmutableField is a field that is immutable once
set. It is optional but may not be changed once set.
Expand Down
1 change: 1 addition & 0 deletions example/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -12914,6 +12914,12 @@
"type": "string",
"default": ""
},
"nonZeroDefault": {
"description": "nonZeroDefault is a demonstration of creating an integer field that has a non zero default. It required two default tags (one for CRD generation, one for client generation) and must have `omitempty` and be optional. A minimum value is added to demonstrate that a zero value would not be accepted.",
"type": "integer",
"format": "int32",
"default": 8
},
"optionalImmutableField": {
"description": "optionalImmutableField is a field that is immutable once set. It is optional but may not be changed once set.",
"type": "string",
Expand Down

0 comments on commit 62b890e

Please sign in to comment.