Skip to content

Commit

Permalink
upgrade k8s version to 1.28
Browse files Browse the repository at this point in the history
Signed-off-by: AiRanthem <[email protected]>
  • Loading branch information
AiRanthem committed Nov 7, 2024
1 parent eaacca6 commit cf8c63f
Show file tree
Hide file tree
Showing 12 changed files with 513 additions and 321 deletions.
14 changes: 14 additions & 0 deletions controller/client/delegating_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ type delegatingClient struct {
mapper meta.RESTMapper
}

func (d *delegatingClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error) {
// This new method is introduced when upgrading controller-runtime to version 0.16.x.
// As there are currently no use cases, this is just a temporary implementation.
// If this method needs to be used in the future, please re-implement it according to actual requirements.
return apiutil.GVKForObject(obj, d.scheme)
}

func (d *delegatingClient) IsObjectNamespaced(obj runtime.Object) (bool, error) {
// This new method is introduced when upgrading controller-runtime to version 0.16.x.
// As there are currently no use cases, this is just a temporary implementation.
// If this method needs to be used in the future, please re-implement it according to actual requirements.
return apiutil.IsObjectNamespaced(obj, d.scheme, d.mapper)
}

// Scheme returns the scheme this client is using.
func (d *delegatingClient) Scheme() *runtime.Scheme {
return d.scheme
Expand Down
2 changes: 1 addition & 1 deletion controller/reconciler/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var _ = Describe("Test clients", func() {

const path = "/trigger"
ch := reconciler.RegisterTriggerHandler(mgr, path, 1024)
svr := httptest.NewServer(mgr.GetWebhookServer().WebhookMux)
svr := httptest.NewServer(mgr.GetWebhookServer().WebhookMux())
defer svr.Close()

resp, err := http.Get(svr.URL + path)
Expand Down
17 changes: 6 additions & 11 deletions controller/sharding/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,16 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

// BuildCache add shard-id label selector for given typed object
func BuildCache(scheme *runtime.Scheme, shardingObjects ...client.Object) cache.NewCacheFunc {
return BuildCacheWithOptions(cache.Options{Scheme: scheme}, shardingObjects...)
}

// BuildCacheWithOptions add shard-id label selector to sharding objects with options
func BuildCacheWithOptions(opts cache.Options, shardingObjects ...client.Object) cache.NewCacheFunc {
func BuildCacheOptionsWithShardingObjects(scheme *runtime.Scheme, shardingObjects ...client.Object) cache.Options {

Check warning on line 26 in controller/sharding/cache.go

View workflow job for this annotation

GitHub Actions / unit-test

exported: exported function BuildCacheOptionsWithShardingObjects should have comment or be unexported (revive)
opts := cache.Options{Scheme: scheme}
if EnableSharding {
ls := labels.SelectorFromSet(map[string]string{LabelKubeVelaScheduledShardID: ShardID})
if opts.SelectorsByObject == nil {
opts.SelectorsByObject = map[client.Object]cache.ObjectSelector{}
if opts.ByObject == nil {
opts.ByObject = map[client.Object]cache.ByObject{}
}
for _, obj := range shardingObjects {
opts.SelectorsByObject[obj] = cache.ObjectSelector{Label: ls}
opts.ByObject[obj] = cache.ByObject{Label: ls}
}
}
return cache.BuilderWithOptions(opts)
return opts
}
3 changes: 2 additions & 1 deletion controller/sharding/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ var _ = Describe("Test sharding", func() {
Ω(cli.Create(ctx, cm2)).To(Succeed())

By("Test cache")
store, err := sharding.BuildCache(scheme.Scheme, &corev1.ConfigMap{})(cfg, cache.Options{})
opts := sharding.BuildCacheOptionsWithShardingObjects(scheme.Scheme, &corev1.ConfigMap{})
store, err := cache.New(cfg, opts)
Ω(err).To(Succeed())
go func() { _ = store.Start(ctx) }()
Eventually(func(g Gomega) {
Expand Down
112 changes: 57 additions & 55 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,91 +4,92 @@ go 1.22

require (
cuelang.org/go v0.9.2
github.com/emicklei/go-restful/v3 v3.9.0
github.com/evanphx/json-patch v4.12.0+incompatible
github.com/emicklei/go-restful/v3 v3.11.0
github.com/evanphx/json-patch v5.6.0+incompatible
github.com/go-stack/stack v1.8.1
github.com/google/go-cmp v0.6.0
github.com/jellydator/ttlcache/v3 v3.0.1
github.com/klauspost/compress v1.16.3
github.com/mitchellh/hashstructure/v2 v2.0.2
github.com/oam-dev/cluster-gateway v1.9.0-alpha.1
github.com/onsi/ginkgo/v2 v2.9.2
github.com/onsi/gomega v1.27.5
github.com/onsi/ginkgo/v2 v2.11.0
github.com/onsi/gomega v1.27.10
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/client_golang v1.16.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.8.2
go.uber.org/automaxprocs v1.5.3
k8s.io/api v0.26.3
k8s.io/apimachinery v0.26.3
k8s.io/apiserver v0.26.3
k8s.io/client-go v0.26.3
k8s.io/klog/v2 v2.80.1
k8s.io/kubectl v0.26.3
k8s.io/utils v0.0.0-20221128185143-99ec85e7a448
k8s.io/api v0.28.9
k8s.io/apimachinery v0.28.9
k8s.io/apiserver v0.28.9
k8s.io/client-go v0.28.9
k8s.io/klog/v2 v2.100.1
k8s.io/kubectl v0.28.9
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
sigs.k8s.io/apiserver-runtime v1.1.2-0.20221118041430-0a6394f6dda3
sigs.k8s.io/controller-runtime v0.14.5
sigs.k8s.io/controller-tools v0.11.3
sigs.k8s.io/controller-runtime v0.16.6
sigs.k8s.io/controller-tools v0.13.0
sigs.k8s.io/yaml v1.3.0
)

require (
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-logr/zapr v1.2.4 // 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/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobuffalo/flect v0.3.0 // indirect
github.com/gobuffalo/flect v1.0.2 // 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/cel-go v0.12.6 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/cel-go v0.16.1 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // 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/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/openshift/library-go v0.0.0-20230327085348-8477ec72b725 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.5 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
go.etcd.io/etcd/client/v3 v3.5.5 // indirect
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.35.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.1 // indirect
go.opentelemetry.io/otel v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect
Expand All @@ -97,10 +98,10 @@ require (
go.opentelemetry.io/otel/sdk v1.10.0 // indirect
go.opentelemetry.io/otel/trace v1.10.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
Expand All @@ -110,28 +111,29 @@ require (
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.21.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.56.3 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.26.3 // indirect
k8s.io/component-base v0.26.3 // indirect
k8s.io/apiextensions-apiserver v0.28.9 // indirect
k8s.io/component-base v0.28.9 // indirect
k8s.io/klog v1.0.0 // indirect
k8s.io/kms v0.26.3 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
k8s.io/kms v0.28.9 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
open-cluster-management.io/api v0.5.1-0.20220112073018-2d280a97a052 // indirect
sigs.k8s.io/apiserver-network-proxy v0.0.30 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)

replace (
cloud.google.com/go => cloud.google.com/go v0.100.2
github.com/docker/docker => github.com/moby/moby v20.10.20+incompatible
sigs.k8s.io/apiserver-network-proxy/konnectivity-client => sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36
)
Loading

0 comments on commit cf8c63f

Please sign in to comment.