Skip to content

Commit

Permalink
Bump controller-runtime to a17fd5870b906b50662fed6658265f5f8cf0863e
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Apr 23, 2024
1 parent c0cc7e3 commit 3fd9b09
Show file tree
Hide file tree
Showing 18 changed files with 202 additions and 148 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions config/crd/bases/cluster.x-k8s.io_machinesets.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 6 additions & 9 deletions controllers/external/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ import (

"github.com/go-logr/logr"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/predicate"
Expand All @@ -42,7 +41,7 @@ type ObjectTracker struct {
}

// Watch uses the controller to issue a Watch only if the object hasn't been seen before.
func (o *ObjectTracker) Watch(log logr.Logger, obj runtime.Object, handler handler.EventHandler, p ...predicate.Predicate) error {
func (o *ObjectTracker) Watch(log logr.Logger, obj client.Object, handler handler.TypedEventHandler[client.Object], p ...predicate.Predicate) error {
// Consider this a no-op if the controller isn't present.
if o.Controller == nil {
return nil
Expand All @@ -54,15 +53,13 @@ func (o *ObjectTracker) Watch(log logr.Logger, obj runtime.Object, handler handl
return nil
}

u := &unstructured.Unstructured{}
u.SetGroupVersionKind(gvk)

log.Info(fmt.Sprintf("Adding watch on external object %q", gvk.String()))
err := o.Controller.Watch(
source.Kind(o.Cache, u),
err := o.Controller.Watch(source.Kind(
o.Cache,
obj,
handler,
append(p, predicates.ResourceNotPaused(log))...,
)
))
if err != nil {
o.m.Delete(key)
return errors.Wrapf(err, "failed to add watch on external object %q", gvk.String())
Expand Down
4 changes: 1 addition & 3 deletions controllers/external/tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ import (
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/source"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
Expand Down Expand Up @@ -55,7 +53,7 @@ func newWatchCountController(raiseError bool) *watchCountController {
}
}

func (c *watchCountController) Watch(_ source.Source, _ handler.EventHandler, _ ...predicate.Predicate) error {
func (c *watchCountController) Watch(_ source.Source) error {
c.count++
if c.raiseError {
return errors.New("injected failure")
Expand Down
4 changes: 2 additions & 2 deletions controllers/remote/cluster_cache_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ func (t *ClusterCacheTracker) deleteAccessor(_ context.Context, cluster client.O
// Watcher is a scoped-down interface from Controller that only knows how to watch.
type Watcher interface {
// Watch watches src for changes, sending events to eventHandler if they pass predicates.
Watch(src source.Source, eventHandler handler.EventHandler, predicates ...predicate.Predicate) error
Watch(src source.Source) error
}

// WatchInput specifies the parameters used to establish a new watch for a remote cluster.
Expand Down Expand Up @@ -585,7 +585,7 @@ func (t *ClusterCacheTracker) Watch(ctx context.Context, input WatchInput) error
}

// Need to create the watch
if err := input.Watcher.Watch(source.Kind(accessor.cache, input.Kind), input.EventHandler, input.Predicates...); err != nil {
if err := input.Watcher.Watch(source.Kind(accessor.cache, input.Kind, input.EventHandler, input.Predicates...)); err != nil {
return errors.Wrapf(err, "failed to add %s watch on cluster %s: failed to create watch", input.Kind, klog.KRef(input.Cluster.Namespace, input.Cluster.Name))
}

Expand Down
2 changes: 1 addition & 1 deletion controlplane/kubeadm/internal/webhooks/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (v *ScaleValidator) SetupWebhookWithManager(mgr ctrl.Manager) error {
// ScaleValidator validates KCP for replicas.
type ScaleValidator struct {
Client client.Reader
decoder *admission.Decoder
decoder admission.Decoder
}

// Handle will validate for number of replicas.
Expand Down
2 changes: 1 addition & 1 deletion exp/internal/webhooks/machinepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (webhook *MachinePool) SetupWebhookWithManager(mgr ctrl.Manager) error {

// MachinePool implements a validation and defaulting webhook for MachinePool.
type MachinePool struct {
decoder *admission.Decoder
decoder admission.Decoder
}

var _ webhook.CustomValidator = &MachinePool{}
Expand Down
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ require (
golang.org/x/text v0.14.0
gomodules.xyz/jsonpatch/v2 v2.4.0
google.golang.org/grpc v1.59.0
k8s.io/api v0.29.3
k8s.io/apiextensions-apiserver v0.29.3
k8s.io/apimachinery v0.29.3
k8s.io/apiserver v0.29.3
k8s.io/client-go v0.29.3
k8s.io/api v0.30.0
k8s.io/apiextensions-apiserver v0.30.0
k8s.io/apimachinery v0.30.0
k8s.io/apiserver v0.30.0
k8s.io/client-go v0.30.0
k8s.io/cluster-bootstrap v0.29.3
k8s.io/component-base v0.29.3
k8s.io/klog/v2 v2.110.1
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
k8s.io/component-base v0.30.0
k8s.io/klog/v2 v2.120.1
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340
k8s.io/kubectl v0.29.3
k8s.io/utils v0.0.0-20231127182322-b307cd553661
sigs.k8s.io/controller-runtime v0.17.3
sigs.k8s.io/controller-runtime v0.17.1-0.20240423060933-a9db20803130
sigs.k8s.io/yaml v1.4.0
)

Expand Down Expand Up @@ -88,7 +88,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/cel-go v0.17.7 // indirect
github.com/google/cel-go v0.17.8 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
Expand Down Expand Up @@ -126,7 +126,7 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rivo/uniseg v0.4.2 // indirect
Expand All @@ -153,7 +153,7 @@ require (
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
Expand All @@ -162,7 +162,7 @@ require (
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.17.0 // indirect
golang.org/x/tools v0.18.0 // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
Expand All @@ -174,7 +174,7 @@ require (
k8s.io/cli-runtime v0.29.3 // indirect
k8s.io/component-helpers v0.29.3 // indirect
k8s.io/metrics v0.29.3 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kustomize/v5 v5.0.4-0.20230601165947-6ce0bf390ce3 // indirect
Expand Down
Loading

0 comments on commit 3fd9b09

Please sign in to comment.