Skip to content

Commit

Permalink
Generate api information in OpenAPI model and register types to scheme (
Browse files Browse the repository at this point in the history
#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
jetmuffin authored and k8s-ci-robot committed Jul 17, 2018
1 parent bb60bfa commit 9e396a4
Show file tree
Hide file tree
Showing 3 changed files with 9,527 additions and 6,979 deletions.
2 changes: 1 addition & 1 deletion hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ ${GOPATH}/bin/defaulter-gen --input-dirs github.com/kubeflow/tf-operator/pkg/ap
cd - > /dev/null

echo "Generating OpenAPI specification for v1alpha2"
${GOPATH}/bin/openapi-gen --input-dirs github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1alpha2,k8s.io/api/core/v1 --output-package github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1alpha2 --go-header-file hack/boilerplate/boilerplate.go.txt "$@"
${GOPATH}/bin/openapi-gen --input-dirs github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1alpha2,k8s.io/api/core/v1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/api/resource,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/util/intstr,k8s.io/apimachinery/pkg/version --output-package github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1alpha2 --go-header-file hack/boilerplate/boilerplate.go.txt "$@"
cd - > /dev/null
22 changes: 22 additions & 0 deletions pkg/apis/tensorflow/v1alpha2/install.go
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)
}
Loading

0 comments on commit 9e396a4

Please sign in to comment.