update vendor

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

View File

@@ -84,6 +84,9 @@ type Generator struct {
// n indicates limit the description to at most n characters and truncate the description to
// closest sentence boundary if it exceeds n characters.
MaxDescLen *int `marker:",optional"`
// GenerateEmbeddedObjectMeta specifies if any embedded ObjectMeta in the CRD should be generated
GenerateEmbeddedObjectMeta *bool `marker:",optional"`
}
var _ genall.Generator = &Generator{}
@@ -100,6 +103,8 @@ func (g Generator) Generate(ctx *genall.GenerationContext) (result error) {
parser := &crdgen.Parser{
Collector: ctx.Collector,
Checker: ctx.Checker,
// Indicates the parser on whether to register the ObjectMeta type or not
GenerateEmbeddedObjectMeta: g.GenerateEmbeddedObjectMeta != nil && *g.GenerateEmbeddedObjectMeta == true,
}
crdgen.AddKnownTypes(parser)
@@ -142,6 +147,12 @@ func (g Generator) Generate(ctx *genall.GenerationContext) (result error) {
fullSchema = *fullSchema.DeepCopy()
crdgen.TruncateDescription(&fullSchema, *g.MaxDescLen)
}
// Fix top level ObjectMeta regardless of the settings.
if _, ok := fullSchema.Properties["metadata"]; ok {
fullSchema.Properties["metadata"] = apiext.JSONSchemaProps{Type: "object"}
}
existingSet.NewSchemata[gv.Version] = fullSchema
}
}
@@ -434,7 +445,7 @@ func crdsFromDirectory(ctx *genall.GenerationContext, dir string) (map[schema.Gr
groupKind := schema.GroupKind{Group: actualCRD.Spec.Group, Kind: actualCRD.Spec.Names.Kind}
var versions map[string]struct{}
if len(actualCRD.Spec.Versions) == 0 {
versions = map[string]struct{}{actualCRD.Spec.Version: struct{}{}}
versions = map[string]struct{}{actualCRD.Spec.Version: {}}
} else {
versions = make(map[string]struct{}, len(actualCRD.Spec.Versions))
for _, ver := range actualCRD.Spec.Versions {