Skip to content

remote-run for toolbox containers #4042

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

piax93
Copy link
Contributor

@piax93 piax93 commented Apr 9, 2025

Forgive me PaaSTA gods for the sins I'm about to commit.

Hi, I know this is a bit... hacky, but it's the best way I could think to reuse the same implementation. If I had to describe the change with one image, it'd be something like:
image

So, to explain a bit, the plan which was discussed internally as result of the CEP is to re-use the same remote-run logic to launch "toolbox container" which would give access to selected CLI tools to developers. We don't want these images to be deployed like mock services, as that would be scope creep of what's supposed to be in soa-configs, and we only require some small set of startup settings anyways. So the plan would be to define those settings as part of the paasta system config, and generate a deployment configuration on the fly from them, which is exactly what this change does.

I tested the generation of a K8s Job spec from this assembled configuration, and it looks reasonable to me. The one thing will lose meaning is the "git_sha" field, as that's strictly related to how paasta actually marks deployments, but I don't think that would create problems.

I had to just make a couple of adjustments to the main deployment logic:

  • Added an option to set "privileged" in the pods' security context, as we need that to run sshd with pamd.
  • Added an option to override the container registry base URL, as the sandbox images would live outside the PaaSTA registry, since they are not service images (I'm honestly flexible on this, but it seemed a good separation of concerns).

The final notable difference is that, since we set up sshd in these pods, we don't need to kubectl exec into them, but just grab the pod IP as part of the status polling response, and ssh directly into them. This choice was done since it makes it way easier to audit user actions inside the containers.

Copy link
Member

@Qmando Qmando left a comment

Choose a reason for hiding this comment

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

Generally looks good to me. No strong opinions on this vs the alternative for the toolbox config scheme

Comment on lines +152 to 157
instance_or_toolbox.add_argument(
"--toolbox",
help="The selected service is a 'toolbox' container",
action="store_true",
default=False,
)
Copy link
Member

Choose a reason for hiding this comment

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

Could we leave this out and derive it entirely from the service arg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but I usually prefer to be explicit with this stuff. Ensures that the default behaviour will always be to launch a service pod, without relying on a naming convention.

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.

2 participants