Skip to content

Commit 493263e

Browse files
ixxeL2097Frederic Spiersgithub-actions[bot]
committed
[minio] add post job to auto create default buckets (#9)
* [minio] add post job to auto create default buckets * Update CHANGELOG.md Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * [minio] using better script for auto bucket * Update CHANGELOG.md Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * [minio] using better script for auto bucket * Update CHANGELOG.md Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> --------- Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frederic Spiers <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 27d0ff5 commit 493263e

File tree

6 files changed

+241
-54
lines changed

6 files changed

+241
-54
lines changed

.github/workflows/pull-request.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ jobs:
195195
helm package . --app-version=${APP_VERSION} --version=${CHART_VERSION}
196196
197197
# Push to GHCR
198-
echo "Pushing Helm chart $CHART_NAME-$CHART_VERSION.tgz to oci://ttl.sh/${{ github.event.repository.name }}/helm"
199-
if helm push ./$CHART_NAME-$CHART_VERSION.tgz oci://ttl.sh/${{ github.event.repository.name }}/helm; then
198+
echo "Pushing Helm chart $CHART_NAME-$CHART_VERSION.tgz to oci://ttl.sh/${{ github.event.repository.name }}"
199+
if helm push ./$CHART_NAME-$CHART_VERSION.tgz oci://ttl.sh/${{ github.event.repository.name }}; then
200200
echo "Successfully released $CHART_NAME-$CHART_VERSION to ttl.sh"
201201
else
202202
echo "Failed to push $CHART_NAME-$CHART_VERSION to ttl.sh"

charts/minio/CHANGELOG.md

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
11
# Changelog
22

3-
## 0.2.5 (2025-10-01)
3+
## 0.4.0 (2025-10-06)
44

5-
* test(trigger): ci test for ttl publish ([#2](https://github.com/GitGuardian/gitguardian-helm/pull/2))
5+
* [minio] add post job to auto create default buckets ([#9](https://github.com/GitGuardian/gitguardian-helm-charts/pull/9))
66

77
## <small>0.2.4 (2025-09-30)</small>
88

9-
* add more configuration options for the minio server (#189) ([8066d07](https://github.com/GitGuardian/gitguardian-helm/commit/8066d07)), closes [#189](https://github.com/GitGuardian/gitguardian-helm/issues/189)
10-
* add option to use cpu-v1 image ([91bfd29](https://github.com/GitGuardian/gitguardian-helm/commit/91bfd29))
11-
* bump verion to 0.2.3 ([af6beca](https://github.com/GitGuardian/gitguardian-helm/commit/af6beca))
12-
* bump version to 0.2.2 ([afaf2d1](https://github.com/GitGuardian/gitguardian-helm/commit/afaf2d1))
13-
* set strategy to recreate in deployment ([6e01f97](https://github.com/GitGuardian/gitguardian-helm/commit/6e01f97))
14-
* update minio README.md ([cbca20c](https://github.com/GitGuardian/gitguardian-helm/commit/cbca20c))
15-
* Update CHANGELOG.md ([55a987f](https://github.com/GitGuardian/gitguardian-helm/commit/55a987f))
16-
* Update CHANGELOG.md ([f31d5a5](https://github.com/GitGuardian/gitguardian-helm/commit/f31d5a5))
9+
* add more configuration options for the minio server (#189) ([8066d07](https://github.com/GitGuardian/gitguardian-helm-charts/commit/8066d07)), closes [#189](https://github.com/GitGuardian/gitguardian-helm-charts/issues/189)
10+
* add option to use cpu-v1 image ([91bfd29](https://github.com/GitGuardian/gitguardian-helm-charts/commit/91bfd29))
11+
* bump verion to 0.2.3 ([af6beca](https://github.com/GitGuardian/gitguardian-helm-charts/commit/af6beca))
12+
* bump version to 0.2.2 ([afaf2d1](https://github.com/GitGuardian/gitguardian-helm-charts/commit/afaf2d1))
13+
* set strategy to recreate in deployment ([6e01f97](https://github.com/GitGuardian/gitguardian-helm-charts/commit/6e01f97))
14+
* update minio README.md ([cbca20c](https://github.com/GitGuardian/gitguardian-helm-charts/commit/cbca20c))
15+
* Update CHANGELOG.md ([55a987f](https://github.com/GitGuardian/gitguardian-helm-charts/commit/55a987f))
16+
* Update CHANGELOG.md ([f31d5a5](https://github.com/GitGuardian/gitguardian-helm-charts/commit/f31d5a5))
1717

1818
## <small>0.2.1 (2025-09-08)</small>
1919

20-
* Update appVersion ([5c23cb1](https://github.com/GitGuardian/gitguardian-helm/commit/5c23cb1))
21-
* revert ([ba71354](https://github.com/GitGuardian/gitguardian-helm/commit/ba71354))
22-
* revert 2 ([b64c81d](https://github.com/GitGuardian/gitguardian-helm/commit/b64c81d))
23-
* revert 3 ([d8ced5c](https://github.com/GitGuardian/gitguardian-helm/commit/d8ced5c))
24-
* Update CHANGELOG.md ([bb8e730](https://github.com/GitGuardian/gitguardian-helm/commit/bb8e730))
25-
* Update CHANGELOG.md ([82fe11f](https://github.com/GitGuardian/gitguardian-helm/commit/82fe11f))
26-
* Update CHANGELOG.md ([808cae0](https://github.com/GitGuardian/gitguardian-helm/commit/808cae0))
27-
* Upgrade minio to latest stable ([94ab830](https://github.com/GitGuardian/gitguardian-helm/commit/94ab830))
28-
* Upgrade minio to latest stable ([b199ea4](https://github.com/GitGuardian/gitguardian-helm/commit/b199ea4))
20+
* Update appVersion ([5c23cb1](https://github.com/GitGuardian/gitguardian-helm-charts/commit/5c23cb1))
21+
* revert ([ba71354](https://github.com/GitGuardian/gitguardian-helm-charts/commit/ba71354))
22+
* revert 2 ([b64c81d](https://github.com/GitGuardian/gitguardian-helm-charts/commit/b64c81d))
23+
* revert 3 ([d8ced5c](https://github.com/GitGuardian/gitguardian-helm-charts/commit/d8ced5c))
24+
* Update CHANGELOG.md ([bb8e730](https://github.com/GitGuardian/gitguardian-helm-charts/commit/bb8e730))
25+
* Update CHANGELOG.md ([82fe11f](https://github.com/GitGuardian/gitguardian-helm-charts/commit/82fe11f))
26+
* Update CHANGELOG.md ([808cae0](https://github.com/GitGuardian/gitguardian-helm-charts/commit/808cae0))
27+
* Upgrade minio to latest stable ([94ab830](https://github.com/GitGuardian/gitguardian-helm-charts/commit/94ab830))
28+
* Upgrade minio to latest stable ([b199ea4](https://github.com/GitGuardian/gitguardian-helm-charts/commit/b199ea4))
2929

3030
## 0.2.0 (2025-09-02)
3131

32-
* [documentation] update readme files ([16944cd](https://github.com/GitGuardian/gitguardian-helm/commit/16944cd))
33-
* add persistence.mountPath, use dynamic mountPath for data-volume ([5c2b721](https://github.com/GitGuardian/gitguardian-helm/commit/5c2b721))
34-
* change securitycontext ids to 1001 ([9dc576e](https://github.com/GitGuardian/gitguardian-helm/commit/9dc576e))
35-
* Fix public CDN readme ([68416b1](https://github.com/GitGuardian/gitguardian-helm/commit/68416b1))
36-
* fix: remove debug-values ([385683d](https://github.com/GitGuardian/gitguardian-helm/commit/385683d))
37-
* Improve ingress configuration ([47b5ceb](https://github.com/GitGuardian/gitguardian-helm/commit/47b5ceb))
38-
* increase version to 0.1.4 ([3e6a8f3](https://github.com/GitGuardian/gitguardian-helm/commit/3e6a8f3))
39-
* pin image in test, fix podAnnotations, dynamic ports in server command ([c0fc3c4](https://github.com/GitGuardian/gitguardian-helm/commit/c0fc3c4))
40-
* Release ([c46ef4c](https://github.com/GitGuardian/gitguardian-helm/commit/c46ef4c))
41-
* update readme, remove default values, fix chart.yaml ([37bbb1e](https://github.com/GitGuardian/gitguardian-helm/commit/37bbb1e))
42-
* update version to 0.1.5 ([eedc099](https://github.com/GitGuardian/gitguardian-helm/commit/eedc099))
43-
* Add ArtifactHub Badges to all Charts ([08b855b](https://github.com/GitGuardian/gitguardian-helm/commit/08b855b))
44-
* Add ArtifactHub repo config ([15180a8](https://github.com/GitGuardian/gitguardian-helm/commit/15180a8))
45-
* Add cosign signature READMEs ([5f82e7f](https://github.com/GitGuardian/gitguardian-helm/commit/5f82e7f))
46-
* Add extensive chart testing ([a46efac](https://github.com/GitGuardian/gitguardian-helm/commit/a46efac))
47-
* add extraObject array to all charts ([34772b7](https://github.com/GitGuardian/gitguardian-helm/commit/34772b7))
48-
* Add generated values.schema.json files from values.yaml ([aa79ac3](https://github.com/GitGuardian/gitguardian-helm/commit/aa79ac3))
49-
* Add initial Changelogs to all Charts ([68f10ca](https://github.com/GitGuardian/gitguardian-helm/commit/68f10ca))
50-
* Add LICENSE ([fdbf1ab](https://github.com/GitGuardian/gitguardian-helm/commit/fdbf1ab))
51-
* add logos to helm-charts ([fc70cdc](https://github.com/GitGuardian/gitguardian-helm/commit/fc70cdc))
52-
* Add Minio helm-chart ([6a68b08](https://github.com/GitGuardian/gitguardian-helm/commit/6a68b08))
53-
* bump all chart versions for new extraObjects feature ([aaa57f9](https://github.com/GitGuardian/gitguardian-helm/commit/aaa57f9))
54-
* Fix image tag/digest handling ([a5c982b](https://github.com/GitGuardian/gitguardian-helm/commit/a5c982b))
55-
* Fix imagePullSecrets format and pull always ([ce0d301](https://github.com/GitGuardian/gitguardian-helm/commit/ce0d301))
56-
* fix readme.md install text, update chart.yaml home-website ([3511582](https://github.com/GitGuardian/gitguardian-helm/commit/3511582))
57-
* Fix values.yaml / Chart.yaml linting issues ([043c7e0](https://github.com/GitGuardian/gitguardian-helm/commit/043c7e0))
58-
* Format README files ([04aacab](https://github.com/GitGuardian/gitguardian-helm/commit/04aacab))
59-
* Release new chart versions / update sources ([dbb0e45](https://github.com/GitGuardian/gitguardian-helm/commit/dbb0e45))
60-
* Remove leading $ from code blocks ([836b2e3](https://github.com/GitGuardian/gitguardian-helm/commit/836b2e3))
61-
* remove serviceaccounts from all charts ([be8f43a](https://github.com/GitGuardian/gitguardian-helm/commit/be8f43a))
62-
* update readme, chart.yaml texts and descriptions ([0179046](https://github.com/GitGuardian/gitguardian-helm/commit/0179046))
63-
* Use lookup function for password where applicable ([dfb9a0e](https://github.com/GitGuardian/gitguardian-helm/commit/dfb9a0e))
32+
* [documentation] update readme files ([16944cd](https://github.com/GitGuardian/gitguardian-helm-charts/commit/16944cd))
33+
* add persistence.mountPath, use dynamic mountPath for data-volume ([5c2b721](https://github.com/GitGuardian/gitguardian-helm-charts/commit/5c2b721))
34+
* change securitycontext ids to 1001 ([9dc576e](https://github.com/GitGuardian/gitguardian-helm-charts/commit/9dc576e))
35+
* Fix public CDN readme ([68416b1](https://github.com/GitGuardian/gitguardian-helm-charts/commit/68416b1))
36+
* fix: remove debug-values ([385683d](https://github.com/GitGuardian/gitguardian-helm-charts/commit/385683d))
37+
* Improve ingress configuration ([47b5ceb](https://github.com/GitGuardian/gitguardian-helm-charts/commit/47b5ceb))
38+
* increase version to 0.1.4 ([3e6a8f3](https://github.com/GitGuardian/gitguardian-helm-charts/commit/3e6a8f3))
39+
* pin image in test, fix podAnnotations, dynamic ports in server command ([c0fc3c4](https://github.com/GitGuardian/gitguardian-helm-charts/commit/c0fc3c4))
40+
* Release ([c46ef4c](https://github.com/GitGuardian/gitguardian-helm-charts/commit/c46ef4c))
41+
* update readme, remove default values, fix chart.yaml ([37bbb1e](https://github.com/GitGuardian/gitguardian-helm-charts/commit/37bbb1e))
42+
* update version to 0.1.5 ([eedc099](https://github.com/GitGuardian/gitguardian-helm-charts/commit/eedc099))
43+
* Add ArtifactHub Badges to all Charts ([08b855b](https://github.com/GitGuardian/gitguardian-helm-charts/commit/08b855b))
44+
* Add ArtifactHub repo config ([15180a8](https://github.com/GitGuardian/gitguardian-helm-charts/commit/15180a8))
45+
* Add cosign signature READMEs ([5f82e7f](https://github.com/GitGuardian/gitguardian-helm-charts/commit/5f82e7f))
46+
* Add extensive chart testing ([a46efac](https://github.com/GitGuardian/gitguardian-helm-charts/commit/a46efac))
47+
* add extraObject array to all charts ([34772b7](https://github.com/GitGuardian/gitguardian-helm-charts/commit/34772b7))
48+
* Add generated values.schema.json files from values.yaml ([aa79ac3](https://github.com/GitGuardian/gitguardian-helm-charts/commit/aa79ac3))
49+
* Add initial Changelogs to all Charts ([68f10ca](https://github.com/GitGuardian/gitguardian-helm-charts/commit/68f10ca))
50+
* Add LICENSE ([fdbf1ab](https://github.com/GitGuardian/gitguardian-helm-charts/commit/fdbf1ab))
51+
* add logos to helm-charts ([fc70cdc](https://github.com/GitGuardian/gitguardian-helm-charts/commit/fc70cdc))
52+
* Add Minio helm-chart ([6a68b08](https://github.com/GitGuardian/gitguardian-helm-charts/commit/6a68b08))
53+
* bump all chart versions for new extraObjects feature ([aaa57f9](https://github.com/GitGuardian/gitguardian-helm-charts/commit/aaa57f9))
54+
* Fix image tag/digest handling ([a5c982b](https://github.com/GitGuardian/gitguardian-helm-charts/commit/a5c982b))
55+
* Fix imagePullSecrets format and pull always ([ce0d301](https://github.com/GitGuardian/gitguardian-helm-charts/commit/ce0d301))
56+
* fix readme.md install text, update chart.yaml home-website ([3511582](https://github.com/GitGuardian/gitguardian-helm-charts/commit/3511582))
57+
* Fix values.yaml / Chart.yaml linting issues ([043c7e0](https://github.com/GitGuardian/gitguardian-helm-charts/commit/043c7e0))
58+
* Format README files ([04aacab](https://github.com/GitGuardian/gitguardian-helm-charts/commit/04aacab))
59+
* Release new chart versions / update sources ([dbb0e45](https://github.com/GitGuardian/gitguardian-helm-charts/commit/dbb0e45))
60+
* Remove leading $ from code blocks ([836b2e3](https://github.com/GitGuardian/gitguardian-helm-charts/commit/836b2e3))
61+
* remove serviceaccounts from all charts ([be8f43a](https://github.com/GitGuardian/gitguardian-helm-charts/commit/be8f43a))
62+
* update readme, chart.yaml texts and descriptions ([0179046](https://github.com/GitGuardian/gitguardian-helm-charts/commit/0179046))
63+
* Use lookup function for password where applicable ([dfb9a0e](https://github.com/GitGuardian/gitguardian-helm-charts/commit/dfb9a0e))

charts/minio/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: minio
33
description: High Performance Object Storage compatible with Amazon S3 APIs
44
type: application
5-
version: 0.3.0
5+
version: 0.4.0
66
appVersion: "2025.09.07"
77
keywords:
88
- minio
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{{- if .Values.defaultBuckets }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ include "minio.fullname" . }}-post-job
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "minio.labels" . | nindent 4 }}
9+
{{- if .Values.commonAnnotations }}
10+
annotations:
11+
{{- include "minio.annotations" . | nindent 4 }}
12+
{{- end }}
13+
data:
14+
provision-buckets.sh: |
15+
#!/bin/sh
16+
set -e
17+
18+
MINIO_URL="http://{{ include "minio.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}"
19+
MINIO_STARTUP_TIMEOUT="${MINIO_STARTUP_TIMEOUT:-300}"
20+
21+
echo "=== MinIO Bucket Provisioning ==="
22+
echo "Target: $MINIO_URL"
23+
24+
########################
25+
# Check if MinIO is live
26+
########################
27+
is_minio_live() {
28+
local status_code
29+
status_code=$(curl --write-out '%{http_code}' --silent --output /dev/null "${MINIO_URL}/minio/health/live")
30+
if [ "$status_code" = "200" ]; then
31+
return 0
32+
else
33+
return 1
34+
fi
35+
}
36+
37+
########################
38+
# Wait for MinIO start
39+
########################
40+
wait_for_minio() {
41+
local waited_time
42+
waited_time=0
43+
echo "Waiting for MinIO to be ready..."
44+
while ! is_minio_live && [ "$waited_time" -lt "$MINIO_STARTUP_TIMEOUT" ]; do
45+
echo "MinIO not ready yet, waiting... (${waited_time}s/${MINIO_STARTUP_TIMEOUT}s)"
46+
sleep 5
47+
waited_time=$((waited_time + 5))
48+
done
49+
50+
if [ "$waited_time" -ge "$MINIO_STARTUP_TIMEOUT" ]; then
51+
echo "Timeout: MinIO not ready after ${MINIO_STARTUP_TIMEOUT}s"
52+
return 1
53+
fi
54+
echo "MinIO is ready!"
55+
}
56+
57+
########################
58+
# MinIO client configuration
59+
########################
60+
configure_minio_client() {
61+
echo "Configuring MinIO client..."
62+
mc alias set local "$MINIO_URL" "${MINIO_ROOT_USER}" "${MINIO_ROOT_PASSWORD}"
63+
64+
echo "Testing MinIO client connection..."
65+
mc ready local
66+
}
67+
68+
########################
69+
# Create default buckets
70+
########################
71+
minio_create_default_buckets() {
72+
if [ -n "{{ .Values.defaultBuckets }}" ]; then
73+
buckets=$(echo "{{ .Values.defaultBuckets }}" | tr ',;' ' ')
74+
echo "Creating default buckets..."
75+
76+
for b in $buckets; do
77+
bucket_name=$(echo "$b" | cut -d':' -f1)
78+
bucket_policy=$(echo "$b" | cut -s -d':' -f2)
79+
80+
bucket_name=$(echo "$bucket_name" | xargs)
81+
82+
if [ -z "$bucket_name" ]; then
83+
continue
84+
fi
85+
86+
echo "Processing bucket: $bucket_name"
87+
88+
if mc ls "local/$bucket_name" >/dev/null 2>&1; then
89+
echo "Bucket local/$bucket_name already exists, skipping creation."
90+
else
91+
echo "Creating bucket: local/$bucket_name"
92+
{{- if .Values.config.region }}
93+
mc mb --region "{{ .Values.config.region }}" "local/$bucket_name"
94+
{{- else }}
95+
mc mb "local/$bucket_name"
96+
{{- end }}
97+
echo "Bucket local/$bucket_name created successfully."
98+
fi
99+
100+
if [ -n "$bucket_policy" ]; then
101+
echo "Setting policy $bucket_policy for local bucket $bucket_name"
102+
mc anonymous set "$bucket_policy" "local/$bucket_name"
103+
fi
104+
done
105+
fi
106+
}
107+
108+
########################
109+
# Main execution
110+
########################
111+
112+
wait_for_minio
113+
114+
configure_minio_client
115+
116+
minio_create_default_buckets
117+
118+
echo "Bucket provisioning completed successfully."
119+
{{- end }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{- if .Values.defaultBuckets }}
2+
apiVersion: batch/v1
3+
kind: Job
4+
metadata:
5+
name: {{ include "minio.fullname" . }}-post-job
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "minio.labels" . | nindent 4 }}
9+
annotations:
10+
{{- if .Values.commonAnnotations }}
11+
{{- include "minio.annotations" . | nindent 4 }}
12+
{{- end }}
13+
spec:
14+
ttlSecondsAfterFinished: 600
15+
activeDeadlineSeconds: 300
16+
completions: 1
17+
parallelism: 1
18+
backoffLimit: 3
19+
template:
20+
metadata:
21+
labels:
22+
{{- include "minio.selectorLabels" . | nindent 8 }}
23+
app.kubernetes.io/component: post-job
24+
spec:
25+
{{- with (include "minio.imagePullSecrets" .) }}
26+
{{ . | nindent 6 }}
27+
{{- end }}
28+
restartPolicy: OnFailure
29+
securityContext: {{ include "common.renderPodSecurityContext" . | nindent 8 }}
30+
containers:
31+
- name: post-job
32+
image: {{ include "minio.image" . }}
33+
imagePullPolicy: IfNotPresent
34+
command: ["/bin/sh", "/scripts/provision-buckets.sh"]
35+
env:
36+
- name: MINIO_ROOT_USER
37+
valueFrom:
38+
secretKeyRef:
39+
name: {{ include "minio.secretName" . }}
40+
key: {{ include "minio.rootUser" . }}
41+
- name: MINIO_ROOT_PASSWORD
42+
valueFrom:
43+
secretKeyRef:
44+
name: {{ include "minio.secretName" . }}
45+
key: {{ include "minio.rootPasswordKey" . }}
46+
volumeMounts:
47+
- name: scripts
48+
mountPath: /scripts
49+
- name: tmp
50+
mountPath: /tmp
51+
securityContext:
52+
{{- $securityContext := include "common.renderContainerSecurityContext" . | fromYaml }}
53+
{{- $_ := set $securityContext "readOnlyRootFilesystem" false }}
54+
{{- toYaml $securityContext | nindent 12 }}
55+
volumes:
56+
- name: scripts
57+
configMap:
58+
name: {{ include "minio.fullname" . }}-post-job
59+
defaultMode: 0755
60+
- name: tmp
61+
emptyDir: {}
62+
{{- end }}

charts/minio/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ config:
7373
## @param config.extraEnvVars Extra environment variables to be set on MinIO containers
7474
extraEnvVars: []
7575

76+
## @section Bucket provisioning
77+
## @param defaultBuckets Comma, semi-colon or space separated list of buckets to create at initialization
78+
## Format: "bucket-name" or "bucket-name:policy" where policy can be: none, download, upload, or public
79+
## e.g: "my-bucket, my-second-bucket:download, my-public-bucket:public"
80+
defaultBuckets: ""
81+
7682
## @section Deployment configuration
7783
replicaCount: 1
7884

0 commit comments

Comments
 (0)