Merge "Helm-toolkit: Check radosgw endpoint scheme for bucket creation"

This commit is contained in:
Zuul 2019-01-13 01:17:21 +00:00 committed by Gerrit Code Review
commit 898752bdb1
2 changed files with 12 additions and 2 deletions

View File

@ -68,6 +68,8 @@ spec:
value: {{ $s3Bucket }}
- name: RGW_HOST
value: {{ tuple "ceph_object_store" "internal" "api" $envAll | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" }}
- name: RGW_PROTO
value: {{ tuple "ceph_object_store" "internal" "api" $envAll | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" }}
volumeMounts:
- name: s3-bucket-sh
mountPath: /tmp/create-s3-bucket.sh

View File

@ -19,7 +19,11 @@ limitations under the License.
function create_rgw_s3_bucket ()
{
create_bucket=$(s3cmd mb s3://$S3_BUCKET --host=$RGW_HOST --access_key=$S3_ADMIN_ACCESS_KEY --secret_key=$S3_ADMIN_SECRET_KEY --no-encrypt --no-check-certificate)
if [ "$RGW_PROTO" = "http" ]; then
create_bucket=$(s3cmd mb s3://$S3_BUCKET --host=$RGW_HOST --access_key=$S3_ADMIN_ACCESS_KEY --secret_key=$S3_ADMIN_SECRET_KEY --no-encrypt --no-check-certificate --no-ssl)
else
create_bucket=$(s3cmd mb s3://$S3_BUCKET --host=$RGW_HOST --access_key=$S3_ADMIN_ACCESS_KEY --secret_key=$S3_ADMIN_SECRET_KEY --no-encrypt --no-check-certificate)
fi
if [ $? -eq 0 ]; then
echo "Bucket $S3_BUCKET created"
else
@ -30,7 +34,11 @@ function create_rgw_s3_bucket ()
function modify_bucket_acl ()
{
modify_acl=$(s3cmd setacl s3://$S3_BUCKET --host=$RGW_HOST --access_key=$S3_ADMIN_ACCESS_KEY --secret_key=$S3_ADMIN_SECRET_KEY --no-encrypt --no-check-certificate --acl-grant=read:$S3_USERNAME --acl-grant=write:$S3_USERNAME)
if [ "$RGW_PROTO" = "http" ]; then
modify_acl=$(s3cmd setacl s3://$S3_BUCKET --host=$RGW_HOST --access_key=$S3_ADMIN_ACCESS_KEY --secret_key=$S3_ADMIN_SECRET_KEY --no-encrypt --no-check-certificate --no-ssl --acl-grant=read:$S3_USERNAME --acl-grant=write:$S3_USERNAME)
else
modify_acl=$(s3cmd setacl s3://$S3_BUCKET --host=$RGW_HOST --access_key=$S3_ADMIN_ACCESS_KEY --secret_key=$S3_ADMIN_SECRET_KEY --no-encrypt --no-check-certificate --acl-grant=read:$S3_USERNAME --acl-grant=write:$S3_USERNAME)
fi
if [ $? -eq 0 ]; then
echo "Bucket $S3_BUCKET ACL updated"
else