use istio client-go library instead of knative (#1661)
use istio client-go library instead of knative bump kubernetes dependency version change code coverage to codecov
This commit is contained in:
293
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/crd.go
generated
vendored
Normal file
293
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/crd.go
generated
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
/*
|
||||
Copyright 2019 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
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"sigs.k8s.io/controller-tools/pkg/markers"
|
||||
)
|
||||
|
||||
// CRDMarkers lists all markers that directly modify the CRD (not validation
|
||||
// schemas).
|
||||
var CRDMarkers = []*definitionWithHelp{
|
||||
// TODO(directxman12): more detailed help
|
||||
must(markers.MakeDefinition("kubebuilder:subresource:status", markers.DescribesType, SubresourceStatus{})).
|
||||
WithHelp(SubresourceStatus{}.Help()),
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:subresource:scale", markers.DescribesType, SubresourceScale{})).
|
||||
WithHelp(SubresourceScale{}.Help()),
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:printcolumn", markers.DescribesType, PrintColumn{})).
|
||||
WithHelp(PrintColumn{}.Help()),
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:resource", markers.DescribesType, Resource{})).
|
||||
WithHelp(Resource{}.Help()),
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:storageversion", markers.DescribesType, StorageVersion{})).
|
||||
WithHelp(StorageVersion{}.Help()),
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:skipversion", markers.DescribesType, SkipVersion{})).
|
||||
WithHelp(SkipVersion{}.Help()),
|
||||
}
|
||||
|
||||
// TODO: categories and singular used to be annotations types
|
||||
// TODO: doc
|
||||
|
||||
func init() {
|
||||
AllDefinitions = append(AllDefinitions, CRDMarkers...)
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category=CRD
|
||||
|
||||
// SubresourceStatus enables the "/status" subresource on a CRD.
|
||||
type SubresourceStatus struct{}
|
||||
|
||||
func (s SubresourceStatus) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error {
|
||||
var subresources *apiext.CustomResourceSubresources
|
||||
for i := range crd.Versions {
|
||||
ver := &crd.Versions[i]
|
||||
if ver.Name != version {
|
||||
continue
|
||||
}
|
||||
if ver.Subresources == nil {
|
||||
ver.Subresources = &apiext.CustomResourceSubresources{}
|
||||
}
|
||||
subresources = ver.Subresources
|
||||
break
|
||||
}
|
||||
if subresources == nil {
|
||||
return fmt.Errorf("status subresource applied to version %q not in CRD", version)
|
||||
}
|
||||
subresources.Status = &apiext.CustomResourceSubresourceStatus{}
|
||||
return nil
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category=CRD
|
||||
|
||||
// SubresourceScale enables the "/scale" subresource on a CRD.
|
||||
type SubresourceScale struct {
|
||||
// marker names are leftover legacy cruft
|
||||
|
||||
// SpecPath specifies the jsonpath to the replicas field for the scale's spec.
|
||||
SpecPath string `marker:"specpath"`
|
||||
|
||||
// StatusPath specifies the jsonpath to the replicas field for the scale's status.
|
||||
StatusPath string `marker:"statuspath"`
|
||||
|
||||
// SelectorPath specifies the jsonpath to the pod label selector field for the scale's status.
|
||||
//
|
||||
// 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.
|
||||
SelectorPath *string `marker:"selectorpath"`
|
||||
}
|
||||
|
||||
func (s SubresourceScale) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error {
|
||||
var subresources *apiext.CustomResourceSubresources
|
||||
for i := range crd.Versions {
|
||||
ver := &crd.Versions[i]
|
||||
if ver.Name != version {
|
||||
continue
|
||||
}
|
||||
if ver.Subresources == nil {
|
||||
ver.Subresources = &apiext.CustomResourceSubresources{}
|
||||
}
|
||||
subresources = ver.Subresources
|
||||
break
|
||||
}
|
||||
if subresources == nil {
|
||||
return fmt.Errorf("scale subresource applied to version %q not in CRD", version)
|
||||
}
|
||||
subresources.Scale = &apiext.CustomResourceSubresourceScale{
|
||||
SpecReplicasPath: s.SpecPath,
|
||||
StatusReplicasPath: s.StatusPath,
|
||||
LabelSelectorPath: s.SelectorPath,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category=CRD
|
||||
|
||||
// StorageVersion marks this version as the "storage version" for the CRD for conversion.
|
||||
//
|
||||
// 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.
|
||||
type StorageVersion struct{}
|
||||
|
||||
func (s StorageVersion) 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.Storage = true
|
||||
break
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category=CRD
|
||||
|
||||
// SkipVersion removes the particular version of the CRD from the CRDs spec.
|
||||
//
|
||||
// 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.
|
||||
type SkipVersion struct{}
|
||||
|
||||
func (s SkipVersion) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error {
|
||||
if version == "" {
|
||||
// single-version, this is an invalid state
|
||||
return fmt.Errorf("cannot skip a version if there is only a single version")
|
||||
}
|
||||
var versions []apiext.CustomResourceDefinitionVersion
|
||||
// multi-version
|
||||
for i := range crd.Versions {
|
||||
ver := crd.Versions[i]
|
||||
if ver.Name == version {
|
||||
// skip the skipped version
|
||||
continue
|
||||
}
|
||||
versions = append(versions, ver)
|
||||
}
|
||||
crd.Versions = versions
|
||||
return nil
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category=CRD
|
||||
|
||||
// PrintColumn adds a column to "kubectl get" output for this CRD.
|
||||
type PrintColumn struct {
|
||||
// Name specifies the name of the column.
|
||||
Name string
|
||||
|
||||
// Type indicates the type of the column.
|
||||
//
|
||||
// It may be any OpenAPI data type listed at
|
||||
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types.
|
||||
Type string
|
||||
|
||||
// JSONPath specifies the jsonpath expression used to extract the value of the column.
|
||||
JSONPath string `marker:"JSONPath"` // legacy cruft
|
||||
|
||||
// Description specifies the help/description for this column.
|
||||
Description string `marker:",optional"`
|
||||
|
||||
// Format specifies the format of the column.
|
||||
//
|
||||
// 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.
|
||||
Format string `marker:",optional"`
|
||||
|
||||
// Priority indicates how important it is that this column be displayed.
|
||||
//
|
||||
// Lower priority (*higher* numbered) columns will be hidden if the terminal
|
||||
// width is too small.
|
||||
Priority int32 `marker:",optional"`
|
||||
}
|
||||
|
||||
func (s PrintColumn) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error {
|
||||
var columns *[]apiext.CustomResourceColumnDefinition
|
||||
for i := range crd.Versions {
|
||||
ver := &crd.Versions[i]
|
||||
if ver.Name != version {
|
||||
continue
|
||||
}
|
||||
if ver.Subresources == nil {
|
||||
ver.Subresources = &apiext.CustomResourceSubresources{}
|
||||
}
|
||||
columns = &ver.AdditionalPrinterColumns
|
||||
break
|
||||
}
|
||||
if columns == nil {
|
||||
return fmt.Errorf("printer columns applied to version %q not in CRD", version)
|
||||
}
|
||||
|
||||
*columns = append(*columns, apiext.CustomResourceColumnDefinition{
|
||||
Name: s.Name,
|
||||
Type: s.Type,
|
||||
JSONPath: s.JSONPath,
|
||||
Description: s.Description,
|
||||
Format: s.Format,
|
||||
Priority: s.Priority,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category=CRD
|
||||
|
||||
// Resource configures naming and scope for a CRD.
|
||||
type Resource struct {
|
||||
// Path specifies the plural "resource" for this CRD.
|
||||
//
|
||||
// It generally corresponds to a plural, lower-cased version of the Kind.
|
||||
// See https://book.kubebuilder.io/cronjob-tutorial/gvks.html.
|
||||
Path string `marker:",optional"`
|
||||
|
||||
// ShortName specifies aliases for this CRD.
|
||||
//
|
||||
// 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.
|
||||
ShortName []string `marker:",optional"`
|
||||
|
||||
// Categories specifies which group aliases this resource is part of.
|
||||
//
|
||||
// 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.
|
||||
Categories []string `marker:",optional"`
|
||||
|
||||
// Singular overrides the singular form of your resource.
|
||||
//
|
||||
// The singular form is otherwise defaulted off the plural (path).
|
||||
Singular string `marker:",optional"`
|
||||
|
||||
// Scope overrides the scope of the CRD (Cluster vs Namespaced).
|
||||
//
|
||||
// Scope defaults to "Namespaced". Cluster-scoped ("Cluster") resources
|
||||
// don't exist in namespaces.
|
||||
Scope string `marker:",optional"`
|
||||
}
|
||||
|
||||
func (s Resource) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error {
|
||||
if s.Path != "" {
|
||||
crd.Names.Plural = s.Path
|
||||
}
|
||||
crd.Names.ShortNames = s.ShortName
|
||||
crd.Names.Categories = s.Categories
|
||||
|
||||
switch s.Scope {
|
||||
case "":
|
||||
crd.Scope = apiext.NamespaceScoped
|
||||
default:
|
||||
crd.Scope = apiext.ResourceScope(s.Scope)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NB(directxman12): singular was historically distinct, so we keep it here for backwards compat
|
||||
46
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/doc.go
generated
vendored
Normal file
46
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/doc.go
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2019 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 defines markers for generating schema valiation
|
||||
// and CRD structure.
|
||||
//
|
||||
// All markers related to CRD generation live in AllDefinitions.
|
||||
//
|
||||
// Validation Markers
|
||||
//
|
||||
// Validation markers have values that implement ApplyToSchema
|
||||
// (crd.SchemaMarker). Any marker implementing this will automatically
|
||||
// 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.
|
||||
//
|
||||
// All validation markers start with "+kubebuilder:validation", and
|
||||
// have the same name as their type name.
|
||||
//
|
||||
// CRD Markers
|
||||
//
|
||||
// Markers that modify anything in the CRD itself *except* for the schema
|
||||
// implement ApplyToCRD (crd.CRDMarker). 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.
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
// This package also defines the "+groupName" and "+versionName" package-level
|
||||
// markers, for defining package<->group-version mappings.
|
||||
package markers
|
||||
40
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/package.go
generated
vendored
Normal file
40
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/package.go
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
Copyright 2019 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
|
||||
|
||||
import (
|
||||
"sigs.k8s.io/controller-tools/pkg/markers"
|
||||
)
|
||||
|
||||
func init() {
|
||||
AllDefinitions = append(AllDefinitions,
|
||||
must(markers.MakeDefinition("groupName", markers.DescribesPackage, "")).
|
||||
WithHelp(markers.SimpleHelp("CRD", "specifies the API group name for this package.")),
|
||||
|
||||
must(markers.MakeDefinition("versionName", markers.DescribesPackage, "")).
|
||||
WithHelp(markers.SimpleHelp("CRD", "overrides the API group version for this package (defaults to the package name).")),
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:validation:Optional", markers.DescribesPackage, struct{}{})).
|
||||
WithHelp(markers.SimpleHelp("CRD validation", "specifies that all fields in this package are optional by default.")),
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:validation:Required", markers.DescribesPackage, struct{}{})).
|
||||
WithHelp(markers.SimpleHelp("CRD validation", "specifies that all fields in this package are required by default.")),
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:skip", markers.DescribesPackage, struct{}{})).
|
||||
WithHelp(markers.SimpleHelp("CRD", "don't consider this package as an API version.")),
|
||||
)
|
||||
}
|
||||
83
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/register.go
generated
vendored
Normal file
83
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/register.go
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
Copyright 2019 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
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"sigs.k8s.io/controller-tools/pkg/markers"
|
||||
)
|
||||
|
||||
type definitionWithHelp struct {
|
||||
*markers.Definition
|
||||
Help *markers.DefinitionHelp
|
||||
}
|
||||
|
||||
func (d *definitionWithHelp) WithHelp(help *markers.DefinitionHelp) *definitionWithHelp {
|
||||
d.Help = help
|
||||
return d
|
||||
}
|
||||
|
||||
func (d *definitionWithHelp) Register(reg *markers.Registry) error {
|
||||
if err := reg.Register(d.Definition); err != nil {
|
||||
return err
|
||||
}
|
||||
if d.Help != nil {
|
||||
reg.AddHelp(d.Definition, d.Help)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func must(def *markers.Definition, err error) *definitionWithHelp {
|
||||
return &definitionWithHelp{
|
||||
Definition: markers.Must(def, err),
|
||||
}
|
||||
}
|
||||
|
||||
// AllDefinitions contains all marker definitions for this package.
|
||||
var AllDefinitions []*definitionWithHelp
|
||||
|
||||
type hasHelp interface {
|
||||
Help() *markers.DefinitionHelp
|
||||
}
|
||||
|
||||
// mustMakeAllWithPrefix converts each object into a marker definition using
|
||||
// the object's type's with the prefix to form the marker name.
|
||||
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()
|
||||
def, err := markers.MakeDefinition(name, target, obj)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defs[i] = &definitionWithHelp{Definition: def, Help: obj.(hasHelp).Help()}
|
||||
}
|
||||
|
||||
return defs
|
||||
}
|
||||
|
||||
// Register registers all definitions for CRD generation to the given registry.
|
||||
func Register(reg *markers.Registry) error {
|
||||
for _, def := range AllDefinitions {
|
||||
if err := def.Register(reg); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
350
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/validation.go
generated
vendored
Normal file
350
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/validation.go
generated
vendored
Normal file
@@ -0,0 +1,350 @@
|
||||
/*
|
||||
Copyright 2019 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
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"encoding/json"
|
||||
|
||||
apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"sigs.k8s.io/controller-tools/pkg/markers"
|
||||
)
|
||||
|
||||
// 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.
|
||||
// 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,
|
||||
|
||||
// integer markers
|
||||
|
||||
Maximum(0),
|
||||
Minimum(0),
|
||||
ExclusiveMaximum(false),
|
||||
ExclusiveMinimum(false),
|
||||
MultipleOf(0),
|
||||
|
||||
// string markers
|
||||
|
||||
MaxLength(0),
|
||||
MinLength(0),
|
||||
Pattern(""),
|
||||
|
||||
// slice markers
|
||||
|
||||
MaxItems(0),
|
||||
MinItems(0),
|
||||
UniqueItems(false),
|
||||
|
||||
// general markers
|
||||
|
||||
Enum(nil),
|
||||
Format(""),
|
||||
Type(""),
|
||||
XPreserveUnknownFields{},
|
||||
XEmbeddedResource{},
|
||||
)
|
||||
|
||||
// FieldOnlyMarkers list field-specific validation markers (i.e. those markers that don't make
|
||||
// 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.")),
|
||||
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.")),
|
||||
must(markers.MakeDefinition("optional", markers.DescribesField, struct{}{})).
|
||||
WithHelp(markers.SimpleHelp("CRD validation", "specifies that this field is optional, if fields are required by default.")),
|
||||
|
||||
must(markers.MakeDefinition("nullable", markers.DescribesField, Nullable{})).
|
||||
WithHelp(Nullable{}.Help()),
|
||||
|
||||
must(markers.MakeAnyTypeDefinition("kubebuilder:default", markers.DescribesField, Default{})).
|
||||
WithHelp(Default{}.Help()),
|
||||
|
||||
must(markers.MakeDefinition("kubebuilder:pruning:PreserveUnknownFields", markers.DescribesField, XPreserveUnknownFields{})).
|
||||
WithHelp(XPreserveUnknownFields{}.Help()),
|
||||
must(markers.MakeDefinition("kubebuilder:validation:EmbeddedResource", markers.DescribesField, XEmbeddedResource{})).
|
||||
WithHelp(XEmbeddedResource{}.Help()),
|
||||
}
|
||||
|
||||
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.Target = markers.DescribesType
|
||||
AllDefinitions = append(AllDefinitions, &typDef)
|
||||
}
|
||||
|
||||
AllDefinitions = append(AllDefinitions, FieldOnlyMarkers...)
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// Maximum specifies the maximum numeric value that this field can have.
|
||||
type Maximum int
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// Minimum specifies the minimum numeric value that this field can have.
|
||||
type Minimum int
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// ExclusiveMinimum indicates that the minimum is "up to" but not including that value.
|
||||
type ExclusiveMinimum bool
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// ExclusiveMaximum indicates that the maximum is "up to" but not including that value.
|
||||
type ExclusiveMaximum bool
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// MultipleOf specifies that this field must have a numeric value that's a multiple of this one.
|
||||
type MultipleOf int
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// MaxLength specifies the maximum length for this string.
|
||||
type MaxLength int
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// MinLength specifies the minimum length for this string.
|
||||
type MinLength int
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// Pattern specifies that this string must match the given regular expression.
|
||||
type Pattern string
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// MaxItems specifies the maximum length for this list.
|
||||
type MaxItems int
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// MinItems specifies the minimun length for this list.
|
||||
type MinItems int
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// UniqueItems specifies that all items in this list must be unique.
|
||||
type UniqueItems bool
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// Enum specifies that this (scalar) field is restricted to the *exact* values specified here.
|
||||
type Enum []interface{}
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// Format specifies additional "complex" formatting for this field.
|
||||
//
|
||||
// For example, a date-time field would be marked as "type: string" and
|
||||
// "format: date-time".
|
||||
type Format string
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// Type overrides the type for this field (which defaults to the equivalent of the Go type).
|
||||
//
|
||||
// This generally must be paired with custom serialization. For example, the
|
||||
// metav1.Time field would be marked as "type: string" and "format: date-time".
|
||||
type Type string
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// Nullable marks this field as allowing the "null" value.
|
||||
//
|
||||
// This is often not necessary, but may be helpful with custom serialization.
|
||||
type Nullable struct{}
|
||||
|
||||
// +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. 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 Default struct {
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD processing"
|
||||
// PreserveUnknownFields stops the apiserver from pruning fields which are not specified.
|
||||
//
|
||||
// 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.
|
||||
type XPreserveUnknownFields struct{}
|
||||
|
||||
// +controllertools:marker:generateHelp:category="CRD validation"
|
||||
// EmbeddedResource marks a fields as an embedded resource with apiVersion, kind and metadata fields.
|
||||
//
|
||||
// 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.
|
||||
type XEmbeddedResource struct{}
|
||||
|
||||
func (m Maximum) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "integer" {
|
||||
return fmt.Errorf("must apply maximum to an integer")
|
||||
}
|
||||
val := float64(m)
|
||||
schema.Maximum = &val
|
||||
return nil
|
||||
}
|
||||
func (m Minimum) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "integer" {
|
||||
return fmt.Errorf("must apply minimum to an integer")
|
||||
}
|
||||
val := float64(m)
|
||||
schema.Minimum = &val
|
||||
return nil
|
||||
}
|
||||
func (m ExclusiveMaximum) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "integer" {
|
||||
return fmt.Errorf("must apply exclusivemaximum to an integer")
|
||||
}
|
||||
schema.ExclusiveMaximum = bool(m)
|
||||
return nil
|
||||
}
|
||||
func (m ExclusiveMinimum) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "integer" {
|
||||
return fmt.Errorf("must apply exclusiveminimum to an integer")
|
||||
}
|
||||
schema.ExclusiveMinimum = bool(m)
|
||||
return nil
|
||||
}
|
||||
func (m MultipleOf) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "integer" {
|
||||
return fmt.Errorf("must apply multipleof to an integer")
|
||||
}
|
||||
val := float64(m)
|
||||
schema.MultipleOf = &val
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m MaxLength) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "string" {
|
||||
return fmt.Errorf("must apply maxlength to a string")
|
||||
}
|
||||
val := int64(m)
|
||||
schema.MaxLength = &val
|
||||
return nil
|
||||
}
|
||||
func (m MinLength) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "string" {
|
||||
return fmt.Errorf("must apply minlength to a string")
|
||||
}
|
||||
val := int64(m)
|
||||
schema.MinLength = &val
|
||||
return nil
|
||||
}
|
||||
func (m Pattern) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "string" {
|
||||
return fmt.Errorf("must apply pattern to a string")
|
||||
}
|
||||
schema.Pattern = string(m)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m MaxItems) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "array" {
|
||||
return fmt.Errorf("must apply maxitem to an array")
|
||||
}
|
||||
val := int64(m)
|
||||
schema.MaxItems = &val
|
||||
return nil
|
||||
}
|
||||
func (m MinItems) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "array" {
|
||||
return fmt.Errorf("must apply minitems to an array")
|
||||
}
|
||||
val := int64(m)
|
||||
schema.MinItems = &val
|
||||
return nil
|
||||
}
|
||||
func (m UniqueItems) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
if schema.Type != "array" {
|
||||
return fmt.Errorf("must apply uniqueitems to an array")
|
||||
}
|
||||
schema.UniqueItems = bool(m)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m Enum) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
// TODO(directxman12): this is a bit hacky -- we should
|
||||
// probably support AnyType better + using the schema structure
|
||||
vals := make([]apiext.JSON, len(m))
|
||||
for i, val := range m {
|
||||
// TODO(directxman12): check actual type with schema type?
|
||||
// if we're expecting a string, marshal the string properly...
|
||||
// NB(directxman12): we use json.Marshal to ensure we handle JSON escaping properly
|
||||
valMarshalled, err := json.Marshal(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
vals[i] = apiext.JSON{Raw: valMarshalled}
|
||||
}
|
||||
schema.Enum = vals
|
||||
return nil
|
||||
}
|
||||
func (m Format) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
schema.Format = string(m)
|
||||
return nil
|
||||
}
|
||||
|
||||
// NB(directxman12): we "typecheck" on target schema properties here,
|
||||
// which means the "Type" marker *must* be applied first.
|
||||
// TODO(directxman12): find a less hacky way to do this
|
||||
// (we could preserve ordering of markers, but that feels bad in its own right).
|
||||
|
||||
func (m Type) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
schema.Type = string(m)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m Type) ApplyFirst() {}
|
||||
|
||||
func (m Nullable) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
schema.Nullable = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// Defaults are only valid CRDs created with the v1 API
|
||||
func (m Default) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
marshalledDefault, err := json.Marshal(m.Value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
schema.Default = &apiext.JSON{Raw: marshalledDefault}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m XPreserveUnknownFields) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
defTrue := true
|
||||
schema.XPreserveUnknownFields = &defTrue
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m XEmbeddedResource) ApplyToSchema(schema *apiext.JSONSchemaProps) error {
|
||||
schema.XEmbeddedResource = true
|
||||
return nil
|
||||
}
|
||||
353
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/zz_generated.markerhelp.go
generated
vendored
Normal file
353
vendor/sigs.k8s.io/controller-tools/pkg/crd/markers/zz_generated.markerhelp.go
generated
vendored
Normal file
@@ -0,0 +1,353 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright2019 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.
|
||||
*/
|
||||
|
||||
// Code generated by helpgen. DO NOT EDIT.
|
||||
|
||||
package markers
|
||||
|
||||
import (
|
||||
"sigs.k8s.io/controller-tools/pkg/markers"
|
||||
)
|
||||
|
||||
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.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{
|
||||
"Value": markers.DetailedHelp{
|
||||
Summary: "",
|
||||
Details: "",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (Enum) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies that this (scalar) field is restricted to the *exact* values specified here.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (ExclusiveMaximum) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "indicates that the maximum is \"up to\" but not including that value.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (ExclusiveMinimum) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "indicates that the minimum is \"up to\" but not including that value.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
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\".",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (MaxItems) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies the maximum length for this list.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (MaxLength) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies the maximum length for this string.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (Maximum) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies the maximum numeric value that this field can have.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (MinItems) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies the minimun length for this list.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (MinLength) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies the minimum length for this string.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (Minimum) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies the minimum numeric value that this field can have.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (MultipleOf) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies that this field must have a numeric value that's a multiple of this one.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (Nullable) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
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{},
|
||||
}
|
||||
}
|
||||
|
||||
func (Pattern) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies that this string must match the given regular expression.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (PrintColumn) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "adds a column to \"kubectl get\" output for this CRD.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{
|
||||
"Name": markers.DetailedHelp{
|
||||
Summary: "specifies the name of the column.",
|
||||
Details: "",
|
||||
},
|
||||
"Type": markers.DetailedHelp{
|
||||
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{
|
||||
Summary: "specifies the jsonpath expression used to extract the value of the column.",
|
||||
Details: "",
|
||||
},
|
||||
"Description": markers.DetailedHelp{
|
||||
Summary: "specifies the help/description for this column.",
|
||||
Details: "",
|
||||
},
|
||||
"Format": markers.DetailedHelp{
|
||||
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{
|
||||
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.",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (Resource) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "configures naming and scope for a CRD.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{
|
||||
"Path": markers.DetailedHelp{
|
||||
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{
|
||||
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{
|
||||
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{
|
||||
Summary: "overrides the singular form of your resource. ",
|
||||
Details: "The singular form is otherwise defaulted off the plural (path).",
|
||||
},
|
||||
"Scope": markers.DetailedHelp{
|
||||
Summary: "overrides the scope of the CRD (cluster vs namespaced). ",
|
||||
Details: "Scope defaults to \"namespaced\". Cluster-scoped (\"cluster\") resources don't exist in namespaces.",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
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.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
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.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (SubresourceScale) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "enables the \"/scale\" subresource on a CRD.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{
|
||||
"SpecPath": markers.DetailedHelp{
|
||||
Summary: "specifies the jsonpath to the replicas field for the scale's spec.",
|
||||
Details: "",
|
||||
},
|
||||
"StatusPath": markers.DetailedHelp{
|
||||
Summary: "specifies the jsonpath to the replicas field for the scale's status.",
|
||||
Details: "",
|
||||
},
|
||||
"SelectorPath": markers.DetailedHelp{
|
||||
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.",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (SubresourceStatus) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "enables the \"/status\" subresource on a CRD.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
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\".",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
func (UniqueItems) Help() *markers.DefinitionHelp {
|
||||
return &markers.DefinitionHelp{
|
||||
Category: "CRD validation",
|
||||
DetailedHelp: markers.DetailedHelp{
|
||||
Summary: "specifies that all items in this list must be unique.",
|
||||
Details: "",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
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.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
|
||||
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.",
|
||||
},
|
||||
FieldHelp: map[string]markers.DetailedHelp{},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user