Skip to content

Commit 6e5d950

Browse files
authored
Merge pull request #9751 from k8s-infra-cherrypick-robot/cherry-pick-9748-to-release-1.4
[release-1.4] 🐛 Set User Agent for test extension correctly
2 parents 3fac15b + 8b4d10d commit 6e5d950

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/extension/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838
"sigs.k8s.io/controller-runtime/pkg/client"
3939

4040
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
41+
"sigs.k8s.io/cluster-api/controllers/remote"
4142
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"
4243
runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog"
4344
runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1"
@@ -55,7 +56,8 @@ var (
5556
// scheme is a Kubernetes runtime scheme containing all the information about API types used by the test extension.
5657
// NOTE: it is not mandatory to use scheme in custom RuntimeExtension, but working with typed API objects makes code
5758
// easier to read and less error prone than using unstructured or working with raw json/yaml.
58-
scheme = runtime.NewScheme()
59+
scheme = runtime.NewScheme()
60+
controllerName = "cluster-api-test-extension-manager"
5961

6062
// Flags.
6163
profilerAddress string
@@ -196,6 +198,7 @@ func main() {
196198
setupLog.Error(err, "error getting config for the cluster")
197199
os.Exit(1)
198200
}
201+
restConfig.UserAgent = remote.DefaultClusterAPIUserAgent(controllerName)
199202

200203
client, err := client.New(restConfig, client.Options{})
201204
if err != nil {

0 commit comments

Comments
 (0)