diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 9940676e596..6dd66eb20fe 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -472,7 +472,7 @@ function k8s_tag_files_except() { function codegen::openapi() { # Build the tool. GOPROXY=off go install \ - k8s.io/code-generator/cmd/openapi-gen + k8s.io/kube-openapi/cmd/openapi-gen # The result file, in each pkg, of open-api generation. local output_file="${GENERATED_FILE_PREFIX}openapi.go" diff --git a/staging/src/k8s.io/code-generator/cmd/openapi-gen/main.go b/staging/src/k8s.io/code-generator/cmd/openapi-gen/main.go deleted file mode 100644 index b466019ad68..00000000000 --- a/staging/src/k8s.io/code-generator/cmd/openapi-gen/main.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2018 The Kubernetes 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. -*/ - -// This package generates openAPI definition file to be used in open API spec generation on API servers. To generate -// definition for a specific type or package add "+k8s:openapi-gen=true" tag to the type/package comment lines. To -// exclude a type from a tagged package, add "+k8s:openapi-gen=false" tag to the type comment lines. - -package main - -import ( - "flag" - "log" - - "github.com/spf13/pflag" - "k8s.io/gengo/v2" - "k8s.io/gengo/v2/generator" - "k8s.io/klog/v2" - "k8s.io/kube-openapi/cmd/openapi-gen/args" - "k8s.io/kube-openapi/pkg/generators" -) - -func main() { - klog.InitFlags(nil) - args := args.New() - - args.AddFlags(pflag.CommandLine) - flag.Set("logtostderr", "true") - pflag.CommandLine.AddGoFlagSet(flag.CommandLine) - pflag.Parse() - - if err := args.Validate(); err != nil { - log.Fatalf("Arguments validation error: %v", err) - } - - myTargets := func(context *generator.Context) []generator.Target { - return generators.GetTargets(context, args) - } - - // Generates the code for the OpenAPIDefinitions. - if err := gengo.Execute( - generators.NameSystems(), - generators.DefaultNameSystem(), - myTargets, - gengo.StdBuildTag, - pflag.Args(), - ); err != nil { - log.Fatalf("OpenAPI code generation error: %v", err) - } -} diff --git a/staging/src/k8s.io/code-generator/kube_codegen.sh b/staging/src/k8s.io/code-generator/kube_codegen.sh index cc6f0573beb..1f3f83abadd 100755 --- a/staging/src/k8s.io/code-generator/kube_codegen.sh +++ b/staging/src/k8s.io/code-generator/kube_codegen.sh @@ -327,7 +327,7 @@ function kube::codegen::gen_openapi() { openapi-gen ) # shellcheck disable=2046 # printf word-splitting is intentional - GO111MODULE=on go install $(printf "k8s.io/code-generator/cmd/%s " "${BINS[@]}") + GO111MODULE=on go install $(printf "k8s.io/kube-openapi/cmd/%s " "${BINS[@]}") ) # Go installs in $GOBIN if defined, and $GOPATH/bin otherwise gobin="${GOBIN:-$(go env GOPATH)/bin}" diff --git a/staging/src/k8s.io/code-generator/tools.go b/staging/src/k8s.io/code-generator/tools.go index 6893f6ff190..d0e2c7764f2 100644 --- a/staging/src/k8s.io/code-generator/tools.go +++ b/staging/src/k8s.io/code-generator/tools.go @@ -30,6 +30,5 @@ import ( _ "k8s.io/code-generator/cmd/go-to-protobuf" _ "k8s.io/code-generator/cmd/informer-gen" _ "k8s.io/code-generator/cmd/lister-gen" - _ "k8s.io/code-generator/cmd/openapi-gen" _ "k8s.io/code-generator/cmd/register-gen" )