Skip to content

Commit db3dfd0

Browse files
author
Nissan Pow
committed
fix: add minio-create-bucket local_resource to ensure bucket exists on restart
minio-post-job is a k8s Job that only runs once at install time — on minio pod restarts the bucket is lost (no persistence) but the Job stays Complete and never re-runs. Add an idempotent local_resource that creates the bucket on every tilt up.
1 parent 776ed2c commit db3dfd0

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

devtools/tilt/minio.tiltfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ def setup_minio(ctx):
3434

3535
k8s_resource("minio-post-job", labels=['minio'])
3636

37+
local_resource(
38+
name="minio-create-bucket",
39+
cmd=(
40+
"python -c \"" +
41+
"import boto3, botocore;" +
42+
"s3=boto3.client('s3',endpoint_url='http://localhost:9000'," +
43+
"aws_access_key_id='rootuser',aws_secret_access_key='rootpass123');" +
44+
"s3.create_bucket(Bucket='metaflow-test') " +
45+
"if 'metaflow-test' not in [b['Name'] for b in s3.list_buckets()['Buckets']] " +
46+
"else print('bucket already exists')" +
47+
"\""
48+
),
49+
resource_deps=["minio"],
50+
labels=["minio"],
51+
)
52+
3753
k8s_yaml(read_file('./tilt/k8s/minio-secret.yaml'))
3854

3955
return new_result(

0 commit comments

Comments
 (0)