-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add clientset/lister/informer generation #1194
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 The Kubeflow Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
if [[ -z "${GOPATH:-}" ]]; then | ||
export GOPATH=$(go env GOPATH) | ||
fi | ||
|
||
VERSION_LIST=(v1alpha3 v1beta1) | ||
PROJECT_ROOT=${GOPATH}/src/github.com/kubeflow/katib | ||
|
||
modules=(experiments suggestions trials common) | ||
versions=(v1alpha3 v1beta1) | ||
versionStr=$(printf ",%s" "${versions[@]}") | ||
GROUP_VERSIONS=$(printf "%s:${versionStr:1} " "${modules[@]}") | ||
|
||
echo "Generating clients for ${GROUP_VERSIONS} ..." | ||
${PROJECT_ROOT}/vendor/k8s.io/code-generator/generate-groups.sh \ | ||
all \ | ||
github.com/kubeflow/katib/pkg/client/controller \ | ||
github.com/kubeflow/katib/pkg/apis/controller \ | ||
"${GROUP_VERSIONS}" \ | ||
--go-header-file ${PROJECT_ROOT}/hack/boilerplate.go.txt | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,40 +19,24 @@ set -o nounset | |
set -o pipefail | ||
|
||
if [[ -z "${GOPATH:-}" ]]; then | ||
export GOPATH=$(go env GOPATH) | ||
export GOPATH=$(go env GOPATH) | ||
fi | ||
|
||
PROJECT_ROOT=$(pwd) | ||
CODEGEN_PKG=$(pwd)/vendor/k8s.io/code-generator | ||
|
||
KATIB_VERSION_V1ALPHA3="v1alpha3" | ||
SWAGGER_CODEGEN_FILE_V1ALPHA3="pkg/apis/v1alpha3/swagger.json" | ||
|
||
KATIB_VERSION_V1BETA1="v1beta1" | ||
SWAGGER_CODEGEN_FILE_V1BETA1="pkg/apis/v1beta1/swagger.json" | ||
|
||
PROJECT_ROOT=${GOPATH}/src/github.com/kubeflow/katib | ||
CODEGEN_PKG=${PROJECT_ROOT}/vendor/k8s.io/code-generator | ||
VERSION_LIST=(v1alpha3 v1beta1) | ||
SWAGGER_VERSION="0.1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For each Katib version Swagger Version will be v0.1, is that fine? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any suggestion? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @andreyvelich I've refined the schema of swagger version, which became There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @sperlingxx, SGTM. |
||
|
||
# OpenAPI for v1alpha3 Katib version | ||
echo "Generating OpenAPI specification for v1alpha3..." | ||
go run ${CODEGEN_PKG}/cmd/openapi-gen/main.go \ | ||
--go-header-file ${PROJECT_ROOT}/hack/boilerplate.go.txt \ | ||
--input-dirs github.com/kubeflow/katib/pkg/apis/controller/common/${KATIB_VERSION_V1ALPHA3},github.com/kubeflow/katib/pkg/apis/controller/experiments/${KATIB_VERSION_V1ALPHA3},github.com/kubeflow/katib/pkg/apis/controller/suggestions/${KATIB_VERSION_V1ALPHA3},github.com/kubeflow/katib/pkg/apis/controller/trials/${KATIB_VERSION_V1ALPHA3} \ | ||
--output-package github.com/kubeflow/katib/pkg/apis/${KATIB_VERSION_V1ALPHA3} \ | ||
$@ | ||
|
||
# Swagger file for v1alpha3 Katib version | ||
echo "Generating Swagger file for v1alpha3..." | ||
go run hack/swagger/main.go ${SWAGGER_VERSION} ${KATIB_VERSION_V1ALPHA3} >${SWAGGER_CODEGEN_FILE_V1ALPHA3} | ||
for VERSION in ${VERSION_LIST[@]}; do | ||
SWAGGER_CODEGEN_FILE=${PROJECT_ROOT}/pkg/apis/${VERSION}/swagger.json | ||
|
||
# OpenAPI for v1beta1 Katib version | ||
echo "Generating OpenAPI specification for v1beta1..." | ||
go run ${CODEGEN_PKG}/cmd/openapi-gen/main.go \ | ||
--go-header-file ${PROJECT_ROOT}/hack/boilerplate.go.txt \ | ||
--input-dirs github.com/kubeflow/katib/pkg/apis/controller/common/${KATIB_VERSION_V1BETA1},github.com/kubeflow/katib/pkg/apis/controller/experiments/${KATIB_VERSION_V1BETA1},github.com/kubeflow/katib/pkg/apis/controller/suggestions/${KATIB_VERSION_V1BETA1},github.com/kubeflow/katib/pkg/apis/controller/trials/${KATIB_VERSION_V1BETA1} \ | ||
--output-package github.com/kubeflow/katib/pkg/apis/${KATIB_VERSION_V1BETA1} \ | ||
$@ | ||
echo "Generating OpenAPI specification for ${VERSION} ..." | ||
go run ${CODEGEN_PKG}/cmd/openapi-gen/main.go \ | ||
--go-header-file ${PROJECT_ROOT}/hack/boilerplate.go.txt \ | ||
--input-dirs github.com/kubeflow/katib/pkg/apis/controller/common/${VERSION},github.com/kubeflow/katib/pkg/apis/controller/experiments/${VERSION},github.com/kubeflow/katib/pkg/apis/controller/suggestions/${VERSION},github.com/kubeflow/katib/pkg/apis/controller/trials/${VERSION} \ | ||
--output-package github.com/kubeflow/katib/pkg/apis/${VERSION} \ | ||
$@ | ||
|
||
# Swagger file for v1beta1 Katib version | ||
echo "Generating Swagger file for v1beta1..." | ||
go run hack/swagger/main.go ${SWAGGER_VERSION} ${KATIB_VERSION_V1BETA1} >${SWAGGER_CODEGEN_FILE_V1BETA1} | ||
echo "Generating swagger file for ${VERSION} ..." | ||
go run ${PROJECT_ROOT}/hack/swagger/main.go ${SWAGGER_VERSION} ${VERSION} > ${SWAGGER_CODEGEN_FILE} | ||
done |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -666,8 +666,7 @@ | |
"type": "string" | ||
}, | ||
"value": { | ||
"type": "number", | ||
"format": "double" | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need
boilerplate.go.txt
file in /hack folder for header?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andreyvelich Maybe we can change it to kubeflow specialized header ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be specific to Kubeflow licence, like here: https://github.com/kubeflow/katib/blob/master/hack/verify-gofmt.sh#L2-L14 ?