From: Le Yao Date: Wed, 6 Jan 2021 08:08:03 +0000 (+0000) Subject: Add watch to cnf service controller X-Git-Tag: 21-12-01~19^2 X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=948e5b88fdbf565f2ea4d90c8ac10dafbf07c98e;p=icn%2Fsdwan.git Add watch to cnf service controller Watch the CNF deployment status and sync Signed-off-by: Le Yao Change-Id: I8cb9593e5da54bbd8662ca64ee246c107e3ecd4c --- diff --git a/platform/crd-ctrlr/src/controllers/cnfservice_controller.go b/platform/crd-ctrlr/src/controllers/cnfservice_controller.go index 7047347..8967c95 100644 --- a/platform/crd-ctrlr/src/controllers/cnfservice_controller.go +++ b/platform/crd-ctrlr/src/controllers/cnfservice_controller.go @@ -121,6 +121,12 @@ func (r *CNFServiceReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) func (r *CNFServiceReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&batchv1alpha1.CNFService{}). + Watches( + &source.Kind{Type: &appsv1.Deployment{}}, + &handler.EnqueueRequestsFromMapFunc{ + ToRequests: handler.ToRequestsFunc(GetToRequestsFunc(r, &batchv1alpha1.CNFServiceList{})), + }, + Filter). Watches( &source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestsFromMapFunc{