Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0a853fec
Commit
0a853fec
authored
Jun 10, 2017
by
Chao Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hack/lib/init.sh util.sh update-codegen.sh
parent
e74c17a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
15 deletions
+52
-15
util.sh
hack/lib/util.sh
+20
-3
update-codegen.sh
hack/update-codegen.sh
+32
-12
No files found.
hack/lib/util.sh
View file @
0a853fec
...
@@ -313,7 +313,27 @@ kube::util::analytics-link() {
...
@@ -313,7 +313,27 @@ kube::util::analytics-link() {
# * Special handling for groups suffixed with ".k8s.io": foo.k8s.io/v1 -> apis/foo/v1
# * Special handling for groups suffixed with ".k8s.io": foo.k8s.io/v1 -> apis/foo/v1
# * Very special handling for when both group and version are "": / -> api
# * Very special handling for when both group and version are "": / -> api
kube::util::group-version-to-pkg-path
()
{
kube::util::group-version-to-pkg-path
()
{
staging_apis
=(
$(
pushd
${
KUBE_ROOT
}
/staging/src/k8s.io/api
>
/dev/null
find
.
-name
types.go | xargs
-n1
dirname
|
sed
"s|
\.
/||g"
|
sort
popd
>
/dev/null
)
)
local
group_version
=
"
$1
"
local
group_version
=
"
$1
"
if
[[
"
${
staging_apis
[@]
}
"
=
~
"
${
group_version
/.*k8s.io/
}
"
]]
;
then
echo
"vendor/k8s.io/api/
${
group_version
/.*k8s.io/
}
"
return
fi
# "v1" is the API GroupVersion
if
[[
"
${
group_version
}
"
==
"v1"
]]
;
then
echo
"vendor/k8s.io/api/core/v1"
return
fi
# Special cases first.
# Special cases first.
# TODO(lavalamp): Simplify this by moving pkg/api/v1 and splitting pkg/api,
# TODO(lavalamp): Simplify this by moving pkg/api/v1 and splitting pkg/api,
# moving the results to pkg/apis/api.
# moving the results to pkg/apis/api.
...
@@ -322,9 +342,6 @@ kube::util::group-version-to-pkg-path() {
...
@@ -322,9 +342,6 @@ kube::util::group-version-to-pkg-path() {
__internal
)
__internal
)
echo
"pkg/api"
echo
"pkg/api"
;;
;;
v1
)
echo
"pkg/api/v1"
;;
federation/v1beta1
)
federation/v1beta1
)
echo
"federation/apis/federation/v1beta1"
echo
"federation/apis/federation/v1beta1"
;;
;;
...
...
hack/update-codegen.sh
View file @
0a853fec
...
@@ -44,6 +44,7 @@ for gv in "${GROUP_VERSIONS[@]}"; do
...
@@ -44,6 +44,7 @@ for gv in "${GROUP_VERSIONS[@]}"; do
# add items, but strip off any leading apis/ you find to match command expectations
# add items, but strip off any leading apis/ you find to match command expectations
api_dir
=
$(
kube::util::group-version-to-pkg-path
"
${
gv
}
"
)
api_dir
=
$(
kube::util::group-version-to-pkg-path
"
${
gv
}
"
)
nopkg_dir
=
${
api_dir
#pkg/
}
nopkg_dir
=
${
api_dir
#pkg/
}
nopkg_dir
=
${
nopkg_dir
#vendor/k8s.io/api/
}
pkg_dir
=
${
nopkg_dir
#apis/
}
pkg_dir
=
${
nopkg_dir
#apis/
}
# skip groups that aren't being served, clients for these don't matter
# skip groups that aren't being served, clients for these don't matter
...
@@ -60,37 +61,55 @@ GV_DIRS_CSV=$(IFS=',';echo "${GV_DIRS[*]// /,}";IFS=$)
...
@@ -60,37 +61,55 @@ GV_DIRS_CSV=$(IFS=',';echo "${GV_DIRS[*]// /,}";IFS=$)
# update- and verify- scripts.
# update- and verify- scripts.
${
clientgen
}
"
$@
"
${
clientgen
}
"
$@
"
${
clientgen
}
-t
"
$@
"
${
clientgen
}
-t
"
$@
"
${
clientgen
}
--clientset-name
=
"clientset"
--input
=
"
${
GV_DIRS_CSV
}
"
"
$@
"
${
clientgen
}
--clientset-name
=
"clientset"
--input
-base
=
"k8s.io/kubernetes/vendor/k8s.io/api"
--input
=
"
${
GV_DIRS_CSV
}
"
"
$@
"
# Clientgen for federation clientset.
# Clientgen for federation clientset.
${
clientgen
}
--clientset-name
=
federation_internalclientset
--clientset-path
=
k8s.io/kubernetes/federation/client/clientset_generated
--input
=
"../../federation/apis/federation/"
,
"api/"
,
"extensions/"
,
"batch/"
,
"autoscaling/"
--included-types-overrides
=
"api/Service,api/Namespace,extensions/ReplicaSet,api/Secret,extensions/Ingress,extensions/Deployment,extensions/DaemonSet,api/ConfigMap,api/Event,batch/Job,autoscaling/HorizontalPodAutoscaler"
"
$@
"
${
clientgen
}
--clientset-name
=
federation_internalclientset
--clientset-path
=
k8s.io/kubernetes/federation/client/clientset_generated
--input
=
"../../federation/apis/federation/"
,
"api/"
,
"extensions/"
,
"batch/"
,
"autoscaling/"
--included-types-overrides
=
"api/Service,api/Namespace,extensions/ReplicaSet,api/Secret,extensions/Ingress,extensions/Deployment,extensions/DaemonSet,api/ConfigMap,api/Event,batch/Job,autoscaling/HorizontalPodAutoscaler"
"
$@
"
${
clientgen
}
--clientset-name
=
federation_clientset
--clientset-path
=
k8s.io/kubernetes/federation/client/clientset_generated
--input
=
"../../federation/apis/federation/v1beta1"
,
"api/v1"
,
"extensions/v1beta1"
,
"batch/v1"
,
"autoscaling/v1"
--included-types-overrides
=
"api/v1/Service,api/v1/Namespace,extensions/v1beta1/ReplicaSet,api/v1/Secret,extensions/v1beta1/Ingress,extensions/v1beta1/Deployment,extensions/v1beta1/DaemonSet,api/v1/ConfigMap,api
/v1/Event,batch/v1/Job,autoscaling/v1/HorizontalPodAutoscaler"
"
$@
"
${
clientgen
}
--clientset-name
=
federation_clientset
--clientset-path
=
k8s.io/kubernetes/federation/client/clientset_generated
--input
-base
=
"k8s.io/kubernetes/vendor/k8s.io/api"
--input
=
"../../../federation/apis/federation/v1beta1"
,
"core/v1"
,
"extensions/v1beta1"
,
"batch/v1"
,
"autoscaling/v1"
--included-types-overrides
=
"core/v1/Service,core/v1/Namespace,extensions/v1beta1/ReplicaSet,core/v1/Secret,extensions/v1beta1/Ingress,extensions/v1beta1/Deployment,extensions/v1beta1/DaemonSet,core/v1/ConfigMap,core
/v1/Event,batch/v1/Job,autoscaling/v1/HorizontalPodAutoscaler"
"
$@
"
LISTERGEN_APIS
=(
listergen_kubernetes_apis
=(
pkg/api
pkg/api
pkg/api/v1
$(
$(
cd
${
KUBE_ROOT
}
cd
${
KUBE_ROOT
}
find pkg/apis
-name
types.go | xargs
-n1
dirname
|
sort
# because client-gen doesn't do policy/v1alpha1, we have to skip it too
find pkg/apis
-name
types.go | xargs
-n1
dirname
|
sort
|
grep
-v
pkg.apis.policy.v1alpha1
)
)
listergen_kubernetes_apis
=(
${
listergen_kubernetes_apis
[@]/#/k8s.io/kubernetes/
}
)
listergen_staging_apis
=(
$(
cd
${
KUBE_ROOT
}
/staging/src
# because client-gen doesn't do policy/v1alpha1, we have to skip it too
find k8s.io/api
-name
types.go | xargs
-n1
dirname
|
sort
|
grep
-v
pkg.apis.policy.v1alpha1
)
)
)
)
LISTERGEN_APIS
=
(
${
LISTERGEN_APIS
[@]/#/k8s.io/kubernetes/
}
)
LISTERGEN_APIS
=
$(
IFS
=
,
;
echo
"
${
listergen_kubernetes_apis
[*]
}
"
)
LISTERGEN_APIS
=
$(
IFS
=
,
;
echo
"
${
LISTERGEN_APIS
[*]
}
"
)
LISTERGEN_APIS
+
=
","
LISTERGEN_APIS+
=
$(
IFS
=
,
;
echo
"
${
listergen_staging_apis
[*]
}
"
)
${
listergen
}
--input-dirs
"
${
LISTERGEN_APIS
}
"
"
$@
"
${
listergen
}
--input-dirs
"
${
LISTERGEN_APIS
}
"
"
$@
"
INFORMERGEN_APIS
=(
informergen_kubernetes_apis
=(
pkg/api
pkg/api
pkg/api/v1
$(
$(
cd
${
KUBE_ROOT
}
cd
${
KUBE_ROOT
}
# because client-gen doesn't do policy/v1alpha1, we have to skip it too
# because client-gen doesn't do policy/v1alpha1, we have to skip it too
find pkg/apis
-name
types.go | xargs
-n1
dirname
|
sort
|
grep
-v
pkg.apis.policy.v1alpha1
find pkg/apis
-name
types.go | xargs
-n1
dirname
|
sort
|
grep
-v
pkg.apis.policy.v1alpha1
)
)
)
)
informergen_kubernetes_apis
=(
${
informergen_kubernetes_apis
[@]/#/k8s.io/kubernetes/
}
)
informergen_staging_apis
=(
$(
cd
${
KUBE_ROOT
}
/staging/src
# because client-gen doesn't do policy/v1alpha1, we have to skip it too
find k8s.io/api
-name
types.go | xargs
-n1
dirname
|
sort
|
grep
-v
pkg.apis.policy.v1alpha1
)
)
INFORMERGEN_APIS
=
$(
IFS
=
,
;
echo
"
${
informergen_kubernetes_apis
[*]
}
"
)
INFORMERGEN_APIS+
=
","
INFORMERGEN_APIS+
=
$(
IFS
=
,
;
echo
"
${
informergen_staging_apis
[*]
}
"
)
INFORMERGEN_APIS
=(
${
INFORMERGEN_APIS
[@]/#/k8s.io/kubernetes/
}
)
INFORMERGEN_APIS
=
$(
IFS
=
,
;
echo
"
${
INFORMERGEN_APIS
[*]
}
"
)
${
informergen
}
\
${
informergen
}
\
--input-dirs
"
${
INFORMERGEN_APIS
}
"
\
--input-dirs
"
${
INFORMERGEN_APIS
}
"
\
--versioned-clientset-package
k8s.io/kubernetes/pkg/client/clientset_generated/clientset
\
--versioned-clientset-package
k8s.io/kubernetes/pkg/client/clientset_generated/clientset
\
...
@@ -98,6 +117,7 @@ ${informergen} \
...
@@ -98,6 +117,7 @@ ${informergen} \
--listers-package
k8s.io/kubernetes/pkg/client/listers
\
--listers-package
k8s.io/kubernetes/pkg/client/listers
\
"
$@
"
"
$@
"
# You may add additional calls of code generators like set-gen above.
# You may add additional calls of code generators like set-gen above.
# call generation on sub-project for now
# call generation on sub-project for now
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment