mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-03-14 08:23:24 +08:00

This creates go.work and enables Go Workspaces. This is a file that includes info on k/k and all the staging modules. This depends on go 1.22 and setting FORCE_HOST_GO=true (for kube scripts, which try to be hermetic). Make this part of the normal update/verify sequence. The top-level go.work file contains no replace statements. Instead, the replace statements in the individual go.mod files are used. For this to work, replace statements in the individual go.mod files have to be consistent. hack/tools has different dependencies and can't be in the main workspace, so this adds a go.work just for that. Without this, go tries to consider all deps in all modules and pick one that works for all. This is problematic because there are so many of them that it is difficult to manage. Likewise for k8s.io/code-generator/examples and k8s.io/kms/internal/plugins/_mock - add trivial go.work files. For example k/k depends on an older version of a lib that gloangci-lint needs (transitively) and it breaks. This also updates vendor (needed to make go happy), and removes vendor'ed symlinks. This breaks a LOT of our build tools, which will be fixed subsequently. Result: `go` commands work across modules: Before: ``` $ go list ./pkg/proxy/iptables/ ./staging/src/k8s.io/api/core/v1/ main module (k8s.io/kubernetes) does not contain package k8s.io/kubernetes/staging/src/k8s.io/api/core/v1 $ go build ./pkg/proxy/iptables/ ./staging/src/k8s.io/api main module (k8s.io/kubernetes) does not contain package k8s.io/kubernetes/staging/src/k8s.io/api $ go test ./pkg/proxy/iptables/ ./staging/src/k8s.io/api main module (k8s.io/kubernetes) does not contain package k8s.io/kubernetes/staging/src/k8s.io/api ``` After: ``` $ go list ./pkg/proxy/iptables/ ./staging/src/k8s.io/api/core/v1/ k8s.io/kubernetes/pkg/proxy/iptables k8s.io/api/core/v1 $ go build ./pkg/proxy/iptables/ ./staging/src/k8s.io/api $ go test ./pkg/proxy/iptables/ ./staging/src/k8s.io/api ok k8s.io/kubernetes/pkg/proxy/iptables 0.360s ok k8s.io/api 2.302s ``` Result: `make` fails: ``` $ make go version go1.22rc1 linux/amd64 +++ [0106 12:11:03] Building go targets for linux/amd64 k8s.io/kubernetes/cmd/kube-proxy (static) k8s.io/kubernetes/cmd/kube-apiserver (static) k8s.io/kubernetes/cmd/kube-controller-manager (static) k8s.io/kubernetes/cmd/kubelet (non-static) k8s.io/kubernetes/cmd/kubeadm (static) k8s.io/kubernetes/cmd/kube-scheduler (static) k8s.io/component-base/logs/kube-log-runner (static) k8s.io/kube-aggregator (static) k8s.io/apiextensions-apiserver (static) k8s.io/kubernetes/cluster/gce/gci/mounter (static) k8s.io/kubernetes/cmd/kubectl (static) k8s.io/kubernetes/cmd/kubectl-convert (static) github.com/onsi/ginkgo/v2/ginkgo (non-static) k8s.io/kubernetes/test/e2e/e2e.test (test) k8s.io/kubernetes/test/conformance/image/go-runner (non-static) k8s.io/kubernetes/cmd/kubemark (static) github.com/onsi/ginkgo/v2/ginkgo (non-static) k8s.io/kubernetes/test/e2e_node/e2e_node.test (test) test/e2e/e2e.go:35:2: cannot find package "k8s.io/api/apps/v1" in any of: /home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/api/apps/v1 (vendor tree) /home/thockin/src/kubernetes/_output/local/.gimme/versions/go1.22rc1.linux.amd64/src/k8s.io/api/apps/v1 (from $GOROOT) /home/thockin/src/kubernetes/_output/local/go/src/k8s.io/api/apps/v1 (from $GOPATH) ... more ... ... more ... ... more ... !!! [0106 12:13:41] Call tree: !!! [0106 12:13:41] 1: /home/thockin/src/kubernetes/hack/lib/golang.sh:948 kube::golang::build_binaries_for_platform(...) !!! [0106 12:13:41] 2: hack/make-rules/build.sh:27 kube::golang::build_binaries(...) !!! [0106 12:13:41] Call tree: !!! [0106 12:13:41] 1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...) !!! [0106 12:13:41] Call tree: !!! [0106 12:13:41] 1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...) make: *** [Makefile:96: all] Error 1 ``` Again, this requires go 1.22 (e.g. gotip), as go 1.21.x does not have `go work vendor` support. TO REPEAT: ( \ ./hack/update-go-workspace.sh; \ ./hack/update-vendor.sh; \ ./hack/update-go-workspace.sh; \ ) Kubernetes-commit: 65b841c077e0d3282d28b9199aec72d23d045104
67 lines
2.5 KiB
Modula-2
67 lines
2.5 KiB
Modula-2
// This is a generated file. Do not edit directly.
|
|
|
|
module k8s.io/sample-controller
|
|
|
|
go 1.22.0
|
|
|
|
require (
|
|
golang.org/x/time v0.3.0
|
|
k8s.io/api v0.0.0
|
|
k8s.io/apimachinery v0.0.0
|
|
k8s.io/client-go v0.0.0
|
|
k8s.io/code-generator v0.0.0
|
|
k8s.io/klog/v2 v2.120.1
|
|
)
|
|
|
|
require (
|
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
|
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
|
|
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
|
|
github.com/go-logr/logr v1.4.1 // indirect
|
|
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
|
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
|
github.com/go-openapi/swag v0.22.3 // indirect
|
|
github.com/gogo/protobuf v1.3.2 // indirect
|
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
|
github.com/golang/protobuf v1.5.3 // indirect
|
|
github.com/google/gnostic-models v0.6.8 // indirect
|
|
github.com/google/go-cmp v0.6.0 // indirect
|
|
github.com/google/gofuzz v1.2.0 // indirect
|
|
github.com/google/uuid v1.3.0 // indirect
|
|
github.com/imdario/mergo v0.3.6 // indirect
|
|
github.com/josharian/intern v1.0.0 // indirect
|
|
github.com/json-iterator/go v1.1.12 // indirect
|
|
github.com/mailru/easyjson v0.7.7 // indirect
|
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
|
github.com/pkg/errors v0.9.1 // indirect
|
|
github.com/spf13/pflag v1.0.5 // indirect
|
|
golang.org/x/mod v0.14.0 // indirect
|
|
golang.org/x/net v0.19.0 // indirect
|
|
golang.org/x/oauth2 v0.10.0 // indirect
|
|
golang.org/x/sys v0.17.0 // indirect
|
|
golang.org/x/term v0.17.0 // indirect
|
|
golang.org/x/text v0.14.0 // indirect
|
|
golang.org/x/tools v0.16.1 // indirect
|
|
google.golang.org/appengine v1.6.7 // indirect
|
|
google.golang.org/protobuf v1.31.0 // indirect
|
|
gopkg.in/inf.v0 v0.9.1 // indirect
|
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect
|
|
k8s.io/kube-openapi v0.0.0-20231113174909-778a5567bc1e // indirect
|
|
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
|
|
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
|
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
|
|
sigs.k8s.io/yaml v1.3.0 // indirect
|
|
)
|
|
|
|
replace (
|
|
k8s.io/api => ../api
|
|
k8s.io/apimachinery => ../apimachinery
|
|
k8s.io/client-go => ../client-go
|
|
k8s.io/code-generator => ../code-generator
|
|
k8s.io/sample-controller => ../sample-controller
|
|
)
|