From 2fd1d3f89918bcce18c32dde25b25d224866682a Mon Sep 17 00:00:00 2001 From: "mingzhou.swx" Date: Tue, 9 Aug 2022 17:15:27 +0800 Subject: [PATCH] add UserAgent = kruise-rollout Signed-off-by: mingzhou.swx --- main.go | 7 +++++-- .../batchrelease/batchrelease_special_cases_handler.go | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index daa5439e..85a720c8 100644 --- a/main.go +++ b/main.go @@ -70,14 +70,17 @@ func main() { flag.Parse() ctrl.SetLogger(klogr.New()) + cfg := ctrl.GetConfigOrDie() + cfg.UserAgent = "kruise-rollout" + setupLog.Info("new clientset registry") - err := utilclient.NewRegistry(ctrl.GetConfigOrDie()) + err := utilclient.NewRegistry(cfg) if err != nil { setupLog.Error(err, "unable to init clientset and informer") os.Exit(1) } - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ + mgr, err := ctrl.NewManager(cfg, ctrl.Options{ Scheme: scheme, MetricsBindAddress: metricsAddr, Port: 9443, diff --git a/pkg/controller/batchrelease/batchrelease_special_cases_handler.go b/pkg/controller/batchrelease/batchrelease_special_cases_handler.go index 07fc71f8..99b7b107 100644 --- a/pkg/controller/batchrelease/batchrelease_special_cases_handler.go +++ b/pkg/controller/batchrelease/batchrelease_special_cases_handler.go @@ -191,11 +191,11 @@ func isGetWorkloadInfoError(err error) bool { } func isWorkloadLocated(err error, release *v1alpha1.BatchRelease) bool { - return err == nil && release.Status.Phase == v1alpha1.RolloutPhaseInitial + return err == nil && (release.Status.Phase == v1alpha1.RolloutPhaseInitial || release.Status.Phase == "") } func isWorkloadGone(event workloads.WorkloadEventType, release *v1alpha1.BatchRelease) bool { - return event == workloads.WorkloadHasGone && release.Status.Phase != v1alpha1.RolloutPhaseInitial + return event == workloads.WorkloadHasGone && release.Status.Phase != v1alpha1.RolloutPhaseInitial && release.Status.Phase != "" } func isWorkloadScaling(event workloads.WorkloadEventType, release *v1alpha1.BatchRelease) bool {