Skip to content

[Request] how to upgrade controller-runtime from v0.12.1 to v.19.2 #3455

@DengHom

Description

@DengHom

Problems:
I have upgraded controller-runtime pkg to v0.19.2 and changed some codes to satisfy the version:

if err := c.Watch(source.Kind(mgr.GetCache(),
		&appv1.Deployment{},
		handler.EnqueueRequestForObject{},
		predicate.Funcs{CreateFunc: r.onOwnerCreateFunc(), DeleteFunc: r.onOwnerDeleteFunc()},
	)); err != nil {
		return err
	}

	return c.Watch(source.Kind(mgr.GetCache(), &corev1.Pod{}, handler.EnqueueRequestsFromMapFunc(func(object client.Object) []reconcile.Request {
		deployPod := false
		for _, owner := range object.GetOwnerReferences() {
			if owner.Controller != nil && *owner.Controller && owner.Kind == "ReplicaSet" {
				deployPod = true
				break
			}
		}
		if !deployPod {
			return nil
		}
		return []reconcile.Request{
			{NamespacedName: types.NamespacedName{
				Name:      object.GetLabels()[deployLabelKey],
				Namespace: object.GetNamespace(),
			}},
		}
	})))

I get many error tips like this:

Image Image

errors:

handler.EnqueueRequestForObject:
Type does not implement handler.TypedEventHandler[object, reconcile.Request] as the Create method has a pointer receiver

predicate.Funcs:
Type does not implement predicate.TypedPredicate[object] need the method: Create(event.TypedCreateEvent[object]) bool have the method: Create(e event.TypedCreateEvent[object]) bool

 handler.EnqueueRequestsFromMapFunc:
Type does not implement handler.TypedEventHandler[object, reconcile.Request] as some methods are missing: Create(context.Context, event.TypedCreateEvent[object], workqueue.TypedRateLimitingInterface[request])

go mod details

	github.com/agiledragon/gomonkey/v2 v2.8.0
	github.com/go-logr/logr v1.4.2
	github.com/kubeflow/common v0.4.3
	github.com/kubeflow/training-operator v1.5.0
	github.com/smartystreets/goconvey v1.6.4
	github.com/stretchr/testify v1.10.0
	github.com/vllm-project/aibrix v0.5.0
	golang.org/x/time v0.6.0
	k8s.io/api v0.31.8
	k8s.io/apimachinery v0.31.8
	k8s.io/client-go v0.31.8
	sigs.k8s.io/controller-runtime v0.19.2
	volcano.sh/apis v1.11.2

Need Help to tell me what should I do to upgrade controller-runtime to v0.19.2 smoothly !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions