Skip to content

Commit

Permalink
feat: support policy updates on upgrades (#35)
Browse files Browse the repository at this point in the history
* feat: support policy updates on upgrades

* try rollout restart

* update job

Release-As: v6.0.4-uds.2
  • Loading branch information
Racer159 authored Dec 3, 2024
1 parent 133477c commit d64de86
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
22 changes: 13 additions & 9 deletions chart/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .name }}-minio-setup
name: {{ .name }}-minio-setup-{{ $.Release.Revision }}
namespace: minio
spec:
template:
Expand All @@ -17,13 +17,16 @@ spec:
command: [{{ $.Values.mcShell | quote }}, "-c"]
args:
- |
mc alias set myminio $MINIO_SERVER $MINIO_ACCESS_KEY $MINIO_SECRET_KEY;
# If we cannot connect to the minio cluster kill the Job to force a restart
mc alias set myminio $MINIO_SERVER $MINIO_ACCESS_KEY $MINIO_SECRET_KEY || exit 1;
{{- range $bucket := .bucketNames }}
mc mb myminio/{{ $bucket }};
mc mb --ignore-existing myminio/{{ $bucket }};
{{- end }}
mc admin policy create myminio {{ .name }}-policy /config/policy.json;
mc admin user add myminio $USER $USER_SECRET;
mc admin policy attach myminio {{ .name }}-policy --user $USER;
mc admin policy attach myminio {{ .name }}-policy --user $USER || echo Skipping user attachment;
env:
- name: MINIO_SERVER
value: "http://uds-minio-hl.minio.svc.cluster.local:9000"
Expand Down Expand Up @@ -56,11 +59,12 @@ spec:
mountPath: /tmp
restartPolicy: OnFailure
volumes:
- name: policy-config
configMap:
name: {{ .name }}-minio-policy
- name: config-volume
emptyDir: {}
- name: policy-config
configMap:
name: {{ .name }}-minio-policy
- name: config-volume
emptyDir: {}
restartPolicy: OnFailure
backoffLimit: 4
---
{{- end }}
4 changes: 4 additions & 0 deletions common/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ components:
actions:
onDeploy:
after:
- cmd: ./zarf tools kubectl -n minio rollout restart statefulset
description: Restart Minio StatefulSet so pods cycle on upgrades
- cmd: ./zarf tools kubectl -n minio rollout status statefulset
description: Wait for Rollout to complete before continuing
- description: Validate Minio Operator Package
maxTotalSeconds: 300
wait:
Expand Down

0 comments on commit d64de86

Please sign in to comment.