Skip to content

Commit

Permalink
fix(provisioners): small s3 reliability improvements (#215)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Meier <ben.meier@humanitec.com>
  • Loading branch information
astromechza authored Nov 22, 2024
1 parent 2397ef8 commit f0cdf00
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/command/default.provisioners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
randomServiceName: minio-{{ randAlphaNum 6 }}
randomUsername: user-{{ randAlpha 8 }}
randomPassword: {{ randAlphaNum 16 | quote }}
randomBucket: bucket-{{ randAlpha 8 | lower }}-{{ .Id | lower | trunc 47 }}
randomBucket: bucket-{{ randAlpha 8 | lower }}
randomAccessKeyId: {{ randAlphaNum 20 | quote }}
randomSecretKey: {{ randAlphaNum 40 | quote }}
sk: default-provisioners-minio-instance
Expand All @@ -225,15 +225,17 @@
secret_key: {{ dig .Init.sk "instanceSecretKey" "" .Shared | quote }}
endpoint: http://{{ dig .Init.sk "instanceServiceName" "" .Shared }}:9000
# for compatibility with Humanitec's existing s3 resource
region: ""
region: "us-east-1"
aws_access_key_id: {{ dig .Init.sk "instanceAccessKeyId" "" .Shared | quote }}
aws_secret_key: {{ dig .Init.sk "instanceSecretKey" "" .Shared | quote }}
# we store 2 files, 1 is always the same and overridden, the other is per bucket
files: |
{{ dig .Init.sk "instanceServiceName" "" .Shared }}-setup-scripts/00-svcacct.sh: |
set -eu
mc alias set myminio http://{{ dig .Init.sk "instanceServiceName" "" .Shared }}:9000 {{ dig .Init.sk "instanceUsername" "" .Shared }} {{ dig .Init.sk "instancePassword" "" .Shared }}
mc admin user svcacct info myminio {{ dig .Init.sk "instanceAccessKeyId" "" .Shared | quote }} || mc admin user svcacct add myminio {{ dig .Init.sk "instanceUsername" "" .Shared | quote }} --access-key {{ dig .Init.sk "instanceAccessKeyId" "" .Shared | quote }} --secret-key {{ dig .Init.sk "instanceSecretKey" "" .Shared | quote }}
{{ dig .Init.sk "instanceServiceName" "" .Shared }}-setup-scripts/10-bucket-{{ .State.bucket }}.sh: |
set -eu
mc alias set myminio http://{{ dig .Init.sk "instanceServiceName" "" .Shared }}:9000 {{ dig .Init.sk "instanceUsername" "" .Shared }} {{ dig .Init.sk "instancePassword" "" .Shared }}
mc mb -p myminio/{{ .State.bucket }}
volumes: |
Expand Down Expand Up @@ -264,7 +266,7 @@
target: /data
{{ dig .Init.sk "instanceServiceName" "" .Shared }}-init:
image: quay.io/minio/minio
entrypoint: ["/bin/sh"]
entrypoint: ["/bin/bash"]
command:
- "-c"
- "for s in $$(ls /setup-scripts -1); do sh /setup-scripts/$$s; done"
Expand Down

0 comments on commit f0cdf00

Please sign in to comment.