Skip to content

Fix kubernetes dev run script #12229

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

Merged
merged 4 commits into from
Feb 6, 2025
Merged

Fix kubernetes dev run script #12229

merged 4 commits into from
Feb 6, 2025

Conversation

dfangl
Copy link
Member

@dfangl dfangl commented Feb 5, 2025

Motivation

With recent refactorings to namespace packaging (#11190 ) and usage of setuptools_scm (#11355) the kubernetes dev run script broke.
It still mounted pro source code into site-packages/localstack-ext and not inside the localstack namespace package, and the entrypoint mounts did not take into account the new versioning scheme.

A main culprit was the implicit behavior of taking parts of the path from the host and using them inside the container, as this prevented mounting the pro source code in the localstack/pro directory.
Changing this required some refactoring.

Changes

  • The mount points are now generated in a separate method, and into a defined data structure. This provides more flexibility, as previous behavior was very implicit (taking the last part of the path on the host for mounting into the container for example). The config generation methods use the data and convert it into the respective format, without additional logic.
  • Add --mount-entrypoints flag, to manually opt in to mounting the entrypoints. I did not yet implement a version detection to mount the entrypoints into the right .egg-info directory, so this has to be manually adjusted currently for the versions inside the docker image, if used.
  • Add CONTAINER_RUNTIME=kubernetes and lambda.executor=kubernetes config to the value overrides if pro is enabled
  • Fix some errors when mounting code into the community package (as the package installation of localstack-core differs in community from pro)

Testing

Run python -m localstack.dev.kubernetes --pro --write --output-dir=<config-dir> and follow the instructions.

@dfangl dfangl requested a review from simonrw February 5, 2025 08:37
@dfangl dfangl requested a review from thrau as a code owner February 5, 2025 08:37
@dfangl dfangl added the semver: patch Non-breaking changes which can be included in patch releases label Feb 5, 2025
Copy link

github-actions bot commented Feb 5, 2025

S3 Image Test Results (AMD64 / ARM64)

  2 files    2 suites   8m 33s ⏱️
476 tests 424 ✅  52 💤 0 ❌
952 runs  848 ✅ 104 💤 0 ❌

Results for commit a7be55e.

Copy link

github-actions bot commented Feb 5, 2025

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 53m 48s ⏱️ + 1m 51s
4 083 tests ±0  3 766 ✅ ±0  317 💤 ±0  0 ❌ ±0 
4 085 runs  ±0  3 766 ✅ ±0  319 💤 ±0  0 ❌ ±0 

Results for commit 10c0590. ± Comparison against base commit 91fa86d.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

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

This change looks great, thanks!

)

# entrypoints
if mount_entrypoints:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we log a warning that this is currently not really implemented, and may provide confusing results if the user expects this to work

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, note for the future: we implement this in localstack.dev.run so we can take the implementation from there.

See localstack.dev.run.configurators._list_files_in_container_image

Copy link
Member Author

Choose a reason for hiding this comment

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

Will add some logging. The implementation can be used, the main issue is that the image in docker is not necessarily the same image in k3d, as it has a separate image store, and could pull the image (or just have a different version pulled). We would need to check the image version inside k3d, if the cluster is already running, or if not, we could check the latest one, but in general it is not guaranteed.

@dfangl dfangl merged commit 1b67f4f into master Feb 6, 2025
31 checks passed
@dfangl dfangl deleted the fix/kubernetes-dev-run branch February 6, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants