Skip to content

Commit

Permalink
api: OpenAPI support (kubeflow#577)
Browse files Browse the repository at this point in the history
* hack: Add openapi-gen

Signed-off-by: Ce Gao <gaoce@caicloud.io>

* api: Generate openapi model

Signed-off-by: Ce Gao <gaoce@caicloud.io>

* linter_config: Add

Signed-off-by: Ce Gao <gaoce@caicloud.io>

* openapi: Add k8s.io

Signed-off-by: Ce Gao <gaoce@caicloud.io>

* .travis: Ignore openapi

Signed-off-by: Ce Gao <gaoce@caicloud.io>

* dep: Update

Signed-off-by: Ce Gao <gaoce@caicloud.io>
  • Loading branch information
gaocegege authored and Penghui Yan committed Jun 18, 2018
1 parent 2c3ff66 commit a0b269d
Show file tree
Hide file tree
Showing 19 changed files with 9,594 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ script:
# For now though we just run all tests in pkg.
# And we can not use ** because goveralls uses filepath.Match
# to match ignore files and it does not support it.
- goveralls -service=travis-ci -v -package ./pkg/... -ignore "pkg/client/*/*.go,pkg/client/*/*/*.go,pkg/client/*/*/*/*.go,pkg/client/*/*/*/*/*.go,pkg/client/*/*/*/*/*/*.go,pkg/client/*/*/*/*/*/*/*.go,pkg/apis/tensorflow/*/zz_generated.*.go"
- goveralls -service=travis-ci -v -package ./pkg/... -ignore "pkg/client/*/*.go,pkg/client/*/*/*.go,pkg/client/*/*/*/*.go,pkg/client/*/*/*/*/*.go,pkg/client/*/*/*/*/*/*.go,pkg/client/*/*/*/*/*/*/*.go,pkg/apis/tensorflow/*/zz_generated.*.go,pkg/apis/tensorflow/*/*_generated.go"

notifications:
webhooks: https://www.travisbuddy.com/
Expand Down
10 changes: 5 additions & 5 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ required = [
"k8s.io/code-generator/cmd/lister-gen",
"k8s.io/code-generator/cmd/deepcopy-gen",
"k8s.io/code-generator/cmd/defaulter-gen",
"k8s.io/code-generator/cmd/openapi-gen",

# needed by generated clientsets, but not an explicit dep in client-gen itself
"k8s.io/apimachinery/pkg/apimachinery/registered",
Expand All @@ -19,17 +20,21 @@ required = [
name = "k8s.io/client-go"
version = "~6.0.0"

[[constraint]]
name = "k8s.io/kube-openapi"
branch = "release-1.9"

[[constraint]]
name = "k8s.io/kubernetes"
version = "~v1.9.0"

[[constraint]]
branch = "release-1.9"
name = "k8s.io/api"
branch = "release-1.9"

[[constraint]]
branch = "release-1.9"
name = "k8s.io/apimachinery"
branch = "release-1.9"

[[constraint]]
name = "k8s.io/code-generator"
Expand Down
4 changes: 4 additions & 0 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ ${GOPATH}/bin/defaulter-gen --input-dirs github.com/kubeflow/tf-operator/pkg/ap
echo "Generating defaulters for v1alpha2"
${GOPATH}/bin/defaulter-gen --input-dirs github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1alpha2 -O zz_generated.defaults --go-header-file hack/boilerplate/boilerplate.go.txt "$@"
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 "$@"
cd - > /dev/null
1 change: 1 addition & 0 deletions linter_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"pkg/apis/tensorflow/validation/validation_test.go",
"pkg/apis/tensorflow/v1alpha2/zz_generated.deepcopy.go",
"pkg/apis/tensorflow/v1alpha2/zz_generated.defaults.go",
"pkg/apis/tensorflow/v1alpha2/openapi_generated.go",
"pkg/controller.v2/controller_utils.go"
],
"Deadline": "300s",
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/tensorflow/v1alpha2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

// +k8s:deepcopy-gen=package,register
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true

// Package v1alpha2 is the v1alpha2 version of the API.
// +groupName=kubeflow.org
Expand Down
Loading

0 comments on commit a0b269d

Please sign in to comment.