mirror of https://github.com/k3s-io/k3s
Merge pull request #46556 from mbohlool/gvk
Automatic merge from submit-queue (batch tested with PRs 46076, 43879, 44897, 46556, 46654) Use meta.v1 GroupVersionKind with json tags to generate OpenAPI spec We are using two different GVK struct in generation of OpenAPI extensions. This PR unify that and also add json tags to meta.v1 GVK to comply with json naming system in other serializations. Also the value of Action extension is now lowercase. ref: https://github.com/kubernetes/kubernetes/pull/46388pull/6/head
commit
e97b72296f
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -370,15 +370,15 @@ func (o *Resources) getGroupVersionKind(s spec.Schema) (schema.GroupVersionKind,
|
|||
if !ok {
|
||||
return empty, fmt.Errorf("%s extension has unexpected type %T in %s", groupVersionKindExtensionKey, gvk, s.Extensions)
|
||||
}
|
||||
group, ok := gvkMap["Group"].(string)
|
||||
group, ok := gvkMap["group"].(string)
|
||||
if !ok {
|
||||
return empty, fmt.Errorf("%s extension missing Group: %v", groupVersionKindExtensionKey, gvkMap)
|
||||
}
|
||||
version, ok := gvkMap["Version"].(string)
|
||||
version, ok := gvkMap["version"].(string)
|
||||
if !ok {
|
||||
return empty, fmt.Errorf("%s extension missing Version: %v", groupVersionKindExtensionKey, gvkMap)
|
||||
}
|
||||
kind, ok := gvkMap["Kind"].(string)
|
||||
kind, ok := gvkMap["kind"].(string)
|
||||
if !ok {
|
||||
return empty, fmt.Errorf("%s extension missing Kind: %v", groupVersionKindExtensionKey, gvkMap)
|
||||
}
|
||||
|
|
|
@ -75,9 +75,9 @@ func (gk *GroupKind) String() string {
|
|||
//
|
||||
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
||||
type GroupVersionKind struct {
|
||||
Group string `protobuf:"bytes,1,opt,name=group"`
|
||||
Version string `protobuf:"bytes,2,opt,name=version"`
|
||||
Kind string `protobuf:"bytes,3,opt,name=kind"`
|
||||
Group string `json:"group" protobuf:"bytes,1,opt,name=group"`
|
||||
Version string `json:"version" protobuf:"bytes,2,opt,name=version"`
|
||||
Kind string `json:"kind" protobuf:"bytes,3,opt,name=kind"`
|
||||
}
|
||||
|
||||
func (gvk GroupVersionKind) String() string {
|
||||
|
|
|
@ -800,8 +800,12 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||
return nil, fmt.Errorf("unrecognized action verb: %s", action.Verb)
|
||||
}
|
||||
for _, route := range routes {
|
||||
route.Metadata(ROUTE_META_GVK, reqScope.Kind)
|
||||
route.Metadata(ROUTE_META_ACTION, action.Verb)
|
||||
route.Metadata(ROUTE_META_GVK, metav1.GroupVersionKind{
|
||||
Group: reqScope.Kind.Group,
|
||||
Version: reqScope.Kind.Version,
|
||||
Kind: reqScope.Kind.Kind,
|
||||
})
|
||||
route.Metadata(ROUTE_META_ACTION, strings.ToLower(action.Verb))
|
||||
ws.Route(route)
|
||||
}
|
||||
// Note: update GetAuthorizerAttributes() when adding a custom handler.
|
||||
|
|
Loading…
Reference in New Issue