@@ -11,6 +11,8 @@ import (
1111 "github.com/linode/linodego"
1212 "k8s.io/apimachinery/pkg/util/validation/field"
1313
14+ "github.com/linode/cluster-api-provider-linode/observability/wrappers/linodeclient"
15+
1416 . "github.com/linode/cluster-api-provider-linode/clients"
1517)
1618
@@ -21,12 +23,19 @@ const (
2123 defaultClientTimeout = time .Second * 10
2224)
2325
26+ func mkptr [T any ](v T ) * T {
27+ return & v
28+ }
29+
2430var (
2531 // defaultLinodeClient is an unauthenticated Linode client
26- defaultLinodeClient = linodego .NewClient (& http.Client {Timeout : defaultClientTimeout })
32+ defaultLinodeClient = linodeclient .NewLinodeClientWithTracing (
33+ mkptr (linodego .NewClient (& http.Client {Timeout : defaultClientTimeout })),
34+ )
2735)
2836
2937func validateRegion (ctx context.Context , client LinodeClient , id string , path * field.Path , capabilities ... string ) * field.Error {
38+ // TODO: instrument with tracing, might need refactor to preserve readibility
3039 region , err := client .GetRegion (ctx , id )
3140 if err != nil {
3241 return field .NotFound (path , id )
@@ -42,6 +51,7 @@ func validateRegion(ctx context.Context, client LinodeClient, id string, path *f
4251}
4352
4453func validateLinodeType (ctx context.Context , client LinodeClient , id string , path * field.Path ) (* linodego.LinodeType , * field.Error ) {
54+ // TODO: instrument with tracing, might need refactor to preserve readibility
4555 plan , err := client .GetType (ctx , id )
4656 if err != nil {
4757 return nil , field .NotFound (path , id )
@@ -61,6 +71,7 @@ func validateLinodeType(ctx context.Context, client LinodeClient, id string, pat
6171// [Clusters List]: https://www.linode.com/docs/api/object-storage/#clusters-list
6272// [Cluster View]: https://www.linode.com/docs/api/object-storage/#cluster-view
6373func validateObjectStorageCluster (ctx context.Context , client LinodeClient , id string , path * field.Path ) * field.Error {
74+ // TODO: instrument with tracing, might need refactor to preserve readibility
6475 //nolint:gocritic // prefer no escapes
6576 cexp := regexp .MustCompile ("^(([[:lower:]]+-)*[[:lower:]]+)-[[:digit:]]+$" )
6677 if ! cexp .MatchString (id ) {
0 commit comments