Skip to content

Commit 45c1876

Browse files
committed
capi/aws: move ignition s3 bucket name to a function
This way we make sure that all places that rely on the name are in sync.
1 parent fc9259e commit 45c1876

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pkg/asset/manifests/aws/cluster.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func GenerateClusterAssets(ic *installconfig.InstallConfig, clusterID *installco
151151
},
152152
},
153153
S3Bucket: &capa.S3Bucket{
154-
Name: fmt.Sprintf("openshift-bootstrap-data-%s", clusterID.InfraID),
154+
Name: GetIgnitionBucketName(clusterID.InfraID),
155155
PresignedURLDuration: &metav1.Duration{Duration: 1 * time.Hour},
156156
BestEffortDeleteObjects: ptr.To(ic.Config.AWS.BestEffortDeleteIgnition),
157157
},
@@ -265,3 +265,8 @@ func GenerateClusterAssets(ic *installconfig.InstallConfig, clusterID *installco
265265
},
266266
}, nil
267267
}
268+
269+
// GetIgnitionBucketName returns the name of the bucket for the given cluster.
270+
func GetIgnitionBucketName(infraID string) string {
271+
return fmt.Sprintf("openshift-bootstrap-data-%s", infraID)
272+
}

pkg/infrastructure/aws/clusterapi/aws.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ func (p *Provider) PostDestroy(ctx context.Context, in clusterapi.PostDestroyerI
322322
return fmt.Errorf("failed to create aws session: %w", err)
323323
}
324324

325-
bucketName := fmt.Sprintf("openshift-bootstrap-data-%s", in.Metadata.InfraID)
325+
bucketName := awsmanifest.GetIgnitionBucketName(in.Metadata.InfraID)
326326
if err := removeS3Bucket(ctx, session, bucketName); err != nil {
327327
if p.bestEffortDeleteIgnition {
328328
logrus.Warnf("failed to delete ignition bucket %s: %v", bucketName, err)

0 commit comments

Comments
 (0)