Skip to content

Commit 269ff68

Browse files
committed
** Update the gcp cluster api reference to bucket creation that takes away the need for a client context.
1 parent b00ba43 commit 269ff68

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pkg/infrastructure/gcp/clusterapi/clusterapi.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"path"
88
"strings"
9-
"time"
109

1110
"github.com/sirupsen/logrus"
1211
capg "sigs.k8s.io/cluster-api-provider-gcp/api/v1beta1"
@@ -100,15 +99,13 @@ func (p Provider) PreProvision(ctx context.Context, in clusterapi.PreProvisionIn
10099
func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]byte, error) {
101100
// Create the bucket and presigned url. The url is generated using a known/expected name so that the
102101
// url can be retrieved from the api by this name.
103-
ctx, cancel := context.WithTimeout(ctx, time.Minute*2)
104-
defer cancel()
105-
106102
bucketName := gcp.GetBootstrapStorageName(in.InfraID)
107-
bucketHandle, err := gcp.CreateBucketHandle(ctx, bucketName)
103+
storageClient, err := gcp.NewStorageClient(ctx)
108104
if err != nil {
109-
return nil, fmt.Errorf("failed to create bucket handle %s: %w", bucketName, err)
105+
return nil, fmt.Errorf("failed to create storage client: %w", err)
110106
}
111107

108+
bucketHandle := storageClient.Bucket(bucketName)
112109
if err := gcp.CreateStorage(ctx, in.InstallConfig, bucketHandle, in.InfraID); err != nil {
113110
return nil, fmt.Errorf("failed to create bucket %s: %w", bucketName, err)
114111
}

0 commit comments

Comments
 (0)