mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-09 00:09:43 +00:00
Merge pull request #6 from kkb0318/bugfix/s3-us-east-1
fix: #2 us-east-1 support
This commit is contained in:
+14
-6
@@ -122,12 +122,20 @@ func (a *AwsS3Client) PutObjectPublic(ctx context.Context, input ObjectInput) er
|
|||||||
func (a *AwsS3Client) CreateBucketPublic(ctx context.Context) error {
|
func (a *AwsS3Client) CreateBucketPublic(ctx context.Context) error {
|
||||||
log.Printf("creating S3 bucket... Name: %s, Region: %s \n", a.bucketName, a.Region())
|
log.Printf("creating S3 bucket... Name: %s, Region: %s \n", a.bucketName, a.Region())
|
||||||
bucket := aws.String(a.bucketName)
|
bucket := aws.String(a.bucketName)
|
||||||
_, err := a.Client.CreateBucket(ctx, &s3.CreateBucketInput{
|
var input *s3.CreateBucketInput
|
||||||
Bucket: bucket,
|
if a.Region() == "us-east-1" {
|
||||||
CreateBucketConfiguration: &s3types.CreateBucketConfiguration{
|
input = &s3.CreateBucketInput{
|
||||||
LocationConstraint: s3types.BucketLocationConstraint(a.Region()),
|
Bucket: bucket,
|
||||||
},
|
}
|
||||||
})
|
} else {
|
||||||
|
input = &s3.CreateBucketInput{
|
||||||
|
Bucket: bucket,
|
||||||
|
CreateBucketConfiguration: &s3types.CreateBucketConfiguration{
|
||||||
|
LocationConstraint: s3types.BucketLocationConstraint(a.Region()),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_, err := a.Client.CreateBucket(ctx, input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var bucketAlreadyOwnedByYou *s3types.BucketAlreadyOwnedByYou
|
var bucketAlreadyOwnedByYou *s3types.BucketAlreadyOwnedByYou
|
||||||
if errors.As(err, &bucketAlreadyOwnedByYou) {
|
if errors.As(err, &bucketAlreadyOwnedByYou) {
|
||||||
|
|||||||
@@ -88,11 +88,11 @@ func (r *IRSASetupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := r.Get(ctx, req.NamespacedName, &irsav1alpha1.IRSASetup{}); err != nil {
|
if e := r.Get(ctx, req.NamespacedName, &irsav1alpha1.IRSASetup{}); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
statusHandler := handler.NewStatusHandler(kubeClient)
|
statusHandler := handler.NewStatusHandler(kubeClient)
|
||||||
if err := statusHandler.Patch(ctx, obj); err != nil {
|
if e := statusHandler.Patch(ctx, obj); e != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|||||||
Reference in New Issue
Block a user