seems .For is diff from .Watch
@@ -23,6 +23,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/handler"
+ "sigs.k8s.io/controller-runtime/pkg/source"
"strconv"
"time"
@@ -53,10 +55,10 @@ func NewKalmNSReconciler(mgr ctrl.Manager) *KalmNSReconciler {
func (r *KalmNSReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&v1.Namespace{}).
- For(&v1alpha1.HttpsCertIssuer{}).
- For(&v1alpha1.HttpsCert{}).
- //Watches(&source.Kind{Type: &v1alpha1.HttpsCertIssuer{}}, &handler.EnqueueRequestForObject{}).
- //Watches(&source.Kind{Type: &v1alpha1.HttpsCert{}}, &handler.EnqueueRequestForObject{}).
+ //For(&v1alpha1.HttpsCertIssuer{}).
+ //For(&v1alpha1.HttpsCert{}).
+ Watches(&source.Kind{Type: &v1alpha1.HttpsCertIssuer{}}, &handler.EnqueueRequestForObject{}).
+ Watches(&source.Kind{Type: &v1alpha1.HttpsCert{}}, &handler.EnqueueRequestForObject{}).
//Owns(&v1alpha1.HttpsCert{}).
Complete(r)
}
