Skip to content

Commit

Permalink
Merge pull request #5494 from sbueringer/pr-change-minmax-to-int
Browse files Browse the repository at this point in the history
🐛 ClusterClass variable schema: drop multipleOf, change min/max to *int64
  • Loading branch information
k8s-ci-robot committed Oct 25, 2021
2 parents 1187c4e + 86f58e4 commit e0f4b6f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 29 deletions.
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

0 comments on commit e0f4b6f

Please sign in to comment.