From 670440ee483e97eb67c0575f2a635e8438d743ce Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Tue, 21 Nov 2023 17:18:24 +0100 Subject: [PATCH] Set User Agent for test extension correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Büringer buringerst@vmware.com --- test/extension/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/extension/main.go b/test/extension/main.go index 9d64f9711113..ebe31d49c1b3 100644 --- a/test/extension/main.go +++ b/test/extension/main.go @@ -38,6 +38,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1" + "sigs.k8s.io/cluster-api/controllers/remote" controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1" runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog" runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" @@ -55,7 +56,8 @@ var ( // scheme is a Kubernetes runtime scheme containing all the information about API types used by the test extension. // NOTE: it is not mandatory to use scheme in custom RuntimeExtension, but working with typed API objects makes code // easier to read and less error prone than using unstructured or working with raw json/yaml. - scheme = runtime.NewScheme() + scheme = runtime.NewScheme() + controllerName = "cluster-api-test-extension-manager" // Flags. profilerAddress string @@ -197,6 +199,7 @@ func main() { setupLog.Error(err, "error getting config for the cluster") os.Exit(1) } + restConfig.UserAgent = remote.DefaultClusterAPIUserAgent(controllerName) client, err := client.New(restConfig, client.Options{}) if err != nil {