-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate api information in OpenAPI model and register types to scheme (
#733) * Add a function to register api group and add type to scheme Signed-off-by: JetMuffin <mofeng.cj@alibaba-inc.com> * apply goimports -w to install.go Signed-off-by: JetMuffin <mofeng.cj@alibaba-inc.com> * generate api information inf openapi model. Signed-off-by: JetMuffin <mofeng.cj@alibaba-inc.com>
- Loading branch information
1 parent
bb60bfa
commit 9e396a4
Showing
3 changed files
with
9,527 additions
and
6,979 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package v1alpha2 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/apimachinery/announced" | ||
"k8s.io/apimachinery/pkg/apimachinery/registered" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/util/sets" | ||
) | ||
|
||
// Install registers the API group and adds type to a schema | ||
func Install(groupFactoryRegister announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) error { | ||
return announced.NewGroupMetaFactory( | ||
&announced.GroupMetaFactoryArgs{ | ||
GroupName: GroupName, | ||
RootScopedKinds: sets.NewString(), | ||
VersionPreferenceOrder: []string{SchemeGroupVersion.Version}, | ||
}, | ||
announced.VersionToSchemeFunc{ | ||
SchemeGroupVersion.Version: AddToScheme, | ||
}, | ||
).Announce(groupFactoryRegister).RegisterAndEnable(registry, scheme) | ||
} |
Oops, something went wrong.