add UserAgent = kruise-rollout (#64)

Signed-off-by: mingzhou.swx <mingzhou.swx@alibaba-inc.com>

Co-authored-by: mingzhou.swx <mingzhou.swx@alibaba-inc.com>
This commit is contained in:
Wei-Xiang Sun 2022-08-09 19:35:04 +08:00 committed by GitHub
parent 53a746ace6
commit c322b09f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -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,

View File

@ -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 {