-
Notifications
You must be signed in to change notification settings - Fork 42
SANDBOX-955: update kube & openshift dependencies to 4.18 #665
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
SANDBOX-955: update kube & openshift dependencies to 4.18 #665
Conversation
cmd/main.go
Outdated
@@ -178,6 +180,9 @@ func main() { | |||
// disable caching of Node metrics in the client to avoid getting the following error every second | |||
// "failed to watch *v1beta1.NodeMetrics: the server does not allow this method on the requested resource (get nodes.metrics.k8s.io)" | |||
Client: client.Options{Cache: &client.CacheOptions{DisableFor: []client.Object{&kmetrics.NodeMetrics{}}}}, | |||
Controller: ctrlconfig.Controller{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to this change in sigs.k8s.io/controller-runtime
(introduced in v0.19.0), we need to skip the name validation to avoid this error:
{"level":"error","ts":"2025-04-22T10:46:41.577Z","logger":"setup","msg":"unable to create controller","controller":"ToolchainCluster","error":"controller with name toolchaincluster already exists. Controller names must be unique to avoid multiple controllers reporting to the same metric","stacktrace":"main.main\n\t/Users/rsoaresd/member-operator/cmd/main.go:245\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity, is there a way to configure the controller name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found it - there is Named
function in the controller builder. We could do something like this instead
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
Named("ToolchainClusterCache").
...
and the same for other duplicated controllers too - that should be pretty simple change, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried changing in controllers/idler/idler_controller.go
:
// SetupWithManager sets up the controller with the Manager.
func (r *Reconciler) SetupWithManager(mgr manager.Manager, allNamespaceCluster runtimeCluster.Cluster) error {
return ctrl.NewControllerManagedBy(mgr).
Named("ToolchainClusterCache").
For(&toolchainv1alpha1.Idler{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
WatchesRawSource(source.Kind(allNamespaceCluster.GetCache(), &corev1.Pod{},
handler.TypedEnqueueRequestsFromMapFunc(MapPodToIdler), PodIdlerPredicate{})).
Complete(r)
}
But it reports:
{"level":"error","ts":"2025-04-23T13:25:23.269Z","logger":"setup","msg":"unable to create controller","controller":"ToolchainCluster","error":"controller with name toolchaincluster already exists. Controller names must be unique to avoid multiple controllers reporting to the same metric","stacktrace":"main.main\n\t/Users/rsoaresd/member-operator/cmd/main.go:245\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you should update the toolchaincluster_cache_controller.go
in toolchain-common. The idler controller doesn't watch ToolchainCluster
CRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much, addressed it! codeready-toolchain/toolchain-common@9d0638b
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #665 +/- ##
=======================================
Coverage 81.09% 81.09%
=======================================
Files 46 46
Lines 4506 4506
=======================================
Hits 3654 3654
Misses 690 690
Partials 162 162
🚀 New features to boost your workflow:
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alexeykazakov, MatousJobanek, rsoaresd The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Description
Update dependencies
Issue ticket number and link
SANDBOX-955