Bump sigs.k8s.io/controller-tools from 0.6.2 to 0.11.1 (#5432)
This commit is contained in:
32
vendor/sigs.k8s.io/controller-tools/pkg/crd/spec.go
generated
vendored
32
vendor/sigs.k8s.io/controller-tools/pkg/crd/spec.go
generated
vendored
@@ -5,7 +5,7 @@ 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
|
||||
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,
|
||||
@@ -30,13 +30,21 @@ import (
|
||||
)
|
||||
|
||||
// SpecMarker is a marker that knows how to apply itself to a particular
|
||||
// version in a CRD.
|
||||
// version in a CRD Spec.
|
||||
type SpecMarker interface {
|
||||
// ApplyToCRD applies this marker to the given CRD, in the given version
|
||||
// within that CRD. It's called after everything else in the CRD is populated.
|
||||
ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version string) error
|
||||
}
|
||||
|
||||
// Marker is a marker that knows how to apply itself to a particular
|
||||
// version in a CRD.
|
||||
type Marker interface {
|
||||
// ApplyToCRD applies this marker to the given CRD, in the given version
|
||||
// within that CRD. It's called after everything else in the CRD is populated.
|
||||
ApplyToCRD(crd *apiext.CustomResourceDefinition, version string) error
|
||||
}
|
||||
|
||||
// NeedCRDFor requests the full CRD for the given group-kind. It requires
|
||||
// that the packages containing the Go structs for that CRD have already
|
||||
// been loaded with NeedPackage.
|
||||
@@ -109,12 +117,14 @@ func (p *Parser) NeedCRDFor(groupKind schema.GroupKind, maxDescLen *int) {
|
||||
|
||||
for _, markerVals := range typeInfo.Markers {
|
||||
for _, val := range markerVals {
|
||||
crdMarker, isCrdMarker := val.(SpecMarker)
|
||||
if !isCrdMarker {
|
||||
continue
|
||||
}
|
||||
if err := crdMarker.ApplyToCRD(&crd.Spec, ver); err != nil {
|
||||
pkg.AddError(loader.ErrFromNode(err /* an okay guess */, typeInfo.RawSpec))
|
||||
if specMarker, isSpecMarker := val.(SpecMarker); isSpecMarker {
|
||||
if err := specMarker.ApplyToCRD(&crd.Spec, ver); err != nil {
|
||||
pkg.AddError(loader.ErrFromNode(err /* an okay guess */, typeInfo.RawSpec))
|
||||
}
|
||||
} else if crdMarker, isCRDMarker := val.(Marker); isCRDMarker {
|
||||
if err := crdMarker.ApplyToCRD(&crd, ver); err != nil {
|
||||
pkg.AddError(loader.ErrFromNode(err /* an okay guess */, typeInfo.RawSpec))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,11 +174,5 @@ func (p *Parser) NeedCRDFor(groupKind schema.GroupKind, maxDescLen *int) {
|
||||
packages[0].AddError(fmt.Errorf("CRD for %s with version(s) %v does not serve any version", groupKind, crd.Spec.Versions))
|
||||
}
|
||||
|
||||
// NB(directxman12): CRD's status doesn't have omitempty markers, which means things
|
||||
// get serialized as null, which causes the validator to freak out. Manually set
|
||||
// these to empty till we get a better solution.
|
||||
crd.Status.Conditions = []apiext.CustomResourceDefinitionCondition{}
|
||||
crd.Status.StoredVersions = []string{}
|
||||
|
||||
p.CustomResourceDefinitions[groupKind] = crd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user