update dependencies (#6267)
Signed-off-by: hongming <coder.scala@gmail.com>
This commit is contained in:
32
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/crd.go
generated
vendored
32
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/crd.go
generated
vendored
@@ -55,6 +55,9 @@ var CRDMarkers = []*definitionWithHelp{
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:metadata", markers.DescribesType, Metadata{})).
|
||||
WithHelp(Metadata{}.Help()),
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:selectablefield", markers.DescribesType, SelectableField{})).
|
||||
WithHelp(SelectableField{}.Help()),
|
||||
}
|
||||
|
||||
// TODO: categories and singular used to be annotations types
|
||||
@@ -388,3 +391,32 @@ func (s Metadata) ApplyToCRD(crd *apiext.CustomResourceDefinition, _ string) err
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category=CRD
|
||||
|
||||
// SelectableField adds a field that may be used with field selectors.
|
||||
type SelectableField struct {
|
||||
// JSONPath specifies the jsonpath expression which is used to produce a field selector value.
|
||||
JSONPath string `marker:"JSONPath"`
|
||||
}
|
||||
|
||||
func (s SelectableField) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error {
|
||||
var selectableFields *[]apiext.SelectableField
|
||||
for i := range crd.Versions {
|
||||
ver := &crd.Versions[i]
|
||||
if ver.Name != version {
|
||||
continue
|
||||
}
|
||||
selectableFields = &ver.SelectableFields
|
||||
break
|
||||
}
|
||||
if selectableFields == nil {
|
||||
return fmt.Errorf("selectable field applied to version %q not in CRD", version)
|
||||
}
|
||||
|
||||
*selectableFields = append(*selectableFields, apiext.SelectableField{
|
||||
JSONPath: s.JSONPath,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
17
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/doc.go
generated
vendored
17
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/doc.go
generated
vendored
@@ -26,7 +26,20 @@ limitations under the License.
|
||||
// be run after the rest of a given schema node has been generated.
|
||||
// Markers that need to be run before any other markers can also
|
||||
// implement ApplyFirst, but this is discouraged and may change
|
||||
// in the future.
|
||||
// in the future. It is recommended to implement the ApplyPriority
|
||||
// interface in combination with ApplyPriorityDefault and
|
||||
// ApplyPriorityFirst constants. Following is an example of how to
|
||||
// implement such a marker:
|
||||
//
|
||||
// type MyCustomMarker string
|
||||
//
|
||||
// func (m MyCustomMarker) ApplyPriority() ApplyPriority {
|
||||
// return ApplyPriorityFirst
|
||||
// }
|
||||
//
|
||||
// func (m MyCustomMarker) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
// All validation markers start with "+kubebuilder:validation", and
|
||||
// have the same name as their type name.
|
||||
@@ -34,7 +47,7 @@ limitations under the License.
|
||||
// # CRD Markers
|
||||
//
|
||||
// Markers that modify anything in the CRD itself *except* for the schema
|
||||
// implement ApplyToCRD (crd.CRDMarker). They are expected to detect whether
|
||||
// implement ApplyToCRD (crd.SpecMarker). They are expected to detect whether
|
||||
// they should apply themselves to a specific version in the CRD (as passed to
|
||||
// them), or to the root-level CRD for legacy cases. They are applied *after*
|
||||
// the rest of the CRD is computed.
|
||||
|
||||
2
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/package.go
generated
vendored
2
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/package.go
generated
vendored
@@ -22,7 +22,7 @@ import (
|
||||
|
||||
func init() {
|
||||
AllDefinitions = append(AllDefinitions,
|
||||
must(markers.MakeDefinition("groupName", markers.DescribesPackage, "")).
|
||||
mustOptional(markers.MakeDefinition("groupName", markers.DescribesPackage, "")).
|
||||
WithHelp(markers.SimpleHelp("CRD", "specifies the API group name for this package.")),
|
||||
|
||||
must(markers.MakeDefinition("versionName", markers.DescribesPackage, "")).
|
||||
|
||||
37
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/priority.go
generated
vendored
Normal file
37
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/priority.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright 2022 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package markers
|
||||
|
||||
// ApplyPriority designates the order markers should be applied.
|
||||
// Lower priority indicates it should be applied first
|
||||
type ApplyPriority int64
|
||||
|
||||
const (
|
||||
// ApplyPriorityDefault is the default priority for markers
|
||||
// that don't implement ApplyPriorityMarker
|
||||
ApplyPriorityDefault ApplyPriority = 10
|
||||
|
||||
// ApplyPriorityFirst is the priority value assigned to markers
|
||||
// that implement the ApplyFirst() method
|
||||
ApplyPriorityFirst ApplyPriority = 1
|
||||
)
|
||||
|
||||
// ApplyPriorityMarker designates the order validation markers should be applied.
|
||||
// Lower priority indicates it should be applied first
|
||||
type ApplyPriorityMarker interface {
|
||||
ApplyPriority() ApplyPriority
|
||||
}
|
||||
24
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/register.go
generated
vendored
24
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/register.go
generated
vendored
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package markers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"sigs.k8s.io/controller-tools/pkg/markers"
|
||||
@@ -42,12 +43,33 @@ func (d *definitionWithHelp) Register(reg *markers.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *definitionWithHelp) clone() *definitionWithHelp {
|
||||
newDef, newHelp := *d.Definition, *d.Help
|
||||
return &definitionWithHelp{
|
||||
Definition: &newDef,
|
||||
Help: &newHelp,
|
||||
}
|
||||
}
|
||||
|
||||
func must(def *markers.Definition, err error) *definitionWithHelp {
|
||||
return &definitionWithHelp{
|
||||
Definition: markers.Must(def, err),
|
||||
}
|
||||
}
|
||||
|
||||
func mustOptional(def *markers.Definition, err error) *definitionWithHelp {
|
||||
def = markers.Must(def, err)
|
||||
if !def.AnonymousField() {
|
||||
def = markers.Must(def, fmt.Errorf("not an anonymous field: %v", def))
|
||||
}
|
||||
field := def.Fields[""]
|
||||
field.Optional = true
|
||||
def.Fields[""] = field
|
||||
return &definitionWithHelp{
|
||||
Definition: def,
|
||||
}
|
||||
}
|
||||
|
||||
// AllDefinitions contains all marker definitions for this package.
|
||||
var AllDefinitions []*definitionWithHelp
|
||||
|
||||
@@ -60,7 +82,7 @@ type hasHelp interface {
|
||||
func mustMakeAllWithPrefix(prefix string, target markers.TargetType, objs ...interface{}) []*definitionWithHelp {
|
||||
defs := make([]*definitionWithHelp, len(objs))
|
||||
for i, obj := range objs {
|
||||
name := prefix + ":" + reflect.TypeOf(obj).Name()
|
||||
name := prefix + reflect.TypeOf(obj).Name()
|
||||
def, err := markers.MakeDefinition(name, target, obj)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
4
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/topology.go
generated
vendored
4
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/topology.go
generated
vendored
@@ -119,7 +119,9 @@ func (l ListType) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l ListType) ApplyFirst() {}
|
||||
func (l ListType) ApplyPriority() ApplyPriority {
|
||||
return ApplyPriorityDefault - 1
|
||||
}
|
||||
|
||||
func (l ListMapKey) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "array" {
|
||||
|
||||
123
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/validation.go
generated
vendored
123
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/validation.go
generated
vendored
@@ -20,6 +20,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
@@ -27,7 +28,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
SchemalessName = "kubebuilder:validation:Schemaless"
|
||||
validationPrefix = "kubebuilder:validation:"
|
||||
|
||||
SchemalessName = "kubebuilder:validation:Schemaless"
|
||||
ValidationItemsPrefix = validationPrefix + "items:"
|
||||
)
|
||||
|
||||
// ValidationMarkers lists all available markers that affect CRD schema generation,
|
||||
@@ -35,7 +39,9 @@ const (
|
||||
// All markers start with `+kubebuilder:validation:`, and continue with their type name.
|
||||
// A copy is produced of all markers that describes types as well, for making types
|
||||
// reusable and writing complex validations on slice items.
|
||||
var ValidationMarkers = mustMakeAllWithPrefix("kubebuilder:validation", markers.DescribesField,
|
||||
// At last a copy of all markers with the prefix `+kubebuilder:validation:items:` is
|
||||
// produced for marking slice fields and types.
|
||||
var ValidationMarkers = mustMakeAllWithPrefix(validationPrefix, markers.DescribesField,
|
||||
|
||||
// numeric markers
|
||||
|
||||
@@ -74,17 +80,21 @@ var ValidationMarkers = mustMakeAllWithPrefix("kubebuilder:validation", markers.
|
||||
// sense on a type, and thus aren't in ValidationMarkers).
|
||||
var FieldOnlyMarkers = []*definitionWithHelp{
|
||||
must(markers.MakeDefinition("kubebuilder:validation:Required", markers.DescribesField, struct{}{})).
|
||||
WithHelp(markers.SimpleHelp("CRD validation", "specifies that this field is required, if fields are optional by default.")),
|
||||
WithHelp(markers.SimpleHelp("CRD validation", "specifies that this field is required.")),
|
||||
must(markers.MakeDefinition("kubebuilder:validation:Optional", markers.DescribesField, struct{}{})).
|
||||
WithHelp(markers.SimpleHelp("CRD validation", "specifies that this field is optional, if fields are required by default.")),
|
||||
WithHelp(markers.SimpleHelp("CRD validation", "specifies that this field is optional.")),
|
||||
must(markers.MakeDefinition("required", markers.DescribesField, struct{}{})).
|
||||
WithHelp(markers.SimpleHelp("CRD validation", "specifies that this field is required.")),
|
||||
must(markers.MakeDefinition("optional", markers.DescribesField, struct{}{})).
|
||||
WithHelp(markers.SimpleHelp("CRD validation", "specifies that this field is optional, if fields are required by default.")),
|
||||
WithHelp(markers.SimpleHelp("CRD validation", "specifies that this field is optional.")),
|
||||
|
||||
must(markers.MakeDefinition("nullable", markers.DescribesField, Nullable{})).
|
||||
WithHelp(Nullable{}.Help()),
|
||||
|
||||
must(markers.MakeAnyTypeDefinition("kubebuilder:default", markers.DescribesField, Default{})).
|
||||
WithHelp(Default{}.Help()),
|
||||
must(markers.MakeDefinition("default", markers.DescribesField, KubernetesDefault{})).
|
||||
WithHelp(KubernetesDefault{}.Help()),
|
||||
|
||||
must(markers.MakeAnyTypeDefinition("kubebuilder:example", markers.DescribesField, Example{})).
|
||||
WithHelp(Example{}.Help()),
|
||||
@@ -110,14 +120,22 @@ func init() {
|
||||
AllDefinitions = append(AllDefinitions, ValidationMarkers...)
|
||||
|
||||
for _, def := range ValidationMarkers {
|
||||
newDef := *def.Definition
|
||||
// copy both parts so we don't change the definition
|
||||
typDef := definitionWithHelp{
|
||||
Definition: &newDef,
|
||||
Help: def.Help,
|
||||
}
|
||||
typDef := def.clone()
|
||||
typDef.Target = markers.DescribesType
|
||||
AllDefinitions = append(AllDefinitions, &typDef)
|
||||
AllDefinitions = append(AllDefinitions, typDef)
|
||||
|
||||
itemsName := ValidationItemsPrefix + strings.TrimPrefix(def.Name, validationPrefix)
|
||||
|
||||
itemsFieldDef := def.clone()
|
||||
itemsFieldDef.Name = itemsName
|
||||
itemsFieldDef.Help.Summary = "for array items " + itemsFieldDef.Help.Summary
|
||||
AllDefinitions = append(AllDefinitions, itemsFieldDef)
|
||||
|
||||
itemsTypDef := def.clone()
|
||||
itemsTypDef.Name = itemsName
|
||||
itemsTypDef.Help.Summary = "for array items " + itemsTypDef.Help.Summary
|
||||
itemsTypDef.Target = markers.DescribesType
|
||||
AllDefinitions = append(AllDefinitions, itemsTypDef)
|
||||
}
|
||||
|
||||
AllDefinitions = append(AllDefinitions, FieldOnlyMarkers...)
|
||||
@@ -225,6 +243,20 @@ type Default struct {
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// Default sets the default value for this field.
|
||||
//
|
||||
// A default value will be accepted as any value valid for the field.
|
||||
// Only JSON-formatted values are accepted. `ref(...)` values are ignored.
|
||||
// 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.
|
||||
type KubernetesDefault struct {
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// Example sets the example value for this field.
|
||||
//
|
||||
@@ -266,7 +298,7 @@ type XEmbeddedResource struct{}
|
||||
// IntOrString marks a fields as an IntOrString.
|
||||
//
|
||||
// This is required when applying patterns or other validations to an IntOrString
|
||||
// field. Knwon information about the type is applied during the collapse phase
|
||||
// field. Known information about the type is applied during the collapse phase
|
||||
// and as such is not normally available during marker application.
|
||||
type XIntOrString struct{}
|
||||
|
||||
@@ -295,8 +327,11 @@ func isIntegral(value float64) bool {
|
||||
// This marker may be repeated to specify multiple expressions, all of
|
||||
// which must evaluate to true.
|
||||
type XValidation struct {
|
||||
Rule string
|
||||
Message string `marker:",optional"`
|
||||
Rule string
|
||||
Message string `marker:",optional"`
|
||||
MessageExpression string `marker:"messageExpression,optional"`
|
||||
Reason string `marker:"reason,optional"`
|
||||
FieldPath string `marker:"fieldPath,optional"`
|
||||
}
|
||||
|
||||
func (m Maximum) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
@@ -464,7 +499,9 @@ func (m Type) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m Type) ApplyFirst() {}
|
||||
func (m Type) ApplyPriority() ApplyPriority {
|
||||
return ApplyPriorityDefault - 1
|
||||
}
|
||||
|
||||
func (m Nullable) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
schema.Nullable = true
|
||||
@@ -484,6 +521,39 @@ func (m Default) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m Default) ApplyPriority() ApplyPriority {
|
||||
// explicitly go after +default markers, so kubebuilder-specific defaults get applied last and stomp
|
||||
return 10
|
||||
}
|
||||
|
||||
func (m *KubernetesDefault) ParseMarker(_ string, _ string, restFields string) error {
|
||||
if strings.HasPrefix(strings.TrimSpace(restFields), "ref(") {
|
||||
// Skip +default=ref(...) values for now, since we don't have a good way to evaluate go constant values via AST.
|
||||
// See https://github.com/kubernetes-sigs/controller-tools/pull/938#issuecomment-2096790018
|
||||
return nil
|
||||
}
|
||||
return json.Unmarshal([]byte(restFields), &m.Value)
|
||||
}
|
||||
|
||||
// Defaults are only valid CRDs created with the v1 API
|
||||
func (m KubernetesDefault) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if m.Value == nil {
|
||||
// only apply to the schema if we have a non-nil default value
|
||||
return nil
|
||||
}
|
||||
marshalledDefault, err := json.Marshal(m.Value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
schema.Default = &apiext.JSON{Raw: marshalledDefault}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m KubernetesDefault) ApplyPriority() ApplyPriority {
|
||||
// explicitly go before +kubebuilder:default markers, so kubebuilder-specific defaults get applied last and stomp
|
||||
return 9
|
||||
}
|
||||
|
||||
func (m Example) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
marshalledExample, err := json.Marshal(m.Value)
|
||||
if err != nil {
|
||||
@@ -512,12 +582,27 @@ func (m XIntOrString) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m XIntOrString) ApplyFirst() {}
|
||||
func (m XIntOrString) ApplyPriority() ApplyPriority {
|
||||
return ApplyPriorityDefault - 1
|
||||
}
|
||||
|
||||
func (m XValidation) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
var reason *apiext.FieldValueErrorReason
|
||||
if m.Reason != "" {
|
||||
switch m.Reason {
|
||||
case string(apiext.FieldValueRequired), string(apiext.FieldValueInvalid), string(apiext.FieldValueForbidden), string(apiext.FieldValueDuplicate):
|
||||
reason = (*apiext.FieldValueErrorReason)(&m.Reason)
|
||||
default:
|
||||
return fmt.Errorf("invalid reason %s, valid values are %s, %s, %s and %s", m.Reason, apiext.FieldValueRequired, apiext.FieldValueInvalid, apiext.FieldValueForbidden, apiext.FieldValueDuplicate)
|
||||
}
|
||||
}
|
||||
|
||||
schema.XValidations = append(schema.XValidations, apiext.ValidationRule{
|
||||
Rule: m.Rule,
|
||||
Message: m.Message,
|
||||
Rule: m.Rule,
|
||||
Message: m.Message,
|
||||
MessageExpression: m.MessageExpression,
|
||||
Reason: reason,
|
||||
FieldPath: m.FieldPath,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
146
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/zz_generated.markerhelp.go
generated
vendored
146
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/zz_generated.markerhelp.go
generated
vendored
@@ -28,8 +28,8 @@ func (Default) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "sets the default value for this field. ",
|
||||
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.",
|
||||
Summary: "sets the default value for this field.",
|
||||
Details: "A default value will be accepted as any value valid for the\nfield. Formatting for common types include: boolean: `true`, string:\n`Cluster`, numerical: `1.24`, array: `{1,2}`, object: `{policy:\n\"delete\"}`). Defaults should be defined in pruned form, and only best-effort\nvalidation will be performed. Full validation of a default requires\nsubmission of the containing CRD to an apiserver.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{
|
||||
"Value": {
|
||||
@@ -71,8 +71,8 @@ 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.",
|
||||
Summary: "sets the example value for this field.",
|
||||
Details: "An example value will be accepted as any value valid for the\nfield. Formatting for common types include: boolean: `true`, string:\n`Cluster`, numerical: `1.24`, array: `{1,2}`, object: `{policy:\n\"delete\"}`). Examples should be defined in pruned form, and only best-effort\nvalidation will be performed. Full validation of an example requires\nsubmission of the containing CRD to an apiserver.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{
|
||||
"Value": {
|
||||
@@ -109,19 +109,35 @@ func (Format) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies additional \"complex\" formatting for this field. ",
|
||||
Details: "For example, a date-time field would be marked as \"type: string\" and \"format: date-time\".",
|
||||
Summary: "specifies additional \"complex\" formatting for this field.",
|
||||
Details: "For example, a date-time field would be marked as \"type: string\" and\n\"format: date-time\".",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (KubernetesDefault) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "Default sets the default value for this field.",
|
||||
Details: "A default value will be accepted as any value valid for the field.\nOnly JSON-formatted values are accepted. `ref(...)` values are ignored.\nFormatting for common types include: boolean: `true`, string:\n`\"Cluster\"`, numerical: `1.24`, array: `[1,2]`, object: `{\"policy\":\n\"delete\"}`). Defaults should be defined in pruned form, and only best-effort\nvalidation will be performed. Full validation of a default requires\nsubmission of the containing CRD to an apiserver.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{
|
||||
"Value": {
|
||||
Summary: "",
|
||||
Details: "",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (ListMapKey) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD processing",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies the keys to map listTypes. ",
|
||||
Details: "It indicates the index of a map list. They can be repeated if multiple keys must be used. It can only be used when ListType is set to map, and the keys should be scalar types.",
|
||||
Summary: "specifies the keys to map listTypes.",
|
||||
Details: "It indicates the index of a map list. They can be repeated if multiple keys\nmust be used. It can only be used when ListType is set to map, and the keys\nshould be scalar types.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
@@ -131,8 +147,8 @@ func (ListType) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD processing",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies the type of data-structure that the list represents (map, set, atomic). ",
|
||||
Details: "Possible data-structure types of a list are: \n - \"map\": it needs to have a key field, which will be used to build an associative list. A typical example is a the pod container list, which is indexed by the container name. \n - \"set\": Fields need to be \"scalar\", and there can be only one occurrence of each. \n - \"atomic\": All the fields in the list are treated as a single value, are typically manipulated together by the same actor.",
|
||||
Summary: "specifies the type of data-structure that the list",
|
||||
Details: "represents (map, set, atomic).\n\nPossible data-structure types of a list are:\n\n - \"map\": it needs to have a key field, which will be used to build an\n associative list. A typical example is a the pod container list,\n which is indexed by the container name.\n\n - \"set\": Fields need to be \"scalar\", and there can be only one\n occurrence of each.\n\n - \"atomic\": All the fields in the list are treated as a single value,\n are typically manipulated together by the same actor.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
@@ -142,8 +158,8 @@ func (MapType) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD processing",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies the level of atomicity of the map; i.e. whether each item in the map is independent of the others, or all fields are treated as a single unit. ",
|
||||
Details: "Possible values: \n - \"granular\": items in the map are independent of each other, and can be manipulated by different actors. This is the default behavior. \n - \"atomic\": all fields are treated as one unit. Any changes have to replace the entire map.",
|
||||
Summary: "specifies the level of atomicity of the map;",
|
||||
Details: "i.e. whether each item in the map is independent of the others,\nor all fields are treated as a single unit.\n\nPossible values:\n\n - \"granular\": items in the map are independent of each other,\n and can be manipulated by different actors.\n This is the default behavior.\n\n - \"atomic\": all fields are treated as one unit.\n Any changes have to replace the entire map.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
@@ -197,8 +213,8 @@ func (Metadata) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "configures the additional annotations or labels for this CRD. For example adding annotation \"api-approved.kubernetes.io\" for a CRD with Kubernetes groups, or annotation \"cert-manager.io/inject-ca-from-secret\" for a CRD that needs CA injection.",
|
||||
Details: "",
|
||||
Summary: "configures the additional annotations or labels for this CRD.",
|
||||
Details: "For example adding annotation \"api-approved.kubernetes.io\" for a CRD with Kubernetes groups,\nor annotation \"cert-manager.io/inject-ca-from-secret\" for a CRD that needs CA injection.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{
|
||||
"Annotations": {
|
||||
@@ -272,7 +288,7 @@ func (Nullable) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "marks this field as allowing the \"null\" value. ",
|
||||
Summary: "marks this field as allowing the \"null\" value.",
|
||||
Details: "This is often not necessary, but may be helpful with custom serialization.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
@@ -303,8 +319,8 @@ func (PrintColumn) Help() *markers.DefinitionHelp {
|
||||
Details: "",
|
||||
},
|
||||
"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.",
|
||||
Summary: "indicates the type of the column.",
|
||||
Details: "It may be any OpenAPI data type listed at\nhttps://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types.",
|
||||
},
|
||||
"JSONPath": {
|
||||
Summary: "specifies the jsonpath expression used to extract the value of the column.",
|
||||
@@ -315,12 +331,12 @@ func (PrintColumn) Help() *markers.DefinitionHelp {
|
||||
Details: "",
|
||||
},
|
||||
"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.",
|
||||
Summary: "specifies the format of the column.",
|
||||
Details: "It may be any OpenAPI data format corresponding to the type, listed at\nhttps://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types.",
|
||||
},
|
||||
"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.",
|
||||
Summary: "indicates how important it is that this column be displayed.",
|
||||
Details: "Lower priority (*higher* numbered) columns will be hidden if the terminal\nwidth is too small.",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -335,24 +351,24 @@ func (Resource) Help() *markers.DefinitionHelp {
|
||||
},
|
||||
FieldHelp: map[string]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.",
|
||||
Summary: "specifies the plural \"resource\" for this CRD.",
|
||||
Details: "It generally corresponds to a plural, lower-cased version of the Kind.\nSee https://book.kubebuilder.io/cronjob-tutorial/gvks.html.",
|
||||
},
|
||||
"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.",
|
||||
Summary: "specifies aliases for this CRD.",
|
||||
Details: "Short names are often used when people have work with your resource\nover and over again. For instance, \"rs\" for \"replicaset\" or\n\"crd\" for customresourcedefinition.",
|
||||
},
|
||||
"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.",
|
||||
Summary: "specifies which group aliases this resource is part of.",
|
||||
Details: "Group aliases are used to work with groups of resources at once.\nThe most common one is \"all\" which covers about a third of the base\nresources in Kubernetes, and is generally used for \"user-facing\" resources.",
|
||||
},
|
||||
"Singular": {
|
||||
Summary: "overrides the singular form of your resource. ",
|
||||
Summary: "overrides the singular form of your resource.",
|
||||
Details: "The singular form is otherwise defaulted off the plural (path).",
|
||||
},
|
||||
"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.",
|
||||
Summary: "overrides the scope of the CRD (Cluster vs Namespaced).",
|
||||
Details: "Scope defaults to \"Namespaced\". Cluster-scoped (\"Cluster\") resources\ndon't exist in namespaces.",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -362,19 +378,35 @@ 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.",
|
||||
Summary: "marks a field as being a schemaless object.",
|
||||
Details: "Schemaless objects are not introspected, so you must provide\nany type and validation information yourself. One use for this\ntag is for embedding fields that hold JSONSchema typed objects.\nBecause this field disables all type checking, it is recommended\nto be used only as a last resort.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (SelectableField) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "adds a field that may be used with field selectors.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{
|
||||
"JSONPath": {
|
||||
Summary: "specifies the jsonpath expression which is used to produce a field selector value.",
|
||||
Details: "",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (SkipVersion) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "removes the particular version of the CRD from the CRDs spec. ",
|
||||
Details: "This is useful if you need to skip generating and listing version entries for 'internal' resource versions, which typically exist if using the Kubernetes upstream conversion-gen tool.",
|
||||
Summary: "removes the particular version of the CRD from the CRDs spec.",
|
||||
Details: "This is useful if you need to skip generating and listing version entries\nfor 'internal' resource versions, which typically exist if using the\nKubernetes upstream conversion-gen tool.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
@@ -384,8 +416,8 @@ func (StorageVersion) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "marks this version as the \"storage version\" for the CRD for conversion. ",
|
||||
Details: "When conversion is enabled for a CRD (i.e. it's not a trivial-versions/single-version CRD), one version is set as the \"storage version\" to be stored in etcd. Attempting to store any other version will result in conversion to the storage version via a conversion webhook.",
|
||||
Summary: "marks this version as the \"storage version\" for the CRD for conversion.",
|
||||
Details: "When conversion is enabled for a CRD (i.e. it's not a trivial-versions/single-version CRD),\none version is set as the \"storage version\" to be stored in etcd. Attempting to store any\nother version will result in conversion to the storage version via a conversion webhook.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
@@ -395,8 +427,8 @@ func (StructType) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD processing",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies the level of atomicity of the struct; i.e. whether each field in the struct is independent of the others, or all fields are treated as a single unit. ",
|
||||
Details: "Possible values: \n - \"granular\": fields in the struct are independent of each other, and can be manipulated by different actors. This is the default behavior. \n - \"atomic\": all fields are treated as one unit. Any changes have to replace the entire struct.",
|
||||
Summary: "specifies the level of atomicity of the struct;",
|
||||
Details: "i.e. whether each field in the struct is independent of the others,\nor all fields are treated as a single unit.\n\nPossible values:\n\n - \"granular\": fields in the struct are independent of each other,\n and can be manipulated by different actors.\n This is the default behavior.\n\n - \"atomic\": all fields are treated as one unit.\n Any changes have to replace the entire struct.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
@@ -419,8 +451,8 @@ func (SubresourceScale) Help() *markers.DefinitionHelp {
|
||||
Details: "",
|
||||
},
|
||||
"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.",
|
||||
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.\nSetting a pod label selector is necessary for your type to work with the HorizontalPodAutoscaler.",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -441,8 +473,8 @@ func (Type) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "overrides the type for this field (which defaults to the equivalent of the Go type). ",
|
||||
Details: "This generally must be paired with custom serialization. For example, the metav1.Time field would be marked as \"type: string\" and \"format: date-time\".",
|
||||
Summary: "overrides the type for this field (which defaults to the equivalent of the Go type).",
|
||||
Details: "This generally must be paired with custom serialization. For example, the\nmetav1.Time field would be marked as \"type: string\" and \"format: date-time\".",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
@@ -463,7 +495,7 @@ func (UnservedVersion) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "does not serve this version. ",
|
||||
Summary: "does not serve this version.",
|
||||
Details: "This is useful if you need to drop support for a version in favor of a newer version.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
@@ -474,8 +506,8 @@ func (XEmbeddedResource) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "EmbeddedResource marks a fields as an embedded resource with apiVersion, kind and metadata fields. ",
|
||||
Details: "An embedded resource is a value that has apiVersion, kind and metadata fields. They are validated implicitly according to the semantics of the currently running apiserver. It is not necessary to add any additional schema for these field, yet it is possible. This can be combined with PreserveUnknownFields.",
|
||||
Summary: "EmbeddedResource marks a fields as an embedded resource with apiVersion, kind and metadata fields.",
|
||||
Details: "An embedded resource is a value that has apiVersion, kind and metadata fields.\nThey are validated implicitly according to the semantics of the currently\nrunning apiserver. It is not necessary to add any additional schema for these\nfield, yet it is possible. This can be combined with PreserveUnknownFields.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
@@ -485,8 +517,8 @@ func (XIntOrString) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "IntOrString marks a fields as an IntOrString. ",
|
||||
Details: "This is required when applying patterns or other validations to an IntOrString field. Knwon information about the type is applied during the collapse phase and as such is not normally available during marker application.",
|
||||
Summary: "IntOrString marks a fields as an IntOrString.",
|
||||
Details: "This is required when applying patterns or other validations to an IntOrString\nfield. Known information about the type is applied during the collapse phase\nand as such is not normally available during marker application.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
@@ -496,8 +528,8 @@ func (XPreserveUnknownFields) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD processing",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "PreserveUnknownFields stops the apiserver from pruning fields which are not specified. ",
|
||||
Details: "By default the apiserver drops unknown fields from the request payload during the decoding step. This marker stops the API server from doing so. It affects fields recursively, but switches back to normal pruning behaviour if nested properties or additionalProperties are specified in the schema. This can either be true or undefined. False is forbidden. \n NB: The kubebuilder:validation:XPreserveUnknownFields variant is deprecated in favor of the kubebuilder:pruning:PreserveUnknownFields variant. They function identically.",
|
||||
Summary: "PreserveUnknownFields stops the apiserver from pruning fields which are not specified.",
|
||||
Details: "By default the apiserver drops unknown fields from the request payload\nduring the decoding step. This marker stops the API server from doing so.\nIt affects fields recursively, but switches back to normal pruning behaviour\nif nested properties or additionalProperties are specified in the schema.\nThis can either be true or undefined. False\nis forbidden.\n\nNB: The kubebuilder:validation:XPreserveUnknownFields variant is deprecated\nin favor of the kubebuilder:pruning:PreserveUnknownFields variant. They function\nidentically.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
@@ -507,8 +539,8 @@ func (XValidation) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "marks a field as requiring a value for which a given expression evaluates to true. ",
|
||||
Details: "This marker may be repeated to specify multiple expressions, all of which must evaluate to true.",
|
||||
Summary: "marks a field as requiring a value for which a given",
|
||||
Details: "expression evaluates to true.\n\nThis marker may be repeated to specify multiple expressions, all of\nwhich must evaluate to true.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{
|
||||
"Rule": {
|
||||
@@ -519,6 +551,18 @@ func (XValidation) Help() *markers.DefinitionHelp {
|
||||
Summary: "",
|
||||
Details: "",
|
||||
},
|
||||
"MessageExpression": {
|
||||
Summary: "",
|
||||
Details: "",
|
||||
},
|
||||
"Reason": {
|
||||
Summary: "",
|
||||
Details: "",
|
||||
},
|
||||
"FieldPath": {
|
||||
Summary: "",
|
||||
Details: "",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user