Merge pull request #54336 from marun/openapi-vendorable-build

Automatic merge from submit-queue (batch tested with PRs 54336, 54470, 54334, 54175). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Update openapi bazel build to support vendored build

This is one part (see #54335) of enabling vendoring projects like federation to generate openapi code for k8s.io/kubernetes.

edit: These changes are necessary for a project to correctly generate ``vendor/k8s.io/kubernetes/pkg/generated/openapi/zz_generated.openapi.go`` for vendored ``k8s.io/kubernetes``.  Without the changes, the vendored output location for ``zz_generated.openapi.go`` would be ``k8s.io/kubernetes`` instead of ``vendor/k8s.io/kubernetes`` and the input files would similarly be from ``k8s.io/kubernetes`` instead of ``k8s.io/myproject``.

/sig testing
/release-note-none
This commit is contained in:
Kubernetes Submit Queue
2017-10-25 15:16:05 -07:00
committed by GitHub
3 changed files with 18 additions and 6 deletions

9
build/openapi.bzl Normal file
View File

@@ -0,0 +1,9 @@
# 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 = ""