From 86f58e43b322a1c855db94508c3eec48a7dcbe05 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Mon, 25 Oct 2021 18:31:17 +0200 Subject: [PATCH] ClusterClass variable schema: drop multipleOf, change min/max to *int64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Büringer buringerst@vmware.com --- api/v1alpha4/conversion_test.go | 7 ------- api/v1beta1/clusterclass_types.go | 10 ++-------- api/v1beta1/zz_generated.deepcopy.go | 10 ++-------- config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml | 10 ++++------ 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/api/v1alpha4/conversion_test.go b/api/v1alpha4/conversion_test.go index 1b4475911139..de7850e0e116 100644 --- a/api/v1alpha4/conversion_test.go +++ b/api/v1alpha4/conversion_test.go @@ -17,7 +17,6 @@ limitations under the License. package v1alpha4 import ( - "encoding/json" "testing" fuzz "github.com/google/gofuzz" @@ -113,10 +112,4 @@ func JSONSchemaPropsFuzzer(in *v1beta1.JSONSchemaProps, c fuzz.Continue) { {Raw: []byte("\"c\"")}, } in.Default = &apiextensionsv1.JSON{Raw: []byte("true")} - - // Not every random string is a valid JSON number, so we're setting a valid JSON number. - number := json.Number("1") - in.MultipleOf = &number - in.Minimum = &number - in.Maximum = &number } diff --git a/api/v1beta1/clusterclass_types.go b/api/v1beta1/clusterclass_types.go index 1ad7196ddf11..ebfa16590cfe 100644 --- a/api/v1beta1/clusterclass_types.go +++ b/api/v1beta1/clusterclass_types.go @@ -17,8 +17,6 @@ limitations under the License. package v1beta1 import ( - "encoding/json" - corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -189,7 +187,7 @@ type JSONSchemaProps struct { // If ExclusiveMaximum is false, the variable is valid if it is lower than, or equal to, the value of Maximum. // If ExclusiveMaximum is true, the variable is valid if it is strictly lower than the value of Maximum. // +optional - Maximum *json.Number `json:"maximum,omitempty"` + Maximum *int64 `json:"maximum,omitempty"` // ExclusiveMaximum specifies if the Maximum is exclusive. // +optional @@ -199,16 +197,12 @@ type JSONSchemaProps struct { // If ExclusiveMinimum is false, the variable is valid if it is greater than, or equal to, the value of Minimum. // If ExclusiveMinimum is true, the variable is valid if it is strictly greater than the value of Minimum. // +optional - Minimum *json.Number `json:"minimum,omitempty"` + Minimum *int64 `json:"minimum,omitempty"` // ExclusiveMinimum specifies if the Minimum is exclusive. // +optional ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` - // MultipleOf specifies the number of which the variable must be a multiple of. - // +optional - MultipleOf *json.Number `json:"multipleOf,omitempty"` - // Enum is the list of valid values of the variable. // +optional Enum []apiextensionsv1.JSON `json:"enum,omitempty"` diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index b85850286e0e..3eac94901504 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -21,7 +21,6 @@ limitations under the License. package v1beta1 import ( - "encoding/json" "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -566,17 +565,12 @@ func (in *JSONSchemaProps) DeepCopyInto(out *JSONSchemaProps) { } if in.Maximum != nil { in, out := &in.Maximum, &out.Maximum - *out = new(json.Number) + *out = new(int64) **out = **in } if in.Minimum != nil { in, out := &in.Minimum, &out.Minimum - *out = new(json.Number) - **out = **in - } - if in.MultipleOf != nil { - in, out := &in.MultipleOf, &out.MultipleOf - *out = new(json.Number) + *out = new(int64) **out = **in } if in.Enum != nil { diff --git a/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml b/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml index 5f9191e7a541..596ccc2d440a 100644 --- a/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml +++ b/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml @@ -756,7 +756,8 @@ spec: the value of Maximum. If ExclusiveMaximum is true, the variable is valid if it is strictly lower than the value of Maximum. - type: string + format: int64 + type: integer minLength: description: MinLength is the min length of a string variable. @@ -769,11 +770,8 @@ spec: to, the value of Minimum. If ExclusiveMinimum is true, the variable is valid if it is strictly greater than the value of Minimum. - type: string - multipleOf: - description: MultipleOf specifies the number of which - the variable must be a multiple of. - type: string + format: int64 + type: integer nullable: description: Nullable specifies if the variable can be set to null.