Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨Fleet example changes #1

Merged
merged 5 commits into from
May 28, 2024

Conversation

ivanape
Copy link

@ivanape ivanape commented May 24, 2024

Hi @sttts,

First at all, let me please put some context about this PR.

Starting from the (amazing!!!) changes of your PR, my goal was to create an operator that watch the changes at many clusters. I was able to create the POC, but I have to add some small changes reflected in this PR.

  1. manager/internal.go file (in fact, the only real change 😄).

During my tests I was not able to engage a new cluster as the code was always hung at line 627: cm.engagedClustersLock.Lock(), as the lock was never RUnlock(ed).

  1. Small changes (I think are necessaries) for running the fleet test.

If this changes make sense for you, feel free to merge this PR or add them directly in your branch.

Note: I also try to run make test to validate these code changes, but I have some compiler errors.

pkg/builder/controller.go:1: : # sigs.k8s.io/controller-runtime/pkg/builder [sigs.k8s.io/controller-runtime/pkg/builder.test]
pkg/builder/controller_test.go:571:30: undefined: cluster.WatchEvent
pkg/builder/controller_test.go:844:21: undefined: cluster.WatchEvent
pkg/builder/controller_test.go:855:67: undefined: cluster.Watcher
pkg/builder/controller_test.go:860:18: undefined: cluster.WatchEvent
pkg/builder/controller_test.go:866:58: undefined: cluster.WatchEvent (typecheck)
....

I have not found any reference in the code to cluster.WatchEvent. If you could provide to me some context about this error, I will be happy to review it.

Regards,

Iván

Signed-off-by: Iván Álvarez <ivanape@inditex.com>
return nil
}
cm.engagedClustersLock.RUnlock()
Copy link
Owner

Choose a reason for hiding this comment

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

great find! but don't we need both? RUnlock on return, and RUnlock for the else case?

Copy link
Author

Choose a reason for hiding this comment

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

Yes! I missed that. I have also update the fleet example with the same error here.


// Retrieve the pod from the cluster.
pod := &corev1.Pod{}
if err := client.Get(ctx, req.NamespacedName, pod); err != nil {
return reconcile.Result{}, err
}
log.Info("Reconciling pod", "name", pod.Name, "uuid", pod.UID)
log.Info(fmt.Sprintf("Retrieved pod %s:>%s/%s", cl.Name(), pod.Namespace, pod.Name))
Copy link
Owner

Choose a reason for hiding this comment

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

this is an anti-pattern for structural logging. Just add "ns", pod.Namespace.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed :)

examples/fleet/main.go Outdated Show resolved Hide resolved
ivanape and others added 4 commits May 27, 2024 08:33
Co-authored-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
Signed-off-by: Iván Álvarez <ivanape@inditex.com>
Signed-off-by: Iván Álvarez <ivanape@inditex.com>
@ivanape ivanape requested a review from sttts May 27, 2024 07:00
@sttts
Copy link
Owner

sttts commented May 28, 2024

Perfect. Merging.

Btw, I want to come back to the PR and the design proposal soonish. Thanks for trying it out!

@sttts sttts merged commit d51d3e4 into sttts:sttts-cluster-support May 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants