Change:
As part of moving federation out of tree (), the federation build will need to generate ` for itself and vendored kubernetes. The following steps are required: [x] Discover targets for generation () [x] Update the file's bazel rules to configurably enable a build for vendored kube () [x] Support generation of the file to a vendored path () [x] Update kubernetes to use latest kazel and kube-openapi () /sig multicluster testing /area federation /assign cc:
/cc
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. Prevent issues from auto-closing with an comment. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle stale

Discussion:
<ins> # A project wanting to generate openapi code for vendored # k8s.io/kubernetes will need to set the following variables in # //build/openapi.bzl in their project and customize the go prefix: # # openapi_go_prefix = "k8s.io/myproject/" # openapi_vendor_prefix = "vendor/k8s.io/kubernetes/" openapi_go_prefix = "k8s.io/kubernetes/" openapi_vendor_prefix = "" </ins>

package(default_visibility = ["//visibility:public"]) load("//pkg/generated/openapi:def.bzl", "openapi_library") <ins> load("//build:openapi.bzl", "openapi_go_prefix", "openapi_vendor_prefix") </ins> openapi_library( name = "go_default_library", srcs = ["doc.go"], <ins> go_prefix = openapi_go_prefix, </ins> openapi_targets = [ "federation/apis/federation/v1beta1", "pkg/apis/abac/v0",

"pkg/version", ], tags = ["automanaged"], <ins> vendor_prefix = openapi_vendor_prefix, </ins> vendor_targets = [ "k8s.io/api/admission/v1alpha1", "k8s.io/api/admissionregistration/v1alpha1",

load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_kubernetes_build//defs:go.bzl", "go_genrule") <del> def openapi_library(name, tags, srcs, openapi_targets=[], vendor_targets=[]): </del> <ins> def openapi_library(name, tags, srcs, go_prefix, vendor_prefix="", openapi_targets=[], vendor_targets=[]): </ins> deps = [ "//vendor/github.com/go-openapi/spec:go_default_library", "//vendor/k8s.io/kube-openapi/pkg/common:go_default_library",

) go_genrule( name = "zz_generated.openapi", <del> srcs = srcs + ["//hack/boilerplate:boilerplate.go.txt"], </del> <ins> srcs = srcs + ["//" + vendor_prefix + "hack/boilerplate:boilerplate.go.txt"], </ins> outs = ["zz_generated.openapi.go"], cmd = " ".join([ "$(location //vendor/k8s.io/code-generator/cmd/openapi-gen)", "--v 1", "--logtostderr", <del> "--go-header-file $(location //hack/boilerplate:boilerplate.go.txt)", </del> <ins> "--go-header-file $(location //" + vendor_prefix + "hack/boilerplate:boilerplate.go.txt)", </ins> "--output-file-base zz_generated.openapi", <del> "--output-package k8s.io/kubernetes/pkg/generated/openapi", "--input-dirs " + ",".join(["k8s.io/kubernetes/" + target for target in openapi_targets] + ["k8s.io/kubernetes/vendor/" + target for target in vendor_targets]), "&& cp pkg/generated/openapi/zz_generated.openapi.go $(location :zz_generated.openapi.go)", </del> <ins> "--output-package " + go_prefix + vendor_prefix + "pkg/generated/openapi", "--input-dirs " + ",".join([go_prefix + target for target in openapi_targets] + [go_prefix + "vendor/" + target for target in vendor_targets]), "&& cp " + vendor_prefix + "pkg/generated/openapi/zz_generated.openapi.go $(location :zz_generated.openapi.go)", </ins> ]), go_deps = deps, tools = ["//vendor/k8s.io/code-generator/cmd/openapi-gen"],