@@ -43,6 +43,13 @@ type Client struct {
4343 stsClient * sts.Client
4444}
4545
46+ type BucketType string
47+
48+ const (
49+ BucketTypeStateStore BucketType = "state"
50+ BucketTypeDiscoveryStore BucketType = "discovery"
51+ )
52+
4653// NewAWSClient returns a new instance of awsClient configured to work in the default region (us-east-2).
4754func NewClient (ctx context.Context ) (* Client , error ) {
4855 cfg , err := awsconfig .LoadDefaultConfig (ctx ,
@@ -58,7 +65,7 @@ func NewClient(ctx context.Context) (*Client, error) {
5865}
5966
6067// BucketName constructs an unique bucket name using the AWS account ID in the default region (us-east-2).
61- func (c Client ) BucketName (ctx context.Context ) (string , error ) {
68+ func (c Client ) BucketName (ctx context.Context , bucketType BucketType ) (string , error ) {
6269 // Construct the bucket name based on the ProwJob ID (if running in Prow) or AWS account ID (if running outside
6370 // Prow) and the current timestamp
6471 var identifier string
@@ -72,7 +79,7 @@ func (c Client) BucketName(ctx context.Context) (string, error) {
7279 identifier = * callerIdentity .Account
7380 }
7481 timestamp := time .Now ().Format ("20060102150405" )
75- bucket := fmt .Sprintf ("k8s-infra-kops-%s-%s" , identifier , timestamp )
82+ bucket := fmt .Sprintf ("k8s-infra-kops-%s-%s-%s" , bucketType , identifier , timestamp )
7683
7784 bucket = strings .ToLower (bucket )
7885 // Only allow lowercase letters, numbers, and hyphens
@@ -120,6 +127,8 @@ func (c Client) EnsureS3Bucket(ctx context.Context, bucketName string, publicRea
120127 klog .Infof ("Bucket %s created successfully" , bucketName )
121128
122129 if publicRead {
130+ fmt .Println ("WAITING 5 MINUTES !!! " )
131+ time .Sleep (5 * time .Minute )
123132 err = c .setPublicReadPolicy (ctx , bucketName )
124133 if err != nil {
125134 klog .Errorf ("Failed to set public read policy on bucket %s, err: %v" , bucketName , err )
0 commit comments