Skip to content

[Fix] s3-bucket-init job IMDS region crash#303

Merged
tal-haim merged 5 commits into
mlrun:developmentfrom
tal-haim:fix/CEML-721-s3-bucket-init-region
Jul 12, 2026
Merged

[Fix] s3-bucket-init job IMDS region crash#303
tal-haim merged 5 commits into
mlrun:developmentfrom
tal-haim:fix/CEML-721-s3-bucket-init-region

Conversation

@tal-haim

@tal-haim tal-haim commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

📝 Description

Fixes CEML-721: the mlrun-ce-s3-bucket-init post-install hook job fails on fresh installs because the create-bucket container runs aws s3 without setting a region. Botocore then attempts EC2 IMDS region discovery inside the pod, which fails in most Kubernetes environments (especially Azure) and hits a long-standing botocore bug (aws/aws-cli#8988) that prints a raw <botocore.awsrequest.AWSRequest object at 0x...> repr instead of a proper error. With helm install --wait, the failed hook causes the entire release to report FAILED.


🛠️ Changes Made

  • Added seaweedfs.s3.region: us-east-1 to values.yaml as the configurable region for the bucket-init job's AWS CLI calls
  • Added mlrun-ce.s3.region helper in _helpers.tpl
  • Set AWS_DEFAULT_REGION and AWS_EC2_METADATA_DISABLED=true on the create-bucket container in s3-bucket-init-job.yaml
  • Redirected stderr to stdout (2>&1) on both aws s3 commands so future failures produce readable log output
  • Bumped chart version 0.12.0-rc.30.12.0-rc.4

✅ Checklist

  • I have tested the changes in this PR
  • I confirmed whether my changes require a change in documentation and if so, I created another PR in MLRun for the relevant documentation.
  • I confirmed whether my changes require a changes in QA tests, for example: credentials changes, resources naming change and if so, I updated the relevant Jira ticket for QA.
  • I increased the Chart version in charts/mlrun-ce/Chart.yaml.
  • I confirmed that the installation works both on a local Docker Desktop environment and on a real cluster when using the required prerequisites.
    • If installation issues were found, I updated the relevant Jira ticket with the issue and steps to reproduce, or updated the prerequisites documentation if the issue is related to missing or outdated prerequisites.
  • If needed, update https://github.com/mlrun/ce/blob/development/charts/mlrun-ce/README.md with the relevant installation instructions and version Matrix.
  • If needed, update the following values files for multi namespace support:

🧪 Testing

  • helm template mlrun charts/mlrun-ce -f charts/mlrun-ce/values.yaml --show-only templates/seaweedfs/s3-bucket-init-job.yaml — confirms AWS_DEFAULT_REGION=us-east-1 and AWS_EC2_METADATA_DISABLED=true render correctly
  • helm lint charts/mlrun-ce — passes (0 failed)

🔗 References


🚨 Breaking Changes?

  • Yes (explain below)
  • No

🔍️ Additional Notes

The existing aws s3 mb || aws s3 ls idempotency fallback is unchanged — it already handles the "bucket already exists" case from CEML-698. This fix addresses a separate failure mode (IMDS region discovery) that reproduces on genuinely fresh installs with no pre-existing bucket.

No changes needed to the three install-mode values files — they only toggle seaweedfs.enabled and do not override seaweedfs.s3.

tal-haim and others added 2 commits July 9, 2026 14:40
…crash

The create-bucket container never set AWS_DEFAULT_REGION/AWS_REGION, so
botocore fell back to EC2 IMDS region discovery inside the pod. That call
fails in most Kubernetes environments (especially Azure) and hits a
long-standing botocore bug that prints a raw AWSRequest object repr instead
of a proper error, crashing the job even on a fresh install with no
pre-existing bucket.

Co-authored-by: Cursor <cursoragent@cursor.com>
…nit job

The AWS_REGION environment variable was removed from the s3-bucket-init job as it was redundant. The job now only sets AWS_DEFAULT_REGION, preventing unnecessary configuration and potential confusion.

Co-authored-by: Cursor <cursoragent@cursor.com>

@royischoss royischoss left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM small improvement suggestion

Comment thread charts/mlrun-ce/templates/seaweedfs/s3-bucket-init-job.yaml Outdated
@royischoss royischoss changed the title [CEML-721] Fix s3-bucket-init job IMDS region crash [Fix] s3-bucket-init job IMDS region crash Jul 9, 2026
@github-actions github-actions Bot added the bug Something isn't working label Jul 9, 2026
Comment thread charts/mlrun-ce/templates/seaweedfs/s3-bucket-init-job.yaml Outdated
Comment thread charts/mlrun-ce/Chart.yaml Outdated
name: mlrun-ce
version: 0.12.0-rc.3
version: 0.12.0-rc.4
appVersion: 1.12.0-rc16

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please update to the latest RC - https://github.com/mlrun/mlrun/releases and also in the values.yaml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can you verify now?

…gion variable

This commit updates the MLRun app version in Chart.yaml and values.yaml to 1.12.0-rc18. Additionally, the redundant S3 region variable has been removed from the templates, simplifying the configuration for the s3-bucket-init job.
@tal-haim
tal-haim requested a review from GiladShapira94 July 9, 2026 16:19
Comment thread charts/mlrun-ce/templates/seaweedfs/s3-bucket-init-job.yaml Outdated
The action's install script creates its cache dir before verifying the
downloaded binary's signature via cosign/Rekor, so a transient upstream
verification failure leaves a stale empty cache dir behind. Retry once
after clearing it so a flaky Rekor lookup doesn't fail the whole job.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tal-haim
tal-haim requested a review from GiladShapira94 July 12, 2026 07:31
…ommand

Improves troubleshooting when both aws s3 mb and ls fail by echoing
a clear failure reason in job logs (PR review feedback).

Co-authored-by: Cursor <cursoragent@cursor.com>
@tal-haim
tal-haim force-pushed the fix/CEML-721-s3-bucket-init-region branch from 1f07012 to f1fe14d Compare July 12, 2026 08:19

@GiladShapira94 GiladShapira94 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@tal-haim
tal-haim merged commit 6d47746 into mlrun:development Jul 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants