Remove defunct references to "vendor"

This commit is contained in:
Tim Hockin 2024-01-15 15:56:21 -08:00
parent 7f5982e708
commit d772f7719d
No known key found for this signature in database
23 changed files with 56 additions and 175 deletions

View File

@ -49,7 +49,7 @@ kube::test::find_integration_test_dirs() {
find test/integration/ -name '*_test.go' -print0 \
| xargs -0n1 dirname | sed "s|^|${KUBE_GO_PACKAGE}/|" \
| LC_ALL=C sort -u
find vendor/k8s.io/apiextensions-apiserver/test/integration/ -name '*_test.go' -print0 \
find staging/src/k8s.io/apiextensions-apiserver/test/integration/ -name '*_test.go' -print0 \
| xargs -0n1 dirname | sed "s|^|${KUBE_GO_PACKAGE}/|" \
| LC_ALL=C sort -u
)

View File

@ -53,7 +53,7 @@ kube::test::find_dirs() {
\) -prune \
\) -name '*_test.go' -print0 | xargs -0n1 dirname | LC_ALL=C sort -u
find ./staging -name '*_test.go' -not -path '*/test/integration/*' -prune -print0 | xargs -0n1 dirname | sed 's|^\./staging/src/|./vendor/|' | LC_ALL=C sort -u
find ./staging -name '*_test.go' -not -path '*/test/integration/*' -prune -print0 | xargs -0n1 dirname | LC_ALL=C sort -u
)
}
@ -255,18 +255,7 @@ runTests() {
# we spawn a subshell for each PARALLEL process, redirecting the output to
# separate files.
# ignore paths:
# vendor/k8s.io/code-generator/cmd/generator: is fragile when run under coverage, so ignore it for now.
# https://github.com/kubernetes/kubernetes/issues/24967
# vendor/k8s.io/client-go/1.4/rest: causes cover internal errors
# https://github.com/golang/go/issues/16540
cover_ignore_dirs="vendor/k8s.io/code-generator/cmd/generator|vendor/k8s.io/client-go/1.4/rest"
for path in ${cover_ignore_dirs//|/ }; do
echo -e "skipped\tk8s.io/kubernetes/${path}"
done
printf "%s\n" "${@}" \
| grep -Ev ${cover_ignore_dirs} \
| xargs -I{} -n 1 -P "${KUBE_COVERPROCS}" \
bash -c "set -o pipefail; _pkg=\"\$0\"; _pkg_out=\${_pkg//\//_}; \
go test ${goflags[*]:+${goflags[*]}} \

View File

@ -41,7 +41,6 @@ find_files() {
-o -wholename './target' \
-o -wholename '*/third_party/*' \
-o -wholename '*/vendor/*' \
-o -wholename './staging/src/k8s.io/client-go/*vendor/*' \
\) -prune \
\) -name '*.go'
}

View File

@ -37,7 +37,6 @@ find_files() {
-o -wholename './target' \
-o -wholename '*/third_party/*' \
-o -wholename '*/vendor/*' \
-o -wholename './staging/src/k8s.io/client-go/*vendor/*' \
-o -wholename './staging/src/k8s.io/client-go/pkg/*' \
\) -prune \
\) -name '.readonly'

View File

@ -76,7 +76,7 @@ func output() error {
return nil
}
// From vendor/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go
// From k8s.io/apiserver/pkg/endpoints/openapi/openapi.go
func friendlyName(name string) string {
nameParts := strings.Split(name, "/")
// Reverse first part. e.g., io.k8s... instead of k8s.io...

View File

@ -42,11 +42,10 @@ code. You can directly modify such code.
## Using staged repositories from Kubernetes code
Kubernetes code uses the repositories in this directory via symlinks in the
`vendor/k8s.io` directory into this staging area. For example, when
Kubernetes code imports a package from the `k8s.io/client-go` repository, that
import is resolved to `staging/src/k8s.io/client-go` relative to the project
root:
Kubernetes code uses the repositories in this directory via a Go workspace and
module `replace` statements. For example, when Kubernetes code imports a
package from the `k8s.io/client-go` repository, that import is resolved to
`staging/src/k8s.io/client-go` relative to the project root:
```go
// pkg/example/some_code.go
@ -57,38 +56,40 @@ import (
)
```
Once the change-over to external repositories is complete, these repositories
will actually be vendored from `k8s.io/<package-name>`.
## Creating a new repository in staging
### Adding the staging repository in `kubernetes/kubernetes`:
1. Send an email to the SIG Architecture
[mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-architecture)
and the mailing list of the SIG which would own the repo requesting approval
for creating the staging repository.
1. Send an email to the SIG Architecture [mailing
list](https://groups.google.com/forum/#!forum/kubernetes-sig-architecture)
and the mailing list of the SIG which would own the repo requesting approval
for creating the staging repository.
2. Once approval has been granted, create the new staging repository.
3. Add a symlink to the staging repo in `vendor/k8s.io`.
3. Update
[`import-restrictions.yaml`](/staging/publishing/import-restrictions.yaml)
to add the list of other staging repos that this new repo can import.
4. Update [`import-restrictions.yaml`](/staging/publishing/import-restrictions.yaml)
to add the list of other staging repos that this new repo can import.
4. Add all mandatory template files to the staging repo as mentioned in
https://github.com/kubernetes/kubernetes-template-project.
5. Add all mandatory template files to the staging repo as mentioned in
https://github.com/kubernetes/kubernetes-template-project.
5. Make sure that the `.github/PULL_REQUEST_TEMPLATE.md` and `CONTRIBUTING.md`
files mention that PRs are not directly accepted to the repo.
6. Make sure that the `.github/PULL_REQUEST_TEMPLATE.md` and
`CONTRIBUTING.md` files mention that PRs are not directly accepted to the repo.
6. Ensure that `docs.go` file is added. Refer to
[#kubernetes/kubernetes#91354](https://github.com/kubernetes/kubernetes/blob/release-1.24/staging/src/k8s.io/client-go/doc.go)
for reference.
7. Ensure that `docs.go` file is added. Refer to [#kubernetes/kubernetes#91354](https://github.com/kubernetes/kubernetes/blob/release-1.24/staging/src/k8s.io/client-go/doc.go) for reference.
8. NOTE: Do not edit go.mod or go.sum in the new repo (staging/src/k8s.io/<newrepo>/) manually. Run the following instead:
7. NOTE: Do not edit go.mod or go.sum in the new repo (staging/src/k8s.io/<newrepo>/) manually. Run the following instead:
```
./hack/update-vendor.sh
```
8. Run [`./hack/update-go-workspace.sh`](/hack/update-go-workspace.sh) to add
the module to the workspace.
### Creating the published repository
1. Create an [issue](https://github.com/kubernetes/org/issues/new?template=repo-create.md)

View File

@ -83,7 +83,7 @@ to ensure we are not breaking backwards compatibility with serialized data from
To see the diff between the original JSON/YAML data and the `...after_roundtrip...` files:
```sh
cd vendor/k8s.io/api/testdata/v1.14.0/
cd staging/src/k8s.io/api/testdata/v1.14.0/
diff -u admission.k8s.io.v1beta1.AdmissionReview.json admission.k8s.io.v1beta1.AdmissionReview.after_roundtrip.json
diff -u admission.k8s.io.v1beta1.AdmissionReview.yaml admission.k8s.io.v1beta1.AdmissionReview.after_roundtrip.yaml
```
@ -120,7 +120,7 @@ To see the diff between the original proto data and the `...after_roundtrip...`
and strip off the leading four-byte kubernetes protobuf header to get standard protobuf that can be decoded:
```sh
cd vendor/k8s.io/api/testdata/v1.14.0/
cd staging/src/k8s.io/api/testdata/v1.14.0/
diff -u \
<(tail -c +5 admission.k8s.io.v1beta1.AdmissionReview.pb | protoc --decode_raw) \
<(tail -c +5 admission.k8s.io.v1beta1.AdmissionReview.after_roundtrip.pb | protoc --decode_raw)
@ -138,4 +138,4 @@ diff -u \
> }
> 2 {
> 1: "\347\210\237\302\274\302\252ov\351\210\266"
> ```
> ```

View File

@ -23,11 +23,11 @@ source "${KUBE_ROOT}/hack/lib/util.sh"
# Register function to be called on EXIT to remove generated binary.
function cleanup {
rm "${KUBE_ROOT}/vendor/k8s.io/apiextensions-apiserver/artifacts/simple-image/apiextensions-apiserver"
rm "${KUBE_ROOT}/staging/src/k8s.io/apiextensions-apiserver/artifacts/simple-image/apiextensions-apiserver"
}
trap cleanup EXIT
pushd "${KUBE_ROOT}/vendor/k8s.io/apiextensions-apiserver"
pushd "${KUBE_ROOT}/staging/src/k8s.io/apiextensions-apiserver"
cp -v ../../../../_output/local/bin/linux/amd64/apiextensions-apiserver ./artifacts/simple-image/apiextensions-apiserver
docker build -t apiextensions-apiserver:latest ./artifacts/simple-image
popd

View File

@ -42,7 +42,7 @@ func BenchmarkAdmit(b *testing.B) {
if len(testServerURL) == 0 {
b.Log("warning, WEBHOOK_TEST_SERVER_URL not set, starting in-process server, benchmarks will include webhook cost.")
b.Log("to run a standalone server, run:")
b.Log("go run ./vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/testing/main/main.go")
b.Log("go run k8s.io/apiserver/pkg/admission/plugin/webhook/testing/main/main.go")
testServer := webhooktesting.NewTestServer(b)
testServer.StartTLS()
defer testServer.Close()

View File

@ -38,7 +38,7 @@ func BenchmarkValidate(b *testing.B) {
if len(testServerURL) == 0 {
b.Log("warning, WEBHOOK_TEST_SERVER_URL not set, starting in-process server, benchmarks will include webhook cost.")
b.Log("to run a standalone server, run:")
b.Log("go run ./vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/testing/main/main.go")
b.Log("go run k8s.io/apiserver/pkg/admission/plugin/webhook/testing/main/main.go")
testServer := webhooktesting.NewTestServer(b)
testServer.StartTLS()
defer testServer.Close()

View File

@ -50,7 +50,7 @@ func (e shortcutExpander) KindFor(resource schema.GroupVersionResource) (schema.
// In case of new CRDs this means we potentially don't have current state of discovery.
// In the current wiring in k8s.io/cli-runtime/pkg/genericclioptions/config_flags.go#toRESTMapper,
// we are using DeferredDiscoveryRESTMapper which on KindFor failure will clear the
// cache and fetch all data from a cluster (see vendor/k8s.io/client-go/restmapper/discovery.go#KindFor).
// cache and fetch all data from a cluster (see k8s.io/client-go/restmapper/discovery.go#KindFor).
// Thus another call to expandResourceShortcut, after a NoMatchError should successfully
// read Kind to the user or an error.
gvk, err := e.RESTMapper.KindFor(e.expandResourceShortcut(resource))

View File

@ -158,9 +158,6 @@ func friendlyName(name string) string {
func typeName(t *types.Type) string {
typePackage := t.Name.Package
if strings.Contains(typePackage, "/vendor/") {
typePackage = typePackage[strings.Index(typePackage, "/vendor/")+len("/vendor/"):]
}
return fmt.Sprintf("%s.%s", typePackage, t.Name.Name)
}

View File

@ -26,10 +26,8 @@ import (
"k8s.io/code-generator/cmd/client-gen/generators/fake"
"k8s.io/code-generator/cmd/client-gen/generators/scheme"
"k8s.io/code-generator/cmd/client-gen/generators/util"
"k8s.io/code-generator/cmd/client-gen/path"
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
codegennamer "k8s.io/code-generator/pkg/namer"
genutil "k8s.io/code-generator/pkg/util"
"k8s.io/gengo/v2/args"
"k8s.io/gengo/v2/generator"
"k8s.io/gengo/v2/namer"
@ -279,7 +277,7 @@ func applyGroupOverrides(universe types.Universe, customArgs *clientgenargs.Cust
// Create a map from "old GV" to "new GV" so we know what changes we need to make.
changes := make(map[clientgentypes.GroupVersion]clientgentypes.GroupVersion)
for gv, inputDir := range customArgs.GroupVersionPackages() {
p := universe.Package(genutil.Vendorless(inputDir))
p := universe.Package(inputDir)
if override := types.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil {
newGV := clientgentypes.GroupVersion{
Group: clientgentypes.Group(override[0]),
@ -324,7 +322,7 @@ func sanitizePackagePaths(context *generator.Context, ca *clientgenargs.CustomAr
for j := range pkg.Versions {
ver := &pkg.Versions[j]
input := ver.Package
p := context.Universe[path.Vendorless(input)]
p := context.Universe[input]
if p == nil || p.Name == "" {
pkgs, err := context.FindPackages(input)
if err != nil {
@ -362,7 +360,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
gvToTypes := map[clientgentypes.GroupVersion][]*types.Type{}
groupGoNames := make(map[clientgentypes.GroupVersion]string)
for gv, inputDir := range customArgs.GroupVersionPackages() {
p := context.Universe.Package(path.Vendorless(inputDir))
p := context.Universe.Package(inputDir)
// If there's a comment of the form "// +groupGoName=SomeUniqueShortName", use that as
// the Go group identifier in CamelCase. It defaults
@ -371,7 +369,6 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
groupGoNames[gv] = namer.IC(override[0])
}
// Package are indexed with the vendor prefix stripped
for n, t := range p.Types {
// filter out types which are not included in user specified overrides.
typesOverride, ok := includedTypesOverrides[gv]

View File

@ -25,7 +25,6 @@ import (
"k8s.io/gengo/v2/types"
"k8s.io/code-generator/cmd/client-gen/generators/util"
"k8s.io/code-generator/cmd/client-gen/path"
)
// genGroup produces a file for a group client, e.g. ExtensionsClient for the extension group.
@ -83,7 +82,7 @@ func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer
groupName = ""
}
// allow user to define a group name that's different from the one parsed from the directory.
p := c.Universe.Package(path.Vendorless(g.inputPackage))
p := c.Universe.Package(g.inputPackage)
if override := types.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil {
groupName = override[0]
}
@ -104,7 +103,7 @@ func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer
"RESTHTTPClientFor": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "HTTPClientFor"}),
"restRESTClientFor": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "RESTClientFor"}),
"restRESTClientForConfigAndClient": c.Universe.Function(types.Name{Package: "k8s.io/client-go/rest", Name: "RESTClientForConfigAndClient"}),
"SchemeGroupVersion": c.Universe.Variable(types.Name{Package: path.Vendorless(g.inputPackage), Name: "SchemeGroupVersion"}),
"SchemeGroupVersion": c.Universe.Variable(types.Name{Package: g.inputPackage, Name: "SchemeGroupVersion"}),
}
sw.Do(groupInterfaceTemplate, m)
sw.Do(groupClientTemplate, m)

View File

@ -23,7 +23,6 @@ import (
"path/filepath"
"strings"
"k8s.io/code-generator/cmd/client-gen/path"
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
"k8s.io/gengo/v2/generator"
"k8s.io/gengo/v2/namer"
@ -70,10 +69,10 @@ func (g *GenScheme) Imports(c *generator.Context) (imports []string) {
}
packagePath = filepath.Join(packagePath, "install")
imports = append(imports, fmt.Sprintf("%s \"%s\"", groupAlias, path.Vendorless(packagePath)))
imports = append(imports, fmt.Sprintf("%s \"%s\"", groupAlias, packagePath))
break
} else {
imports = append(imports, fmt.Sprintf("%s%s \"%s\"", groupAlias, strings.ToLower(version.Version.NonEmpty()), path.Vendorless(packagePath)))
imports = append(imports, fmt.Sprintf("%s%s \"%s\"", groupAlias, strings.ToLower(version.Version.NonEmpty()), packagePath))
}
}
}

View File

@ -1,31 +0,0 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package path
import "strings"
// Vendorless removes the longest match of "*/vendor/" from the front of p.
// It is useful if a package locates in vendor/, e.g.,
// k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1, because gengo
// indexes the package with its import path, e.g.,
// k8s.io/apimachinery/pkg/apis/meta/v1,
func Vendorless(p string) string {
if pos := strings.LastIndex(p, "/vendor/"); pos != -1 {
return p[pos+len("/vendor/"):]
}
return p
}

View File

@ -33,7 +33,6 @@ import (
"k8s.io/klog/v2"
conversionargs "k8s.io/code-generator/cmd/conversion-gen/args"
genutil "k8s.io/code-generator/pkg/util"
)
// These are the comment tags that carry parameters for conversion generation.
@ -273,19 +272,9 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
}
// Make sure explicit peer-packages are added.
var sanitizedPeerPkgs []string
if customArgs, ok := arguments.CustomArgs.(*conversionargs.CustomArgs); ok {
all := append(customArgs.BasePeerDirs, customArgs.ExtraPeerDirs...)
for _, pkg := range all {
// if the source path is within a /vendor/ directory (for example,
// k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1), allow
// generation to output to the proper relative path (under vendor).
// Otherwise, the generator will create the file in the wrong location
// in the output directory.
pkg = genutil.Vendorless(pkg)
sanitizedPeerPkgs = append(sanitizedPeerPkgs, pkg)
}
if expanded, err := context.FindPackages(sanitizedPeerPkgs...); err != nil {
peers := append(customArgs.BasePeerDirs, customArgs.ExtraPeerDirs...)
if expanded, err := context.FindPackages(peers...); err != nil {
klog.Fatalf("cannot find peer packages: %v", err)
} else {
otherPkgs = append(otherPkgs, expanded...)
@ -326,7 +315,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
pkg := context.Universe[i]
// typesPkg is where the versioned types are defined. Sometimes it is
// different from pkg. For example, kubernetes core/v1 types are defined
// in vendor/k8s.io/api/core/v1, while pkg is at pkg/api/v1.
// in k8s.io/api/core/v1, while pkg is at pkg/api/v1.
typesPkg := pkg
// Add conversion and defaulting functions.
@ -341,29 +330,15 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
unsafeEquality = noEquality{}
}
path := pkg.Path
// if the source path is within a /vendor/ directory (for example,
// k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1), allow
// generation to output to the proper relative path (under vendor).
// Otherwise, the generator will create the file in the wrong location
// in the output directory.
// TODO: build a more fundamental concept in gengo for dealing with modifications
// to vendored packages.
if strings.HasPrefix(pkg.SourcePath, arguments.OutputBase) {
expandedPath := strings.TrimPrefix(pkg.SourcePath, arguments.OutputBase)
if strings.Contains(expandedPath, "/vendor/") {
path = expandedPath
}
}
packages = append(packages,
&generator.DefaultPackage{
PackageName: filepath.Base(pkg.Path),
PackagePath: path,
PackagePath: pkg.Path,
Source: pkg.SourcePath, // output pkg is the same as the input
HeaderText: header,
GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) {
return []generator.Generator{
NewGenConversion(arguments.OutputFileBaseName, typesPkg.Path, pkg.Path, manualConversions, pkgToPeers[path], unsafeEquality),
NewGenConversion(arguments.OutputFileBaseName, typesPkg.Path, pkg.Path, manualConversions, pkgToPeers[pkg.Path], unsafeEquality),
}
},
FilterFunc: func(c *generator.Context, t *types.Type) bool {

View File

@ -122,7 +122,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
internalGroupVersions := make(map[string]clientgentypes.GroupVersions)
groupGoNames := make(map[string]string)
for _, inputDir := range arguments.InputDirs {
p := context.Universe.Package(genutil.Vendorless(inputDir))
p := context.Universe.Package(inputDir)
objectMeta, internal, err := objectMetaForPackage(p)
if err != nil {

View File

@ -230,24 +230,10 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
}
if pkgNeedsGeneration {
path := pkg.Path
// if the source path is within a /vendor/ directory (for example,
// k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1), allow
// generation to output to the proper relative path (under vendor).
// Otherwise, the generator will create the file in the wrong location
// in the output directory.
// TODO: build a more fundamental concept in gengo for dealing with modifications
// to vendored packages.
if strings.HasPrefix(pkg.SourcePath, arguments.OutputBase) {
expandedPath := strings.TrimPrefix(pkg.SourcePath, arguments.OutputBase)
if strings.Contains(expandedPath, "/vendor/") {
path = expandedPath
}
}
packages = append(packages,
&generator.DefaultPackage{
PackageName: strings.Split(filepath.Base(pkg.Path), ".")[0],
PackagePath: path,
PackagePath: pkg.Path,
Source: pkg.SourcePath, // output pkg is the same as the input
HeaderText: header,
GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) {

View File

@ -1,29 +0,0 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package util
import (
"strings"
)
// Vendorless trims vendor prefix from a package path to make it canonical
func Vendorless(p string) string {
if pos := strings.LastIndex(p, "/vendor/"); pos != -1 {
return p[pos+len("/vendor/"):]
}
return p
}

View File

@ -30,13 +30,13 @@ import (
// We setup this list for allow and not fail on the current violations.
// Generally speaking, you need to fix the problem for a new metric rather than add it into the list.
var exceptionMetrics = []string{
// k8s.io/kubernetes/vendor/k8s.io/apiserver/pkg/server/egressselector
// k8s.io/apiserver/pkg/server/egressselector
"apiserver_egress_dialer_dial_failure_count", // counter metrics should have "_total" suffix
// k8s.io/kubernetes/vendor/k8s.io/apiserver/pkg/server/healthz
// k8s.io/apiserver/pkg/server/healthz
"apiserver_request_total", // label names should be written in 'snake_case' not 'camelCase'
// k8s.io/kubernetes/vendor/k8s.io/apiserver/pkg/endpoints/filters
// k8s.io/apiserver/pkg/endpoints/filters
"authenticated_user_requests", // counter metrics should have "_total" suffix
"authentication_attempts", // counter metrics should have "_total" suffix

View File

@ -23,11 +23,11 @@ source "${KUBE_ROOT}/hack/lib/util.sh"
# Register function to be called on EXIT to remove generated binary.
function cleanup {
rm "${KUBE_ROOT}/vendor/k8s.io/kube-aggregator/artifacts/simple-image/kube-aggregator"
rm "${KUBE_ROOT}/staging/src/k8s.io/kube-aggregator/artifacts/simple-image/kube-aggregator"
}
trap cleanup EXIT
pushd "${KUBE_ROOT}/vendor/k8s.io/kube-aggregator"
pushd "${KUBE_ROOT}/staging/src/k8s.io/kube-aggregator"
cp -v ../../../../_output/local/bin/linux/amd64/kube-aggregator ./artifacts/simple-image/kube-aggregator
docker build -t kube-aggregator:latest ./artifacts/simple-image
popd
popd

View File

@ -23,11 +23,11 @@ source "${KUBE_ROOT}/hack/lib/util.sh"
# Register function to be called on EXIT to remove generated binary.
function cleanup {
rm "${KUBE_ROOT}/vendor/k8s.io/sample-apiserver/artifacts/simple-image/kube-sample-apiserver"
rm "${KUBE_ROOT}/staging/src/k8s.io/sample-apiserver/artifacts/simple-image/kube-sample-apiserver"
}
trap cleanup EXIT
pushd "${KUBE_ROOT}/vendor/k8s.io/sample-apiserver"
pushd "${KUBE_ROOT}/staging/src/k8s.io/sample-apiserver"
cp -v ../../../../_output/local/bin/linux/amd64/sample-apiserver ./artifacts/simple-image/kube-sample-apiserver
docker build -t kube-sample-apiserver:latest ./artifacts/simple-image
popd