@@ -21,7 +21,6 @@ import (
2121 "fmt"
2222 "net/http"
2323 "os"
24- "regexp"
2524 "slices"
2625 "time"
2726
@@ -80,34 +79,6 @@ func validateLinodeType(ctx context.Context, linodegoclient clients.LinodeClient
8079 return plan , nil
8180}
8281
83- // validateObjectStorageRegion validates an Object Storage deployment's region ID via the following rules:
84- // - The Region ID is in the form: REGION_ID.
85- // - The region has Object Storage support.
86- //
87- // NOTE: This implementation intended to bypass the authentication requirement for the [Clusters List] and [Cluster
88- // View] endpoints in the Linode API, thereby reusing a [github.com/linode/linodego.Client] (and its caching if enabled)
89- // across many admission requests.
90- //
91- // [Clusters List]: https://www.linode.com/docs/api/object-storage/#clusters-list
92- // [Cluster View]: https://www.linode.com/docs/api/object-storage/#cluster-view
93-
94- func validateObjectStorageRegion (ctx context.Context , linodegoclient clients.LinodeClient , id string , path * field.Path ) * field.Error {
95- // TODO: instrument with tracing, might need refactor to preserve readibility
96-
97- cexp := regexp .MustCompile ("^(([[:lower:]]+-)*[[:lower:]]+)$" )
98- cexp1 := regexp .MustCompile (`^(([[:lower:]]+-)*[[:lower:]]+)-\d+$` )
99- if ! cexp .MatchString (id ) && ! cexp1 .MatchString (id ) {
100- return field .Invalid (path , id , "must be in form: region_id or region_id-ordinal" )
101- }
102- var region string
103- if cexp .FindStringSubmatch (id ) != nil {
104- region = cexp .FindStringSubmatch (id )[0 ]
105- } else {
106- region = cexp1 .FindStringSubmatch (id )[1 ]
107- }
108- return validateRegion (ctx , linodegoclient , region , path , linodego .CapabilityObjectStorage )
109- }
110-
11182func getCredentialDataFromRef (ctx context.Context , crClient clients.K8sClient , credentialsRef corev1.SecretReference , defaultNamespace string ) ([]byte , error ) {
11283 credSecret , err := getCredentials (ctx , crClient , credentialsRef , defaultNamespace )
11384 if err != nil {
0 commit comments