Skip to content

fix: go build failing#2

Open
vadasambar wants to merge 2 commits into
cluster-api-community:mainfrom
vadasambar:fix-go-build
Open

fix: go build failing#2
vadasambar wants to merge 2 commits into
cluster-api-community:mainfrom
vadasambar:fix-go-build

Conversation

@vadasambar
Copy link
Copy Markdown

@vadasambar vadasambar commented Jun 29, 2023

I was trying out the project on my local machine but go build was failing. This PR fixes it.

- go build is still failing but the error is in our code now
- controller-runtime and cluster-api versions were bumped
- new version of controller-runtime has a lot of breaking changes
Comment thread go.mod
k8s.io/klog/v2 v2.90.1
k8s.io/utils v0.0.0-20230209194617-a36077c30491
sigs.k8s.io/cluster-api v1.4.1
sigs.k8s.io/controller-runtime v0.14.5
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would throw the following error
image

Updating controller-runtime to v0.15.0 fixes the above issue but creates another problem. There's a bunch of breaking changes in v0.15.0 which cluster-api has addressed in v1.5.0-beta.0. Any lower version of cluster-api and go build fails.


if err = c.Watch(
&source.Kind{Type: &clusterv1.Cluster{}},
source.Kind(mgr.GetCache(), &clusterv1.Cluster{}),
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source.Kind is a function in v0.15.0 version of controller-runtime.


func (r *KwokControlPlaneReconciler) kwokClusterToKwokControlPlane(ctx context.Context, logger *logr.Logger) handler.MapFunc {
return func(o client.Object) []ctrl.Request {
return func(ctx context.Context, o client.Object) []ctrl.Request {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix syntax error. handler.MapFunc expects first argument to the function to be of type context.Context

// MapFunc is the signature required for enqueueing requests from a generic function.
// This type is usually used with EnqueueRequestsFromMapFunc when registering an event handler.
type MapFunc func(context.Context, client.Object) []reconcile.Request

@vadasambar
Copy link
Copy Markdown
Author

After fixes in this PR
image

@vadasambar vadasambar marked this pull request as ready for review June 29, 2023 06:46
@vadasambar
Copy link
Copy Markdown
Author

@richardcase

Comment thread go.mod
k8s.io/utils v0.0.0-20230209194617-a36077c30491
sigs.k8s.io/cluster-api v1.4.1
sigs.k8s.io/controller-runtime v0.14.5
sigs.k8s.io/cluster-api v1.5.0-beta.0
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only changed

sigs.k8s.io/cluster-api v1.5.0-beta.0
sigs.k8s.io/controller-runtime v0.15.0

Rest of the changes are a result of doing go mod tidy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant