Skip to content

Conversation

@Michaelvll
Copy link
Collaborator

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):

  • Code formatting: install pre-commit (auto-check on commit) or bash format.sh
  • Any manual or new tests for this PR (please specify below)
    • On coreweave: sky 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)
    • On Coreweave: 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
  • All smoke tests: /smoke-test (CI) or pytest tests/test_smoke.py (local)
  • Relevant individual tests: /smoke-test -k test_name (CI) or pytest tests/test_smoke.py::test_name (local)
  • Backward compatibility: /quicktest-core (CI) or pytest tests/smoke_tests/test_backward_compat.py (local)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 imagePullSecrets and manages their lifecycle, including automatic creation and deletion, thereby simplifying private image access and reducing operational overhead for users.

Highlights

  • Kubernetes Private Registry Authentication: Introduced support for authenticating with private Docker registries on Kubernetes clusters using environment variables (e.g., SKYPILOT_DOCKER_USERNAME, SKYPILOT_DOCKER_PASSWORD, SKYPILOT_DOCKER_SERVER), aligning the workflow with cloud VMs.
  • Automatic Kubernetes Secret Management: SkyPilot now automatically creates and manages Kubernetes imagePullSecrets based on the provided environment variables, eliminating the need for manual secret creation.
  • Secret Cleanup: Implemented automatic cleanup of the generated Docker registry secrets when a Kubernetes cluster or its pods are terminated.
  • Documentation Updates: Updated documentation to reflect the new method for private registry access, clarifying its applicability to both VMs and Kubernetes, and providing guidance on its usage.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

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}}

Copy link
Collaborator Author

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

@Michaelvll
Copy link
Collaborator Author

Michaelvll commented Dec 22, 2025

/smoke-test --kubernetes -k test_private_docker_registry - ✅ Passed

…reate-docker-secret-with-env-var

# Conflicts:
#	docs/source/examples/docker-containers.rst
@Michaelvll Michaelvll requested a review from aylei December 22, 2025 02:28
Copy link
Collaborator

@aylei aylei left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @Michaelvll !

Comment on lines +993 to +996
for container in pod_spec['spec']['containers']:
image = container.get('image', '')
if image:
container['image'] = docker_login_config.format_image(image)
Copy link
Collaborator

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)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants