update generation scripts to share API group version constants
This commit is contained in:
@@ -44,6 +44,31 @@ source "${KUBE_ROOT}/hack/lib/etcd.sh"
|
||||
|
||||
KUBE_OUTPUT_HOSTBIN="${KUBE_OUTPUT_BINPATH}/$(kube::util::host_platform)"
|
||||
|
||||
# list of all available group versions. This should be used when generated code
|
||||
# or when starting an API server that you want to have everything.
|
||||
# most preferred version for a group should appear first
|
||||
KUBE_AVAILABLE_GROUP_VERSIONS="${KUBE_AVAILABLE_GROUP_VERSIONS:-\
|
||||
v1 \
|
||||
apps/v1alpha1 \
|
||||
authentication.k8s.io/v1beta1 \
|
||||
authorization.k8s.io/v1beta1 \
|
||||
autoscaling/v1 \
|
||||
batch/v1 \
|
||||
batch/v2alpha1 \
|
||||
certificates.k8s.io/v1alpha1 \
|
||||
extensions/v1beta1 \
|
||||
imagepolicy.k8s.io/v1alpha1 \
|
||||
policy/v1alpha1 \
|
||||
rbac.authorization.k8s.io/v1alpha1 \
|
||||
storage.k8s.io/v1beta1\
|
||||
}"
|
||||
|
||||
# not all group versions are exposed by the server. This list contains those
|
||||
# which are not available so we don't generate clients or swagger for them
|
||||
KUBE_NONSERVER_GROUP_VERSIONS="
|
||||
imagepolicy.k8s.io/v1alpha1
|
||||
"
|
||||
|
||||
# This emulates "readlink -f" which is not available on MacOS X.
|
||||
# Test:
|
||||
# T=/tmp/$$.$RANDOM
|
||||
|
@@ -312,10 +312,10 @@ kube::util::group-version-to-pkg-path() {
|
||||
echo "api/unversioned"
|
||||
;;
|
||||
*.k8s.io)
|
||||
echo "apis/${group_version%.k8s.io}"
|
||||
echo "apis/${group_version%.*k8s.io}"
|
||||
;;
|
||||
*.k8s.io/*)
|
||||
echo "apis/${group_version/.k8s.io/}"
|
||||
echo "apis/${group_version/.*k8s.io/}"
|
||||
;;
|
||||
*)
|
||||
echo "apis/${group_version%__internal}"
|
||||
@@ -347,6 +347,9 @@ kube::util::gv-to-swagger-name() {
|
||||
# VERSIONS: Array of group versions to include in swagger spec.
|
||||
kube::util::fetch-swagger-spec() {
|
||||
for ver in ${VERSIONS}; do
|
||||
if [[ " ${KUBE_NONSERVER_GROUP_VERSIONS} " == *" ${ver} "* ]]; then
|
||||
continue
|
||||
fi
|
||||
# fetch the swagger spec for each group version.
|
||||
if [[ ${ver} == "v1" ]]; then
|
||||
SUBPATH="api"
|
||||
|
Reference in New Issue
Block a user