-
Notifications
You must be signed in to change notification settings - Fork 7
Fix fluentd lifecycle hook BackoffLimitExceeded on deploy_to_doks_release #839
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,9 +12,9 @@ metadata: | |||||
| # Minio create bucket hook doesn't define any hook weight, | ||||||
| # any positive value will ensure that the bucket is created before this | ||||||
| "helm.sh/hook-weight": "10" | ||||||
| "helm.sh/hook-delete-policy": hook-succeeded | ||||||
| "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||||||
| spec: | ||||||
| backoffLimit: 100 | ||||||
| backoffLimit: 3 | ||||||
| template: | ||||||
| metadata: | ||||||
| name: "{{ .Release.Name }}" | ||||||
|
|
@@ -30,14 +30,26 @@ spec: | |||||
| value: "{{ .Values.global.minio.accessKey }}" | ||||||
| - name: AWS_SECRET_ACCESS_KEY | ||||||
| value: "{{ .Values.global.minio.secretKey }}" | ||||||
| command: ["aws"] | ||||||
| command: ["/bin/sh", "-c"] | ||||||
| args: | ||||||
| - s3api | ||||||
| - put-bucket-lifecycle-configuration | ||||||
| - --bucket | ||||||
| - {{ .Values.fluentdoperator.bucketName }} | ||||||
| - --endpoint-url | ||||||
| - http://{{ .Values.global.minio.location }}:{{ .Values.global.minio.port }} | ||||||
| - --lifecycle-configuration | ||||||
| - '{"Rules":[{"Expiration":{"Days": {{ .Values.fluentdoperator.expirationDays }} },"ID":"Delete old logs","Status":"Enabled"}]}' | ||||||
| - | | ||||||
| ENDPOINT="http://{{ .Values.global.minio.location }}:{{ .Values.global.minio.port }}" | ||||||
| BUCKET="{{ .Values.fluentdoperator.bucketName }}" | ||||||
| LIFECYCLE='{"Rules":[{"Expiration":{"Days": {{ .Values.fluentdoperator.expirationDays }} },"ID":"Delete old logs","Status":"Enabled"}]}' | ||||||
| MAX_WAIT=600 | ||||||
| ELAPSED=0 | ||||||
| echo "Waiting for MinIO at ${ENDPOINT}..." | ||||||
| until aws s3 ls --endpoint-url "${ENDPOINT}" > /dev/null 2>&1; do | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 MEDIUM RISK Suggestion: The current check only verifies that the MinIO endpoint is reachable. Since the script's primary action is to configure a specific bucket, the wait loop should verify the bucket's existence to avoid a race condition where the service is up but the target bucket has not yet been initialized.
Suggested change
|
||||||
| if [ "${ELAPSED}" -ge "${MAX_WAIT}" ]; then | ||||||
| echo "Timed out waiting for MinIO after ${MAX_WAIT}s" | ||||||
| exit 1 | ||||||
| fi | ||||||
| sleep 10 | ||||||
| ELAPSED=$((ELAPSED + 10)) | ||||||
| done | ||||||
| echo "MinIO is ready. Setting lifecycle configuration on bucket ${BUCKET}..." | ||||||
| aws s3api put-bucket-lifecycle-configuration \ | ||||||
| --bucket "${BUCKET}" \ | ||||||
| --endpoint-url "${ENDPOINT}" \ | ||||||
| --lifecycle-configuration "${LIFECYCLE}" | ||||||
| {{ end }} | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ LOW RISK
Nitpick: It is safer to quote the annotation value to ensure consistent parsing, especially when it contains special characters like commas.