Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 ClusterClass variable schema: drop multipleOf, change min/max to *int64 #5494

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions api/v1alpha4/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package v1alpha4

import (
"encoding/json"
"testing"

fuzz "github.com/google/gofuzz"
Expand Down Expand Up @@ -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
}
10 changes: 2 additions & 8 deletions api/v1beta1/clusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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"`
Expand Down
10 changes: 2 additions & 8 deletions api/v1beta1/zz_generated.deepcopy.go

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

10 changes: 4 additions & 6 deletions config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down