feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> * feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> --------- Signed-off-by: ci-bot <ci-bot@kubesphere.io> Co-authored-by: ks-ci-bot <ks-ci-bot@example.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
committed by
GitHub
parent
b5015ec7b9
commit
447a51f08b
7
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/crd.go
generated
vendored
7
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/crd.go
generated
vendored
@@ -283,7 +283,7 @@ type Resource struct {
|
||||
Scope string `marker:",optional"`
|
||||
}
|
||||
|
||||
func (s Resource) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error {
|
||||
func (s Resource) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, _ string) error {
|
||||
if s.Path != "" {
|
||||
crd.Names.Plural = s.Path
|
||||
}
|
||||
@@ -362,13 +362,16 @@ type Metadata struct {
|
||||
Labels []string `marker:",optional"`
|
||||
}
|
||||
|
||||
func (s Metadata) ApplyToCRD(crd *apiext.CustomResourceDefinition, version string) error {
|
||||
func (s Metadata) ApplyToCRD(crd *apiext.CustomResourceDefinition, _ string) error {
|
||||
if len(s.Annotations) > 0 {
|
||||
if crd.Annotations == nil {
|
||||
crd.Annotations = map[string]string{}
|
||||
}
|
||||
for _, str := range s.Annotations {
|
||||
kv := strings.SplitN(str, "=", 2)
|
||||
if len(kv) < 2 {
|
||||
return fmt.Errorf("annotation %s is not in 'xxx=xxx' format", str)
|
||||
}
|
||||
crd.Annotations[kv[0]] = kv[1]
|
||||
}
|
||||
}
|
||||
|
||||
30
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/validation.go
generated
vendored
30
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/validation.go
generated
vendored
@@ -86,6 +86,9 @@ var FieldOnlyMarkers = []*definitionWithHelp{
|
||||
must(markers.MakeAnyTypeDefinition("kubebuilder:default", markers.DescribesField, Default{})).
|
||||
WithHelp(Default{}.Help()),
|
||||
|
||||
must(markers.MakeAnyTypeDefinition("kubebuilder:example", markers.DescribesField, Example{})).
|
||||
WithHelp(Example{}.Help()),
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:validation:EmbeddedResource", markers.DescribesField, XEmbeddedResource{})).
|
||||
WithHelp(XEmbeddedResource{}.Help()),
|
||||
|
||||
@@ -170,7 +173,7 @@ type Pattern string
|
||||
type MaxItems int
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// MinItems specifies the minimun length for this list.
|
||||
// MinItems specifies the minimum length for this list.
|
||||
type MinItems int
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
@@ -222,6 +225,19 @@ type Default struct {
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// Example sets the example value for this field.
|
||||
//
|
||||
// An example value will be accepted as any value valid for the
|
||||
// field. Formatting for common types include: boolean: `true`, string:
|
||||
// `Cluster`, numerical: `1.24`, array: `{1,2}`, object: `{policy:
|
||||
// "delete"}`). Examples should be defined in pruned form, and only best-effort
|
||||
// validation will be performed. Full validation of an example requires
|
||||
// submission of the containing CRD to an apiserver.
|
||||
type Example struct {
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD processing"
|
||||
// PreserveUnknownFields stops the apiserver from pruning fields which are not specified.
|
||||
//
|
||||
@@ -461,10 +477,22 @@ func (m Default) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if schema.Type == "array" && string(marshalledDefault) == "{}" {
|
||||
marshalledDefault = []byte("[]")
|
||||
}
|
||||
schema.Default = &apiext.JSON{Raw: marshalledDefault}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m Example) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
marshalledExample, err := json.Marshal(m.Value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
schema.Example = &apiext.JSON{Raw: marshalledExample}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m XPreserveUnknownFields) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
defTrue := true
|
||||
schema.XPreserveUnknownFields = &defTrue
|
||||
|
||||
19
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/zz_generated.markerhelp.go
generated
vendored
19
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/zz_generated.markerhelp.go
generated
vendored
@@ -1,5 +1,4 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright2019 The Kubernetes Authors.
|
||||
@@ -68,6 +67,22 @@ func (Enum) Help() *markers.DefinitionHelp {
|
||||
}
|
||||
}
|
||||
|
||||
func (Example) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "sets the example value for this field. ",
|
||||
Details: "An example value will be accepted as any value valid for the field. Formatting for common types include: boolean: `true`, string: `Cluster`, numerical: `1.24`, array: `{1,2}`, object: `{policy: \"delete\"}`). Examples should be defined in pruned form, and only best-effort validation will be performed. Full validation of an example requires submission of the containing CRD to an apiserver.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{
|
||||
"Value": {
|
||||
Summary: "",
|
||||
Details: "",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (ExclusiveMaximum) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
@@ -202,7 +217,7 @@ func (MinItems) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies the minimun length for this list.",
|
||||
Summary: "specifies the minimum length for this list.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
|
||||
Reference in New Issue
Block a user