Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update Minio helm chart dependency to 5.3.0 #14834

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

GerbenWelter
Copy link

What this PR does / why we need it:
Updates ancient version of minio helm chart dependency.

Which issue(s) this PR fixes:
Fixes #12254

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@GerbenWelter GerbenWelter requested a review from a team as a code owner November 7, 2024 18:59
@CLAassistant
Copy link

CLAassistant commented Nov 7, 2024

CLA assistant check
All committers have signed the CLA.

@pull-request-size pull-request-size bot added size/S and removed size/XS labels Nov 7, 2024

This comment has been minimized.

This comment has been minimized.

@GerbenWelter GerbenWelter changed the title Update Minio helm chart dependency to 5.3.0 chore: Update Minio helm chart dependency to 5.3.0 Nov 14, 2024
@GerbenWelter
Copy link
Author

@trevorwhitney I have update the title as suggested but I don't think the helm-lint check is a result of my change. Is there something I need to do?

This comment has been minimized.

Copy link
Collaborator

@trevorwhitney trevorwhitney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, I don't think the helm lint changes are your fault, it's breaking a lot of PRs, and as someone who doesn't use the helm chart it hasn't reached the top of my TODO list to look into yet. I would love help if you can figure out what's broken?

one small change to the CHANGELOG, thanks!

production/helm/loki/CHANGELOG.md Outdated Show resolved Hide resolved

This comment has been minimized.

@GerbenWelter
Copy link
Author

no, I don't think the helm lint changes are your fault, it's breaking a lot of PRs, and as someone who doesn't use the helm chart it hasn't reached the top of my TODO list to look into yet. I would love help if you can figure out what's broken?

one small change to the CHANGELOG, thanks!

I'll have a look to see if I can figure it out.

@pull-request-size pull-request-size bot added size/M and removed size/S labels Nov 16, 2024

This comment has been minimized.

@GerbenWelter
Copy link
Author

no, I don't think the helm lint changes are your fault, it's breaking a lot of PRs, and as someone who doesn't use the helm chart it hasn't reached the top of my TODO list to look into yet. I would love help if you can figure out what's broken?
one small change to the CHANGELOG, thanks!

I'll have a look to see if I can figure it out.

I think I know what's causing the problem. The CI runs a superlinter container which does a diff. The diff tries to resolve the commit sha in this repo but the commit sha comes from Pull Requestor's repo. This causes git to throw the 'fatal: Invalid symmetric difference expression main...' error. That explains why this CI workflow runs without failure on changes (e.g. from renovate) made directly on this repo. Maybe someone with more knowledge of this CI setup can fix this for external PRs.

@GerbenWelter
Copy link
Author

@trevorwhitney It still says 'Changes requested' but it links to an outdated review comment by you. Is there anything I need to do to get this PR merged?

This comment has been minimized.

@trevorwhitney
Copy link
Collaborator

@GerbenWelter looks like your changelog entry is in the wrong place, 6.20 has already gone out, this should go in the unreleased section at the top so automation can put it in the right section for the next release. thanks!

This comment has been minimized.

This comment has been minimized.

Copy link
Collaborator

@trevorwhitney trevorwhitney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@trevorwhitney
Copy link
Collaborator

docs check failing, did you run make helm-docs?

@GerbenWelter
Copy link
Author

docs check failing, did you run make helm-docs?

No I didn't, I missed that in the instructions. But I have trouble running it. Its seems to lack permissions reading the generated markdown files. I'm figuring out if it's my Fedora 41 environment or not.

@pull-request-size pull-request-size bot added size/S and removed size/M labels Nov 23, 2024

This comment has been minimized.

@GerbenWelter
Copy link
Author

GerbenWelter commented Nov 23, 2024

Got the helm-docs working by tweaking the Makefile. It's a SELinux container volume mount problem. Reading the Docker Hub page for the used container suggests this was only tested on MacOS. I hope all is fine now.

Copy link
Contributor

Kubernetes Manifest Diff Summary

Scenario: default-single-binary-values (Added: 1, Modified: 6, Removed: 2)

Summary:

  • Added: 1

  • Modified: 6

  • Removed: 2

Added Files

loki/charts/minio/templates/post-job.yaml
---
# Source: loki/charts/minio/templates/post-job.yaml
apiVersion: batch/v1
kind: Job
metadata:
 name: loki-test-chart-name-minio-post-job
 labels:
 app: minio-post-job
 chart: minio-5.3.0
 release: loki-test-chart-name
 heritage: Helm
 annotations:
 "helm.sh/hook": post-install,post-upgrade
 "helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
spec:
 template:
 metadata:
 labels:
 app: minio-job
 release: loki-test-chart-name
 spec:
 restartPolicy: OnFailure 
 volumes:
 - name: etc-path
 emptyDir: {}
 - name: tmp
 emptyDir: {}
 - name: minio-configuration
 projected:
 sources:
 - configMap:
 name: loki-test-chart-name-minio
 - secret:
 name: loki-test-chart-name-minio
 serviceAccountName: minio-sa
 containers:
 - name: minio-make-bucket
 image: "quay.io/minio/mc:RELEASE.2024-04-18T16-45-29Z"
 imagePullPolicy: IfNotPresent
 command: [ "/bin/sh", "/config/initialize" ]
 env:
 - name: MINIO_ENDPOINT
 value: loki-test-chart-name-minio
 - name: MINIO_PORT
 value: "9000"
 volumeMounts:
 - name: etc-path
 mountPath: /etc/minio/mc
 - name: tmp
 mountPath: /tmp
 - name: minio-configuration
 mountPath: /config
 resources:
 requests:
 memory: 128Mi
 - name: minio-make-user
 image: "quay.io/minio/mc:RELEASE.2024-04-18T16-45-29Z"
 imagePullPolicy: IfNotPresent
 command: [ "/bin/sh", "/config/add-user" ]
 env:
 - name: MINIO_ENDPOINT
 value: loki-test-chart-name-minio
 - name: MINIO_PORT
 value: "9000"
 volumeMounts:
 - name: etc-path
 mountPath: /etc/minio/mc
 - name: tmp
 mountPath: /tmp
 - name: minio-configuration
 mountPath: /config
 resources:
 requests:
 memory: 128Mi

Modified Files

loki/charts/minio/templates/statefulset.yaml
*** /home/runner/work/loki/loki/output/base/default-single-binary-values/loki/charts/minio/templates/statefulset.yaml	2024-11-28 14:44:17.896888107 +0000
--- /home/runner/work/loki/loki/output/pr/default-single-binary-values/loki/charts/minio/templates/statefulset.yaml	2024-11-28 14:44:20.272917589 +0000
***************
*** 4,15 ****
 kind: Service
 metadata:
 name: loki-test-chart-name-minio-svc
- namespace: "default"
 labels:
 app: minio
! chart: minio-4.1.0
! release: "loki-test-chart-name"
! heritage: "Helm"
 spec:
 publishNotReadyAddresses: true
 clusterIP: None
--- 4,14 ----
 kind: Service
 metadata:
 name: loki-test-chart-name-minio-svc
 labels:
 app: minio
! chart: minio-5.3.0
! release: loki-test-chart-name
! heritage: Helm
 spec:
 publishNotReadyAddresses: true
 clusterIP: None
***************
*** 27,36 ****
 kind: StatefulSet
 metadata:
 name: loki-test-chart-name-minio
- namespace: "default"
 labels:
 app: minio
! chart: minio-4.1.0
 release: loki-test-chart-name
 heritage: Helm
 spec:
--- 26,34 ----
 kind: StatefulSet
 metadata:
 name: loki-test-chart-name-minio
 labels:
 app: minio
! chart: minio-5.3.0
 release: loki-test-chart-name
 heritage: Helm
 spec:
***************
*** 50,73 ****
 app: minio
 release: loki-test-chart-name
 annotations:
! checksum/secrets: e3b6994ac99f6f850571b7873d57eacbc15f9355668258d34fdb00f2ecfd1604
! checksum/config: 8cd8967e928246aeb5b41e61dca086802dc8040b18d1a2c2daf4332dec1881fe
 spec:
 securityContext:
- runAsUser: 1000
- runAsGroup: 1000
 fsGroup: 1000
 fsGroupChangePolicy: OnRootMismatch
! 
 serviceAccountName: minio-sa
 containers:
 - name: minio
! image: quay.io/minio/minio:RELEASE.2022-10-24T18-35-07Z
 imagePullPolicy: IfNotPresent
! 
! command: [ "/bin/sh",
 "-ce",
! "/usr/bin/docker-entrypoint.sh minio server http://loki-test-chart-name-minio-{0...0}.loki-test-chart-name-minio-svc.default.svc.cluster.local/export-{0...1} -S /etc/minio/certs/ --address :9000 --console-address :9001" ]
 volumeMounts:
 - name: export-0
 mountPath: /export-0
--- 48,71 ----
 app: minio
 release: loki-test-chart-name
 annotations:
! checksum/secrets: 332ab406fb671aa9097a30fdb48f9cd8e1e54a3847e615e9645f925dbcf7806e
! checksum/config: 20286fb8b0e8bcdb72d2f59c79ecb3c3fdafc504e48b13cca57b3283a1384915
 spec:
 securityContext:
 fsGroup: 1000
 fsGroupChangePolicy: OnRootMismatch
! runAsGroup: 1000
! runAsUser: 1000
 serviceAccountName: minio-sa
 containers:
 - name: minio
! image: quay.io/minio/minio:RELEASE.2024-04-18T19-09-19Z
 imagePullPolicy: IfNotPresent
! command: [
! "/bin/sh",
 "-ce",
! "/usr/bin/docker-entrypoint.sh minio server http://loki-test-chart-name-minio-{0...0}.loki-test-chart-name-minio-svc.default.svc/export-{0...1} -S /etc/minio/certs/ --address :9000 --console-address :9001"
! ]
 volumeMounts:
 - name: export-0
 mountPath: /export-0
***************
*** 94,113 ****
 resources:
 requests:
 cpu: 100m
! memory: 128Mi 
 volumes:
 - name: minio-user
 secret:
 secretName: loki-test-chart-name-minio 
 volumeClaimTemplates:
! - metadata:
 name: export-0
 spec:
 accessModes: [ "ReadWriteOnce" ]
 resources:
 requests:
 storage: 5Gi
! - metadata:
 name: export-1
 spec:
 accessModes: [ "ReadWriteOnce" ]
--- 92,117 ----
 resources:
 requests:
 cpu: 100m
! memory: 128Mi
! securityContext: 
! readOnlyRootFilesystem: false 
 volumes:
 - name: minio-user
 secret:
 secretName: loki-test-chart-name-minio 
 volumeClaimTemplates:
! - apiVersion: v1
! kind: PersistentVolumeClaim
! metadata:
 name: export-0
 spec:
 accessModes: [ "ReadWriteOnce" ]
 resources:
 requests:
 storage: 5Gi
! - apiVersion: v1
! kind: PersistentVolumeClaim
! metadata:
 name: export-1
 spec:
 accessModes: [ "ReadWriteOnce" ]
loki/charts/minio/templates/serviceaccount.yaml
*** /home/runner/work/loki/loki/output/base/default-single-binary-values/loki/charts/minio/templates/serviceaccount.yaml	2024-11-28 14:44:17.892888083 +0000
--- /home/runner/work/loki/loki/output/pr/default-single-binary-values/loki/charts/minio/templates/serviceaccount.yaml	2024-11-28 14:44:20.268917492 +0000
***************
*** 4,7 ****
 kind: ServiceAccount
 metadata:
 name: "minio-sa"
- namespace: "default"
--- 4,6 ----
loki/charts/minio/templates/service.yaml
*** /home/runner/work/loki/loki/output/base/default-single-binary-values/loki/charts/minio/templates/service.yaml	2024-11-28 14:44:17.892888083 +0000
--- /home/runner/work/loki/loki/output/pr/default-single-binary-values/loki/charts/minio/templates/service.yaml	2024-11-28 14:44:20.268917492 +0000
***************
*** 4,13 ****
 kind: Service
 metadata:
 name: loki-test-chart-name-minio
- namespace: "default"
 labels:
 app: minio
! chart: minio-4.1.0
 release: loki-test-chart-name
 heritage: Helm
 monitoring: "true"
--- 4,12 ----
 kind: Service
 metadata:
 name: loki-test-chart-name-minio
 labels:
 app: minio
! chart: minio-5.3.0
 release: loki-test-chart-name
 heritage: Helm
 monitoring: "true"
loki/charts/minio/templates/configmap.yaml
*** /home/runner/work/loki/loki/output/base/default-single-binary-values/loki/charts/minio/templates/configmap.yaml	2024-11-28 14:44:17.892888083 +0000
--- /home/runner/work/loki/loki/output/pr/default-single-binary-values/loki/charts/minio/templates/configmap.yaml	2024-11-28 14:44:20.268917492 +0000
***************
*** 4,118 ****
 kind: ConfigMap
 metadata:
 name: loki-test-chart-name-minio
- namespace: "default"
 labels:
 app: minio
! chart: minio-4.1.0
 release: loki-test-chart-name
 heritage: Helm
 data:
 initialize: |-
 #!/bin/sh
! set -e ; # Have script exit in the event of a failed command.
 MC_CONFIG_DIR="/etc/minio/mc/"
 MC="/usr/bin/mc --insecure --config-dir ${MC_CONFIG_DIR}"
 
 # connectToMinio
 # Use a check-sleep-check loop to wait for MinIO service to be available
 connectToMinio() {
! SCHEME=$1
! ATTEMPTS=0 ; LIMIT=29 ; # Allow 30 attempts
! set -e ; # fail if we can't read the keys.
! ACCESS=$(cat /config/rootUser) ; SECRET=$(cat /config/rootPassword) ;
! set +e ; # The connections to minio are allowed to fail.
! echo "Connecting to MinIO server: $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT" ;
! MC_COMMAND="${MC} alias set myminio $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT $ACCESS $SECRET" ;
! $MC_COMMAND ;
! STATUS=$? ;
! until [ $STATUS = 0 ]
! do
! ATTEMPTS=`expr $ATTEMPTS + 1` ;
! echo \"Failed attempts: $ATTEMPTS\" ;
! if [ $ATTEMPTS -gt $LIMIT ]; then
! exit 1 ;
! fi ;
! sleep 2 ; # 1 second intervals between attempts
! $MC_COMMAND ;
! STATUS=$? ;
! done ;
! set -e ; # reset `e` as active
! return 0
 }
 
 # checkBucketExists ($bucket)
 # Check if the bucket exists, by using the exit code of `mc ls`
 checkBucketExists() {
! BUCKET=$1
! CMD=$(${MC} ls myminio/$BUCKET > /dev/null 2>&1)
! return $?
 }
 
 # createBucket ($bucket, $policy, $purge)
 # Ensure bucket exists, purging if asked to
 createBucket() {
! BUCKET=$1
! POLICY=$2
! PURGE=$3
! VERSIONING=$4
! OBJECTLOCKING=$5
! 
! # Purge the bucket, if set & exists
! # Since PURGE is user input, check explicitly for `true`
! if [ $PURGE = true ]; then
! if checkBucketExists $BUCKET ; then
! echo "Purging bucket '$BUCKET'."
! set +e ; # don't exit if this fails
! ${MC} rm -r --force myminio/$BUCKET
! set -e ; # reset `e` as active
! else
! echo "Bucket '$BUCKET' does not exist, skipping purge."
! fi
! fi
! 
! # 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
! elif [ -z $OBJECTLOCKING ] ; then
! echo "Creating bucket '$BUCKET'"
! ${MC} mb myminio/$BUCKET
! else
! echo "Bucket '$BUCKET' already exists." 
! fi
! fi
! 
! 
! # set versioning for bucket if objectlocking is disabled or not set
! if [ -z $OBJECTLOCKING ] ; then
! if [ ! -z $VERSIONING ] ; then
! if [ $VERSIONING = true ] ; then
! echo "Enabling versioning for '$BUCKET'"
! ${MC} version enable myminio/$BUCKET
! 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'."
! ${MC} policy set $POLICY myminio/$BUCKET
 }
 
 # Try connecting to MinIO instance
--- 4,116 ----
 kind: ConfigMap
 metadata:
 name: loki-test-chart-name-minio
 labels:
 app: minio
! chart: minio-5.3.0
 release: loki-test-chart-name
 heritage: Helm
 data:
 initialize: |-
 #!/bin/sh
! set -e # Have script exit in the event of a failed command.
 MC_CONFIG_DIR="/etc/minio/mc/"
 MC="/usr/bin/mc --insecure --config-dir ${MC_CONFIG_DIR}"
 
 # connectToMinio
 # Use a check-sleep-check loop to wait for MinIO service to be available
 connectToMinio() {
! 	SCHEME=$1
! 	ATTEMPTS=0
! 	LIMIT=29 # Allow 30 attempts
! 	set -e # fail if we can't read the keys.
! 	ACCESS=$(cat /config/rootUser)
! 	SECRET=$(cat /config/rootPassword)
! 	set +e # The connections to minio are allowed to fail.
! 	echo "Connecting to MinIO server: $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT"
! 	MC_COMMAND="${MC} alias set myminio $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT $ACCESS $SECRET"
! 	$MC_COMMAND
! 	STATUS=$?
! 	until [ $STATUS = 0 ]; do
! 		ATTEMPTS=$(expr $ATTEMPTS + 1)
! 		echo \"Failed attempts: $ATTEMPTS\"
! 		if [ $ATTEMPTS -gt $LIMIT ]; then
! 			exit 1
! 		fi
! 		sleep 2 # 1 second intervals between attempts
! 		$MC_COMMAND
! 		STATUS=$?
! 	done
! 	set -e # reset `e` as active
! 	return 0
 }
 
 # checkBucketExists ($bucket)
 # Check if the bucket exists, by using the exit code of `mc ls`
 checkBucketExists() {
! 	BUCKET=$1
! 	CMD=$(${MC} stat myminio/$BUCKET >/dev/null 2>&1)
! 	return $?
 }
 
 # createBucket ($bucket, $policy, $purge)
 # Ensure bucket exists, purging if asked to
 createBucket() {
! 	BUCKET=$1
! 	POLICY=$2
! 	PURGE=$3
! 	VERSIONING=$4
! 	OBJECTLOCKING=$5
! 
! 	# Purge the bucket, if set & exists
! 	# Since PURGE is user input, check explicitly for `true`
! 	if [ $PURGE = true ]; then
! 		if checkBucketExists $BUCKET; then
! 			echo "Purging bucket '$BUCKET'."
! 			set +e # don't exit if this fails
! 			${MC} rm -r --force myminio/$BUCKET
! 			set -e # reset `e` as active
! 		else
! 			echo "Bucket '$BUCKET' does not exist, skipping purge."
! 		fi
! 	fi
! 
! 	# 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
! 		elif [ -z $OBJECTLOCKING ]; then
! 			echo "Creating bucket '$BUCKET'"
! 			${MC} mb myminio/$BUCKET
! 		else
! 			echo "Bucket '$BUCKET' already exists."
! 		fi
! 	fi
! 
! 	# set versioning for bucket if objectlocking is disabled or not set
! 	if [ $OBJECTLOCKING = false ]; then
! 		if [ ! -z $VERSIONING ]; then
! 			if [ $VERSIONING = true ]; then
! 				echo "Enabling versioning for '$BUCKET'"
! 				${MC} version enable myminio/$BUCKET
! 			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'."
! 	${MC} anonymous set $POLICY myminio/$BUCKET
 }
 
 # Try connecting to MinIO instance
***************
*** 122,130 ****
 
 
 # Create the buckets
! createBucket chunks none false 
! createBucket ruler none false 
! createBucket admin none false 
 add-user: |-
 #!/bin/sh
 set -e ; # Have script exit in the event of a failed command.
--- 120,129 ----
 
 
 # Create the buckets
! createBucket chunks "none" false false false
! createBucket ruler "none" false false false
! createBucket admin "none" false false false
! 
 add-user: |-
 #!/bin/sh
 set -e ; # Have script exit in the event of a failed command.
***************
*** 196,202 ****
 # set policy for user
 if [ ! -z $POLICY -a $POLICY != " " ] ; then
 echo "Adding policy '$POLICY' for '$USER'"
! ${MC} admin policy set myminio $POLICY user=$USER
 else
 echo "User '$USER' has no policy attached."
 fi
--- 195,203 ----
 # set policy for user
 if [ ! -z $POLICY -a $POLICY != " " ] ; then
 echo "Adding policy '$POLICY' for '$USER'"
! set +e ; # policy already attach errors out, allow it.
! ${MC} admin policy attach myminio $POLICY --user=$USER
! set -e
 else
 echo "User '$USER' has no policy attached."
 fi
***************
*** 266,272 ****
 else
 echo "Policy '$NAME' already exists."
 fi
! ${MC} admin policy add myminio $NAME /config/$FILENAME.json
 
 }
 
--- 267,273 ----
 else
 echo "Policy '$NAME' already exists."
 fi
! ${MC} admin policy create myminio $NAME /config/$FILENAME.json
 
 }
 
***************
*** 275,280 ****
--- 276,363 ----
 connectToMinio $scheme
 
 
+ 
+ add-svcacct: |-
+ #!/bin/sh
+ set -e ; # Have script exit in the event of a failed command.
+ MC_CONFIG_DIR="/etc/minio/mc/"
+ MC="/usr/bin/mc --insecure --config-dir ${MC_CONFIG_DIR}"
+ 
+ # AccessKey and secretkey credentials file are added to prevent shell execution errors caused by special characters.
+ # Special characters for example : ',",<,>,{,}
+ MINIO_ACCESSKEY_SECRETKEY_TMP="/tmp/accessKey_and_secretKey_svcacct_tmp"
+ 
+ # connectToMinio
+ # Use a check-sleep-check loop to wait for MinIO service to be available
+ connectToMinio() {
+ SCHEME=$1
+ ATTEMPTS=0 ; LIMIT=29 ; # Allow 30 attempts
+ set -e ; # fail if we can't read the keys.
+ ACCESS=$(cat /config/rootUser) ; SECRET=$(cat /config/rootPassword) ;
+ set +e ; # The connections to minio are allowed to fail.
+ echo "Connecting to MinIO server: $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT" ;
+ MC_COMMAND="${MC} alias set myminio $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT $ACCESS $SECRET" ;
+ $MC_COMMAND ;
+ STATUS=$? ;
+ until [ $STATUS = 0 ]
+ do
+ ATTEMPTS=`expr $ATTEMPTS + 1` ;
+ echo \"Failed attempts: $ATTEMPTS\" ;
+ if [ $ATTEMPTS -gt $LIMIT ]; then
+ exit 1 ;
+ fi ;
+ sleep 2 ; # 2 second intervals between attempts
+ $MC_COMMAND ;
+ STATUS=$? ;
+ done ;
+ set -e ; # reset `e` as active
+ return 0
+ }
+ 
+ # checkSvcacctExists ()
+ # Check if the svcacct exists, by using the exit code of `mc admin user svcacct info`
+ checkSvcacctExists() {
+ CMD=$(${MC} admin user svcacct info myminio $(head -1 $MINIO_ACCESSKEY_SECRETKEY_TMP) > /dev/null 2>&1)
+ return $?
+ }
+ 
+ # createSvcacct ($user)
+ createSvcacct () {
+ USER=$1
+ FILENAME=$2
+ #check accessKey_and_secretKey_tmp file
+ if [[ ! -f $MINIO_ACCESSKEY_SECRETKEY_TMP ]];then
+ echo "credentials file does not exist"
+ return 1
+ fi
+ if [[ $(cat $MINIO_ACCESSKEY_SECRETKEY_TMP|wc -l) -ne 2 ]];then
+ echo "credentials file is invalid"
+ rm -f $MINIO_ACCESSKEY_SECRETKEY_TMP
+ return 1
+ fi
+ SVCACCT=$(head -1 $MINIO_ACCESSKEY_SECRETKEY_TMP)
+ # Create the svcacct if it does not exist
+ if ! checkSvcacctExists ; then
+ echo "Creating svcacct '$SVCACCT'"
+ # Check if policy file is define
+ if [ -z $FILENAME ]; then
+ ${MC} admin user svcacct add --access-key $(head -1 $MINIO_ACCESSKEY_SECRETKEY_TMP) --secret-key $(tail -n1 $MINIO_ACCESSKEY_SECRETKEY_TMP) myminio $USER
+ else
+ ${MC} admin user svcacct add --access-key $(head -1 $MINIO_ACCESSKEY_SECRETKEY_TMP) --secret-key $(tail -n1 $MINIO_ACCESSKEY_SECRETKEY_TMP) --policy /config/$FILENAME.json myminio $USER
+ fi
+ else
+ echo "Svcacct '$SVCACCT' already exists."
+ fi
+ #clean up credentials files.
+ rm -f $MINIO_ACCESSKEY_SECRETKEY_TMP
+ }
+ 
+ # Try connecting to MinIO instance
+ scheme=http
+ connectToMinio $scheme
+ 
+ 
+ 
 custom-command: |-
 #!/bin/sh
 set -e ; # Have script exit in the event of a failed command.
loki/charts/minio/templates/console-service.yaml
*** /home/runner/work/loki/loki/output/base/default-single-binary-values/loki/charts/minio/templates/console-service.yaml	2024-11-28 14:44:17.892888083 +0000
--- /home/runner/work/loki/loki/output/pr/default-single-binary-values/loki/charts/minio/templates/console-service.yaml	2024-11-28 14:44:20.268917492 +0000
***************
*** 4,13 ****
 kind: Service
 metadata:
 name: loki-test-chart-name-minio-console
- namespace: "default"
 labels:
 app: minio
! chart: minio-4.1.0
 release: loki-test-chart-name
 heritage: Helm
 spec:
--- 4,12 ----
 kind: Service
 metadata:
 name: loki-test-chart-name-minio-console
 labels:
 app: minio
! chart: minio-5.3.0
 release: loki-test-chart-name
 heritage: Helm
 spec:
loki/charts/minio/templates/secrets.yaml
*** /home/runner/work/loki/loki/output/base/default-single-binary-values/loki/charts/minio/templates/secrets.yaml	2024-11-28 14:44:17.892888083 +0000
--- /home/runner/work/loki/loki/output/pr/default-single-binary-values/loki/charts/minio/templates/secrets.yaml	2024-11-28 14:44:20.268917492 +0000
***************
*** 4,13 ****
 kind: Secret
 metadata:
 name: loki-test-chart-name-minio
- namespace: "default"
 labels:
 app: minio
! chart: minio-4.1.0
 release: loki-test-chart-name
 heritage: Helm
 type: Opaque
--- 4,12 ----
 kind: Secret
 metadata:
 name: loki-test-chart-name-minio
 labels:
 app: minio
! chart: minio-5.3.0
 release: loki-test-chart-name
 heritage: Helm
 type: Opaque

Removed Files

loki/charts/minio/templates/post-install-create-bucket-job.yaml
---
# Source: loki/charts/minio/templates/post-install-create-bucket-job.yaml
apiVersion: batch/v1
kind: Job
metadata:
 name: loki-test-chart-name-minio-make-bucket-job
 namespace: "default"
 labels:
 app: minio-make-bucket-job
 chart: minio-4.1.0
 release: loki-test-chart-name
 heritage: Helm
 annotations:
 "helm.sh/hook": post-install,post-upgrade
 "helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
spec:
 template:
 metadata:
 labels:
 app: minio-job
 release: loki-test-chart-name
 spec:
 restartPolicy: OnFailure 
 volumes:
 - name: minio-configuration
 projected:
 sources:
 - configMap:
 name: loki-test-chart-name-minio
 - secret:
 name: loki-test-chart-name-minio

 serviceAccountName: minio-sa
 containers:
 - name: minio-mc
 image: "quay.io/minio/mc:RELEASE.2022-10-20T23-26-33Z"
 imagePullPolicy: IfNotPresent
 command: ["/bin/sh", "/config/initialize"]
 env:
 - name: MINIO_ENDPOINT
 value: loki-test-chart-name-minio
 - name: MINIO_PORT
 value: "9000"
 volumeMounts:
 - name: minio-configuration
 mountPath: /config
 resources:
 requests:
 memory: 128Mi
loki/charts/minio/templates/post-install-create-user-job.yaml
---
# Source: loki/charts/minio/templates/post-install-create-user-job.yaml
apiVersion: batch/v1
kind: Job
metadata:
 name: loki-test-chart-name-minio-make-user-job
 namespace: "default"
 labels:
 app: minio-make-user-job
 chart: minio-4.1.0
 release: loki-test-chart-name
 heritage: Helm
 annotations:
 "helm.sh/hook": post-install,post-upgrade
 "helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
spec:
 template:
 metadata:
 labels:
 app: minio-job
 release: loki-test-chart-name
 spec:
 restartPolicy: OnFailure 
 volumes:
 - name: minio-configuration
 projected:
 sources:
 - configMap:
 name: loki-test-chart-name-minio
 - secret:
 name: loki-test-chart-name-minio

 serviceAccountName: minio-sa
 containers:
 - name: minio-mc
 image: "quay.io/minio/mc:RELEASE.2022-10-20T23-26-33Z"
 imagePullPolicy: IfNotPresent
 command: ["/bin/sh", "/config/add-user"]
 env:
 - name: MINIO_ENDPOINT
 value: loki-test-chart-name-minio
 - name: MINIO_PORT
 value: "9000"
 volumeMounts:
 - name: minio-configuration
 mountPath: /config
 resources:
 requests:
 memory: 128Mi

Scenario: default-values (Added: 0, Modified: 0, Removed: 0)

Summary:

  • Added: 0

  • Modified: 0

  • Removed: 0

Added Files

No added files

Modified Files

No modified files

Removed Files

No removed files

Scenario: ingress-values (Added: 0, Modified: 0, Removed: 0)

Summary:

  • Added: 0

  • Modified: 0

  • Removed: 0

Added Files

No added files

Modified Files

No modified files

Removed Files

No removed files

Scenario: legacy-monitoring-values (Added: 0, Modified: 0, Removed: 0)

Summary:

  • Added: 0

  • Modified: 0

  • Removed: 0

Added Files

No added files

Modified Files

No modified files

Removed Files

No removed files

Scenario: simple-scalable-aws-kube-irsa-values (Added: 0, Modified: 0, Removed: 0)

Summary:

  • Added: 0

  • Modified: 0

  • Removed: 0

Added Files

No added files

Modified Files

No modified files

Removed Files

No removed files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(helm): bump minio chart version to 5.1.0
3 participants