pkg/apis/core: fix code generation

This commit is contained in:
Dr. Stefan Schimanski 2017-10-10 10:25:40 +02:00
parent 33b20f22ee
commit 7e62297b68
6 changed files with 7 additions and 9 deletions

View File

@ -628,7 +628,7 @@ CONVERSION_DIRS := $(shell \
) )
CONVERSION_FILES := $(addsuffix /$(CONVERSION_FILENAME), $(CONVERSION_DIRS)) CONVERSION_FILES := $(addsuffix /$(CONVERSION_FILENAME), $(CONVERSION_DIRS))
CONVERSION_EXTRA_PEER_DIRS := k8s.io/kubernetes/pkg/api,k8s.io/kubernetes/pkg/api/v1,k8s.io/api/core/v1 CONVERSION_EXTRA_PEER_DIRS := k8s.io/kubernetes/pkg/apis/core,k8s.io/kubernetes/pkg/apis/core/v1,k8s.io/api/core/v1
# Shell function for reuse in rules. # Shell function for reuse in rules.
RUN_GEN_CONVERSION = \ RUN_GEN_CONVERSION = \

View File

@ -268,7 +268,7 @@ kube::util::group-version-to-pkg-path() {
case "${group_version}" in case "${group_version}" in
# both group and version are "", this occurs when we generate deep copies for internal objects of the legacy v1 API. # both group and version are "", this occurs when we generate deep copies for internal objects of the legacy v1 API.
__internal) __internal)
echo "pkg/api" echo "pkg/apis/core"
;; ;;
meta/v1) meta/v1)
echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1" echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -63,7 +63,6 @@ ${clientgen} "$@"
${clientgen} --output-base "${KUBE_ROOT}/vendor" --clientset-path="k8s.io/client-go" --clientset-name="kubernetes" --input-base="k8s.io/kubernetes/vendor/k8s.io/api" --input="${GV_DIRS_CSV}" "$@" ${clientgen} --output-base "${KUBE_ROOT}/vendor" --clientset-path="k8s.io/client-go" --clientset-name="kubernetes" --input-base="k8s.io/kubernetes/vendor/k8s.io/api" --input="${GV_DIRS_CSV}" "$@"
listergen_internal_apis=( listergen_internal_apis=(
pkg/api
$( $(
cd ${KUBE_ROOT} cd ${KUBE_ROOT}
find pkg/apis -maxdepth 2 -name types.go | xargs -n1 dirname | sort find pkg/apis -maxdepth 2 -name types.go | xargs -n1 dirname | sort
@ -84,7 +83,6 @@ listergen_external_apis_csv=$(IFS=,; echo "${listergen_external_apis[*]}")
${listergen} --output-base "${KUBE_ROOT}/vendor" --output-package "k8s.io/client-go/listers" --input-dirs "${listergen_external_apis_csv}" "$@" ${listergen} --output-base "${KUBE_ROOT}/vendor" --output-package "k8s.io/client-go/listers" --input-dirs "${listergen_external_apis_csv}" "$@"
informergen_internal_apis=( informergen_internal_apis=(
pkg/api
$( $(
cd ${KUBE_ROOT} cd ${KUBE_ROOT}
find pkg/apis -maxdepth 2 -name types.go | xargs -n1 dirname | sort find pkg/apis -maxdepth 2 -name types.go | xargs -n1 dirname | sort

View File

@ -152,7 +152,7 @@ func parsePathGroupVersion(pgvString string) (gvPath string, gvString string) {
func groupVersionPath(gvPath string, group string, version string) (path string) { func groupVersionPath(gvPath string, group string, version string) (path string) {
// special case for the core group // special case for the core group
if group == "api" { if group == "api" {
path = filepath.Join("../api", version) path = filepath.Join("core", version)
} else { } else {
path = filepath.Join(gvPath, group, version) path = filepath.Join(gvPath, group, version)
} }

View File

@ -70,8 +70,8 @@ func TestGVPackageFlag(t *testing.T) {
{ {
args: []string{"api/v1", "api"}, args: []string{"api/v1", "api"},
expected: map[types.GroupVersion]string{ expected: map[types.GroupVersion]string{
{Group: "api", Version: "v1"}: "../api/v1", {Group: "api", Version: "v1"}: "core/v1",
{Group: "api", Version: ""}: "../api", {Group: "api", Version: ""}: "core",
}, },
expectedGroups: []types.GroupVersions{ expectedGroups: []types.GroupVersions{
{PackageName: "core", Group: types.Group("api"), Versions: []types.Version{types.Version("v1"), types.Version("")}}, {PackageName: "core", Group: types.Group("api"), Versions: []types.Version{types.Version("v1"), types.Version("")}},

View File

@ -19,7 +19,7 @@ package generators
import "k8s.io/gengo/types" import "k8s.io/gengo/types"
var ( var (
apiScheme = types.Name{Package: "k8s.io/kubernetes/pkg/api", Name: "Scheme"} apiScheme = types.Name{Package: "k8s.io/kubernetes/pkg/api/legacyscheme", Name: "Scheme"}
cacheGenericLister = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "GenericLister"} cacheGenericLister = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "GenericLister"}
cacheIndexers = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "Indexers"} cacheIndexers = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "Indexers"}
cacheListWatch = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "ListWatch"} cacheListWatch = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "ListWatch"}
@ -28,7 +28,7 @@ var (
cacheNewGenericLister = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewGenericLister"} cacheNewGenericLister = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewGenericLister"}
cacheNewSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewSharedIndexInformer"} cacheNewSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewSharedIndexInformer"}
cacheSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "SharedIndexInformer"} cacheSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "SharedIndexInformer"}
listOptions = types.Name{Package: "k8s.io/kubernetes/pkg/api", Name: "ListOptions"} listOptions = types.Name{Package: "k8s.io/kubernetes/pkg/apis/core", Name: "ListOptions"}
reflectType = types.Name{Package: "reflect", Name: "Type"} reflectType = types.Name{Package: "reflect", Name: "Type"}
runtimeObject = types.Name{Package: "k8s.io/apimachinery/pkg/runtime", Name: "Object"} runtimeObject = types.Name{Package: "k8s.io/apimachinery/pkg/runtime", Name: "Object"}
schemaGroupResource = types.Name{Package: "k8s.io/apimachinery/pkg/runtime/schema", Name: "GroupResource"} schemaGroupResource = types.Name{Package: "k8s.io/apimachinery/pkg/runtime/schema", Name: "GroupResource"}