Open
Description
Expected Behaviour
Kratos controller-runtime consumer should watch both scalingv1alpha1.Kratos
and corev1.ConfigMap
resources for kratos spec.
Actual Behaviour
Kratos controller-runtime consumer calls [.For(scalingv1alpha1.Kratos).For(corev1.ConfigMap](https://github.com/adobe/kratos/blob/master/controllers/kratos_controller.go#L89-L90))
, then scalingv1alpha1.Kratos
is silently lost in favour of ConfigMap
. with controller-runtime < 0.7.0
or raises an error for newer versions.
Reproduce Scenario (including but not limited to)
- Please see (#1173)
- An error is added for this behavior with (#1176)
- As a workaround, to watch multiple apiTypes consumer can use .Watches() or . Owns() instead, alternatively limit the use of
For
to one apiType.
Steps to Reproduce
- Run Kratos operator against latest kind cluster
Platform and Version
- controller-runtime v0.9.2
- kind version 0.11.1
Sample Code that illustrates the problem
https://github.com/adobe/kratos/blob/master/controllers/kratos_controller.go#L89-L90
func (r *KratosReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&scalingv1alpha1.Kratos{}).
For(&corev1.ConfigMap{}).
Complete(r)
}
Logs taken while reproducing problem
ERROR setup unable to setup controller with manager {"controller": "Kratos", "error": "For(...) should only be called once, could not assign multiple objects for reconciliation"}
Metadata
Assignees
Labels
No labels
Activity