-
Notifications
You must be signed in to change notification settings - Fork 881
[Kubernetes] Add support for using env vars to specify container registry keys #8373
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
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @Michaelvll, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience for deploying applications with private Docker images on Kubernetes clusters via SkyPilot. It streamlines the authentication process by allowing users to specify Docker registry credentials using familiar environment variables, similar to how it's handled for traditional cloud VMs. SkyPilot now intelligently translates these environment variables into Kubernetes Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This PR introduces a convenient way to use private Docker registries on Kubernetes by leveraging environment variables, aligning the user experience with other cloud backends. The implementation is solid, involving the creation and cleanup of Kubernetes secrets for Docker credentials. The documentation has also been updated to reflect this new feature. I've found one minor issue in the Jinja2 template that could affect authentication. Otherwise, the changes look good.
| username: |- | ||
| {{docker_login_config.username}} | ||
| password: |- | ||
| {{docker_login_config.password | indent(8) }} |
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.
The indent(8) filter for the password seems incorrect. It will add 8 leading spaces to the password value, which will likely cause authentication to fail. The username and server fields are correctly indented without this filter. Removing | indent(8) should fix this.
{{docker_login_config.password}}
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.
this is intended, as the password can have multiple lines
|
/smoke-test --kubernetes -k test_private_docker_registry - ✅ Passed |
…reate-docker-secret-with-env-var # Conflicts: # docs/source/examples/docker-containers.rst
aylei
left a comment
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.
LGTM, thanks @Michaelvll !
| for container in pod_spec['spec']['containers']: | ||
| image = container.get('image', '') | ||
| if image: | ||
| container['image'] = docker_login_config.format_image(image) |
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.
Nit: we might want to format the image in resources. As the final manifest might have been overlayed and the overlay may add sidecars (not sure if it possible now)
In this PR, we automatically creates imagePullSecret for user who would like to specify the registry credentials locally, and keep it aligned with cloud VMs.
Tested (run the relevant ones):
bash format.shsky launch -c test-registry-no-prefix --image-id docker:my-project/sky-test-private-image/test-image:latest --env SKYPILOT_DOCKER_PASSWORD="$(cat gcp-key.json)" test.yaml(test.yaml includes the env vars for GAR access)sky launch -c test-registry-no-prefix --image-id docker:us-docker.pkg.dev/us-my-project/sky-test-private-image/test-image:latest --env SKYPILOT_DOCKER_PASSWORD="$(cat gcp-key.json)" test.yaml/smoke-test(CI) orpytest tests/test_smoke.py(local)/smoke-test -k test_name(CI) orpytest tests/test_smoke.py::test_name(local)/quicktest-core(CI) orpytest tests/smoke_tests/test_backward_compat.py(local)