helm: (Bugfix) enable objectlocking (#15524)

This commit is contained in:
reyerdam 2022-08-13 23:54:44 +02:00 committed by GitHub
parent ee2afcf70b
commit 49862ba347
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 10 deletions

View File

@ -65,35 +65,41 @@ createBucket() {
fi
fi
# Create the bucket if it does not exist and set objectlocking if enabled
if ! checkBucketExists $BUCKET ; then
# Create the bucket if it does not exist and set objectlocking if enabled (NOTE: versioning will be not changed if OBJECTLOCKING is set because it enables versioning to the Buckets created)
if ! checkBucketExists $BUCKET ; then
if [ ! -z $OBJECTLOCKING ] ; then
if [ $OBJECTLOCKING = true ] ; then
echo "Creating bucket with OBJECTLOCKING '$BUCKET'"
${MC} mb --with-lock myminio/$BUCKET
elif [ $OBJECTLOCKING = false ] ; then
echo "Creating bucket '$BUCKET'"
${MC} mb myminio/$BUCKET
fi
echo "Creating bucket '$BUCKET'"
${MC} mb myminio/$BUCKET
fi
elif [ -z $OBJECTLOCKING ] ; then
echo "Creating bucket '$BUCKET'"
${MC} mb myminio/$BUCKET
else
echo "Bucket '$BUCKET' already exists."
echo "Bucket '$BUCKET' already exists."
fi
fi
# set versioning for bucket
# set versioning for bucket if objectlocking is disabled or not set
if [ -z $OBJECTLOCKING ] ; then
if [ ! -z $VERSIONING ] ; then
if [ $VERSIONING = true ] && [ $OBJECTLOCKING = false ] ; then
if [ $VERSIONING = true ] ; then
echo "Enabling versioning for '$BUCKET'"
${MC} version enable myminio/$BUCKET
elif [ $VERSIONING = false ] && [ $OBJECTLOCKING = false ] ; then
elif [ $VERSIONING = false ] ; then
echo "Suspending versioning for '$BUCKET'"
${MC} version suspend myminio/$BUCKET
fi
fi
else
echo "Bucket '$BUCKET' versioning unchanged."
fi
# At this point, the bucket should exist, skip checking for existence
# Set policy on the bucket
echo "Setting policy of bucket '$BUCKET' to '$POLICY'."
@ -114,4 +120,4 @@ connectToMinio $scheme
{{- range .Values.buckets }}
createBucket {{ tpl .name $global }} {{ .policy }} {{ .purge }} {{ .versioning }} {{ .objectlocking }}
{{- end }}
{{- end }}
{{- end }}