Drop non-preferred version and version in the schema id

This commit is contained in:
Darren Shepherd
2020-03-10 23:12:04 -07:00
parent 39ae8e9c14
commit 0ad6c2aba1
16 changed files with 292 additions and 49 deletions

View File

@@ -149,15 +149,26 @@ func (h *handler) refreshAll() error {
}
filteredSchemas := map[string]*types.APISchema{}
for id, schema := range schemas {
for _, schema := range schemas {
if isListWatchable(schema) {
if attributes.PreferredGroup(schema) != "" ||
attributes.PreferredVersion(schema) != "" {
continue
}
if ok, err := h.allowed(schema); err != nil {
return err
} else if !ok {
continue
}
}
filteredSchemas[id] = schema
gvk := attributes.GVK(schema)
if gvk.Kind != "" {
gvr := attributes.GVR(schema)
schema.ID = converter.GVKToSchemaID(gvk)
schema.PluralName = converter.GVRToPluralName(gvr)
}
filteredSchemas[schema.ID] = schema
}
if err := h.getColumns(h.ctx, filteredSchemas); err != nil {