diff --git a/cmd/vcluster/cmd/root.go b/cmd/vcluster/cmd/root.go index 71e9ca92bd..03b759b6f8 100644 --- a/cmd/vcluster/cmd/root.go +++ b/cmd/vcluster/cmd/root.go @@ -47,7 +47,8 @@ func RunRoot() { // create a new command and execute err = BuildRoot().ExecuteContext(ctx) if err != nil { - klog.Fatal(err) + klog.FromContext(ctx).Error(err, "error") + os.Exit(1) } } diff --git a/hack/load-testing/tests/throughput/throughput.go b/hack/load-testing/tests/throughput/throughput.go index 5b7e623b74..0cb127e182 100644 --- a/hack/load-testing/tests/throughput/throughput.go +++ b/hack/load-testing/tests/throughput/throughput.go @@ -31,7 +31,7 @@ func TestThroughput(ctx context.Context, kubeClient client.Client, namespace str err = kubeClient.Create(ctx, &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ - GenerateName: fmt.Sprintf("secret-test-" + random.String(10) + "-"), + GenerateName: "secret-test-" + random.String(10) + "-", Namespace: namespace, }, Data: map[string][]byte{ diff --git a/pkg/setup/controller_context.go b/pkg/setup/controller_context.go index e612a5d65f..3ec0a213b8 100644 --- a/pkg/setup/controller_context.go +++ b/pkg/setup/controller_context.go @@ -345,7 +345,7 @@ func initControllerContext( return nil, errors.Wrap(err, "get virtual cluster version") } nodes.FakeNodesVersion = virtualClusterVersion.GitVersion - klog.Infof("Can connect to virtual cluster with version " + virtualClusterVersion.GitVersion) + klog.FromContext(ctx).Info("Can connect to virtual cluster", "version", virtualClusterVersion.GitVersion) // create a new current namespace client currentNamespaceClient, err := newCurrentNamespaceClient(ctx, localManager, vClusterOptions) diff --git a/pkg/syncer/syncer.go b/pkg/syncer/syncer.go index 0e80e3af38..1b8d36b310 100644 --- a/pkg/syncer/syncer.go +++ b/pkg/syncer/syncer.go @@ -341,7 +341,7 @@ func (r *SyncController) excludePhysical(ctx *synccontext.SyncContext, pObj, vOb if !excluderOk && vObj != nil { msg := fmt.Sprintf("conflict: cannot sync virtual object %s/%s as unmanaged physical object %s/%s exists with desired name", vObj.GetNamespace(), vObj.GetName(), pObj.GetNamespace(), pObj.GetName()) r.vEventRecorder.Eventf(vObj, "Warning", "SyncError", msg) - return false, fmt.Errorf(msg) + return false, errors.New(msg) } return true, nil