Skip to content

Update devfile/api dependency to latest available version #1429

Open
@rohanKanojia

Description

@rohanKanojia

Description

We are using old version of Devfile API at the moment. The latest release at the time of writing is v2.3.0

github.com/devfile/api/v2 v2.2.2

When I was trying to bump the version, I was facing this error:

# sigs.k8s.io/controller-runtime/pkg/cache
../../../../pkg/mod/sigs.k8s.io/[email protected]/pkg/cache/multi_namespace_cache.go:308:9: cannot use handles (variable of type map[string]"k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration) as "k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration value in return statement: map[string]"k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration does not implement "k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration (missing method HasSynced)
../../../../pkg/mod/sigs.k8s.io/[email protected]/pkg/cache/multi_namespace_cache.go:321:9: cannot use handles (variable of type map[string]"k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration) as "k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration value in return statement: map[string]"k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration does not implement "k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration (missing method HasSynced)
../../../../pkg/mod/sigs.k8s.io/[email protected]/pkg/cache/multi_namespace_cache.go:326:17: impossible type assertion: h.(map[string]toolscache.ResourceEventHandlerRegistration)
        map[string]"k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration does not implement "k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration (missing method HasSynced)
make: *** [build/make/deploy.mk:160: run] Error 1

This error message looks related to kubernetes/client-go#1245

in a comment it's suggested to bump controller-runtime to version > 0.15.0

I have created a PR to bump controller-runtime version to v0.18.7 devfile/api#1712

However, bumping controller-runtime to this version is going to bring a lot of breaking changes (see breaking changes mentioned in release note of v0.15.0). I was seeing some of them while trying it out on top of abovementioned PR

pkg/cache/cache.go:58:21: undefined: cache.SelectorsByObject
pkg/cache/cache.go:59:25: missing type in composite literal
pkg/cache/cache.go:62:18: missing type in composite literal
pkg/cache/cache.go:65:19: missing type in composite literal
pkg/cache/cache.go:68:29: missing type in composite literal
pkg/cache/cache.go:71:22: missing type in composite literal
pkg/cache/cache.go:74:28: missing type in composite literal
pkg/cache/cache.go:77:23: missing type in composite literal
pkg/cache/cache.go:80:24: missing type in composite literal
pkg/cache/cache.go:83:21: missing type in composite literal
pkg/cache/cache.go:83:21: too many errors
# github.com/devfile/devworkspace-operator/webhook/workspace/handler
webhook/workspace/handler/deployment.go:29:19: h.Decoder.Decode undefined (type *admission.Decoder is pointer to interface, not interface)
webhook/workspace/handler/handler.go:37:19: h.Decoder.Decode undefined (type *admission.Decoder is pointer to interface, not interface)
webhook/workspace/handler/handler.go:42:18: h.Decoder.DecodeRaw undefined (type *admission.Decoder is pointer to interface, not interface)
webhook/workspace/handler/immutable.go:191:19: h.Decoder.DecodeRaw undefined (type *admission.Decoder is pointer to interface, not interface)
webhook/workspace/handler/immutable.go:193:19: h.Decoder.DecodeRaw undefined (type *admission.Decoder is pointer to interface, not interface)
webhook/workspace/handler/pod.go:29:19: h.Decoder.Decode undefined (type *admission.Decoder is pointer to interface, not interface)
webhook/workspace/handler/template.go:29:19: h.Decoder.Decode undefined (type *admission.Decoder is pointer to interface, not interface)
webhook/workspace/handler/template.go:43:19: h.Decoder.Decode undefined (type *admission.Decoder is pointer to interface, not interface)
webhook/workspace/handler/validate.go:32:19: h.Decoder.Decode undefined (type *admission.Decoder is pointer to interface, not interface)
webhook/workspace/handler/workspace.go:34:19: h.Decoder.Decode undefined (type *admission.Decoder is pointer to interface, not interface)
webhook/workspace/handler/workspace.go:34:19: too many errors
# github.com/devfile/devworkspace-operator/webhook/server
webhook/server/server.go:98:18: cannot use mgr.GetWebhookServer() (value of type webhook.Server) as *webhook.Server value in assignment: webhook.Server does not implement *webhook.Server (type *webhook.Server is pointer to interface, not interface)
webhook/server/server.go:100:16: webhookServer.Port undefined (type *webhook.Server is pointer to interface, not interface)
webhook/server/server.go:101:16: webhookServer.Host undefined (type *webhook.Server is pointer to interface, not interface)
webhook/server/server.go:102:16: webhookServer.CertDir undefined (type *webhook.Server is pointer to interface, not interface)
# github.com/devfile/devworkspace-operator/controllers/cleanupcronjob
controllers/cleanupcronjob/cleanupcronjob_controller.go:126:12: source.Kind (value of type func[object client.Object](cache "sigs.k8s.io/controller-runtime/pkg/cache".Cache, obj object, handler handler.TypedEventHandler[object, reconcile.Request], predicates ...predicate.TypedPredicate[object]) source.TypedSyncingSource[reconcile.Request]) is not a type
controllers/cleanupcronjob/cleanupcronjob_controller.go:127:39: cannot use func(object client.Object) []ctrl.Request {…} (value of type func(object client.Object) []reconcile.Request) as handler.TypedMapFunc[client.Object, reconcile.Request] value in argument to handler.EnqueueRequestsFromMapFunc
# github.com/devfile/devworkspace-operator/pkg/provision/storage
pkg/provision/storage/shared.go:74:15: cannot use corev1.ResourceRequirements{…} (value of type "k8s.io/api/core/v1".ResourceRequirements) as "k8s.io/api/core/v1".VolumeResourceRequirements value in struct literal
make: *** [build/make/deploy.mk:160: run] Error 1

I think we need to spend some time on upgrading this dependency as it's critical component of DevWorkspace Operator.

Acceptance criteria

  • The Devworkspace Operator is updated to use the latest available Devfile API version.
  • Existing functionality remains intact after the API version upgrade.

Metadata

Metadata

Assignees

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