update vendor

Signed-off-by: Roland.Ma <rolandma@yunify.com>
This commit is contained in:
Roland.Ma
2021-08-11 07:10:14 +00:00
parent a18f72b565
commit ea8f47c73a
2901 changed files with 269317 additions and 43103 deletions

View File

@@ -48,6 +48,9 @@ var CRDMarkers = []*definitionWithHelp{
must(markers.MakeDefinition("kubebuilder:unservedversion", markers.DescribesType, UnservedVersion{})).
WithHelp(UnservedVersion{}.Help()),
must(markers.MakeDefinition("kubebuilder:deprecatedversion", markers.DescribesType, DeprecatedVersion{})).
WithHelp(DeprecatedVersion{}.Help()),
}
// TODO: categories and singular used to be annotations types
@@ -316,3 +319,29 @@ func (s UnservedVersion) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, ve
}
// NB(directxman12): singular was historically distinct, so we keep it here for backwards compat
// +controllertools:marker:generateHelp:category=CRD
// DeprecatedVersion marks this version as deprecated.
type DeprecatedVersion struct {
// Warning message to be shown on the deprecated version
Warning *string `marker:",optional"`
}
func (s DeprecatedVersion) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error {
if version == "" {
// single-version, do nothing
return nil
}
// multi-version
for i := range crd.Versions {
ver := &crd.Versions[i]
if ver.Name != version {
continue
}
ver.Deprecated = true
ver.DeprecationWarning = s.Warning
break
}
return nil
}

View File

@@ -26,6 +26,10 @@ import (
"sigs.k8s.io/controller-tools/pkg/markers"
)
const (
SchemalessName = "kubebuilder:validation:Schemaless"
)
// ValidationMarkers lists all available markers that affect CRD schema generation,
// except for the few that don't make sense as type-level markers (see FieldOnlyMarkers).
// All markers start with `+kubebuilder:validation:`, and continue with their type name.
@@ -82,6 +86,9 @@ var FieldOnlyMarkers = []*definitionWithHelp{
must(markers.MakeDefinition("kubebuilder:validation:EmbeddedResource", markers.DescribesField, XEmbeddedResource{})).
WithHelp(XEmbeddedResource{}.Help()),
must(markers.MakeDefinition(SchemalessName, markers.DescribesField, Schemaless{})).
WithHelp(Schemaless{}.Help()),
}
// ValidationIshMarkers are field-and-type markers that don't fall under the
@@ -225,6 +232,16 @@ type XPreserveUnknownFields struct{}
// field, yet it is possible. This can be combined with PreserveUnknownFields.
type XEmbeddedResource struct{}
// +controllertools:marker:generateHelp:category="CRD validation"
// Schemaless marks a field as being a schemaless object.
//
// Schemaless objects are not introspected, so you must provide
// any type and validation information yourself. One use for this
// tag is for embedding fields that hold JSONSchema typed objects.
// Because this field disables all type checking, it is recommended
// to be used only as a last resort.
type Schemaless struct{}
func (m Maximum) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
if schema.Type != "integer" {
return fmt.Errorf("must apply maximum to an integer")

View File

@@ -32,7 +32,7 @@ func (Default) Help() *markers.DefinitionHelp {
Details: "A default 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\"}`). Defaults should be defined in pruned form, and only best-effort validation will be performed. Full validation of a default requires submission of the containing CRD to an apiserver.",
},
FieldHelp: map[string]markers.DetailedHelp{
"Value": markers.DetailedHelp{
"Value": {
Summary: "",
Details: "",
},
@@ -40,6 +40,22 @@ func (Default) Help() *markers.DefinitionHelp {
}
}
func (DeprecatedVersion) Help() *markers.DefinitionHelp {
return &markers.DefinitionHelp{
Category: "CRD",
DetailedHelp: markers.DetailedHelp{
Summary: "marks this version as deprecated.",
Details: "",
},
FieldHelp: map[string]markers.DetailedHelp{
"Warning": markers.DetailedHelp{
Summary: "message to be shown on the deprecated version",
Details: "",
},
},
}
}
func (Enum) Help() *markers.DefinitionHelp {
return &markers.DefinitionHelp{
Category: "CRD validation",
@@ -246,27 +262,27 @@ func (PrintColumn) Help() *markers.DefinitionHelp {
Details: "",
},
FieldHelp: map[string]markers.DetailedHelp{
"Name": markers.DetailedHelp{
"Name": {
Summary: "specifies the name of the column.",
Details: "",
},
"Type": markers.DetailedHelp{
"Type": {
Summary: "indicates the type of the column. ",
Details: "It may be any OpenAPI data type listed at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types.",
},
"JSONPath": markers.DetailedHelp{
"JSONPath": {
Summary: "specifies the jsonpath expression used to extract the value of the column.",
Details: "",
},
"Description": markers.DetailedHelp{
"Description": {
Summary: "specifies the help/description for this column.",
Details: "",
},
"Format": markers.DetailedHelp{
"Format": {
Summary: "specifies the format of the column. ",
Details: "It may be any OpenAPI data format corresponding to the type, listed at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types.",
},
"Priority": markers.DetailedHelp{
"Priority": {
Summary: "indicates how important it is that this column be displayed. ",
Details: "Lower priority (*higher* numbered) columns will be hidden if the terminal width is too small.",
},
@@ -282,23 +298,23 @@ func (Resource) Help() *markers.DefinitionHelp {
Details: "",
},
FieldHelp: map[string]markers.DetailedHelp{
"Path": markers.DetailedHelp{
"Path": {
Summary: "specifies the plural \"resource\" for this CRD. ",
Details: "It generally corresponds to a plural, lower-cased version of the Kind. See https://book.kubebuilder.io/cronjob-tutorial/gvks.html.",
},
"ShortName": markers.DetailedHelp{
"ShortName": {
Summary: "specifies aliases for this CRD. ",
Details: "Short names are often used when people have work with your resource over and over again. For instance, \"rs\" for \"replicaset\" or \"crd\" for customresourcedefinition.",
},
"Categories": markers.DetailedHelp{
"Categories": {
Summary: "specifies which group aliases this resource is part of. ",
Details: "Group aliases are used to work with groups of resources at once. The most common one is \"all\" which covers about a third of the base resources in Kubernetes, and is generally used for \"user-facing\" resources.",
},
"Singular": markers.DetailedHelp{
"Singular": {
Summary: "overrides the singular form of your resource. ",
Details: "The singular form is otherwise defaulted off the plural (path).",
},
"Scope": markers.DetailedHelp{
"Scope": {
Summary: "overrides the scope of the CRD (Cluster vs Namespaced). ",
Details: "Scope defaults to \"Namespaced\". Cluster-scoped (\"Cluster\") resources don't exist in namespaces.",
},
@@ -306,6 +322,17 @@ func (Resource) Help() *markers.DefinitionHelp {
}
}
func (Schemaless) Help() *markers.DefinitionHelp {
return &markers.DefinitionHelp{
Category: "CRD validation",
DetailedHelp: markers.DetailedHelp{
Summary: "marks a field as being a schemaless object. ",
Details: "Schemaless objects are not introspected, so you must provide any type and validation information yourself. One use for this tag is for embedding fields that hold JSONSchema typed objects. Because this field disables all type checking, it is recommended to be used only as a last resort.",
},
FieldHelp: map[string]markers.DetailedHelp{},
}
}
func (SkipVersion) Help() *markers.DefinitionHelp {
return &markers.DefinitionHelp{
Category: "CRD",
@@ -347,15 +374,15 @@ func (SubresourceScale) Help() *markers.DefinitionHelp {
Details: "",
},
FieldHelp: map[string]markers.DetailedHelp{
"SpecPath": markers.DetailedHelp{
"SpecPath": {
Summary: "specifies the jsonpath to the replicas field for the scale's spec.",
Details: "",
},
"StatusPath": markers.DetailedHelp{
"StatusPath": {
Summary: "specifies the jsonpath to the replicas field for the scale's status.",
Details: "",
},
"SelectorPath": markers.DetailedHelp{
"SelectorPath": {
Summary: "specifies the jsonpath to the pod label selector field for the scale's status. ",
Details: "The selector field must be the *string* form (serialized form) of a selector. Setting a pod label selector is necessary for your type to work with the HorizontalPodAutoscaler.",
},