Skip to content
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

Add --replace flag to intercept command #3469

Merged
merged 2 commits into from
Dec 29, 2023

Conversation

petergardfjall
Copy link
Contributor

@petergardfjall petergardfjall commented Dec 28, 2023

Description

This PR adds a --replace flag to the telepresence intercept command which, when specified, will replace application containers in the intercepted workload.

This PR builds on the server-side machinery implemented in #3330.

Having the possibility to replace workload containers should provide a solution for tickets like #1646 and #1608.

Checklist

  • I made sure to update ./CHANGELOG.yml.
  • I made sure to add any docs changes required for my change (including release notes).
  • My change is adequately tested.
  • I updated DEVELOPING.md with any special dev tricks I had to use to work on this code efficiently.
  • I updated TELEMETRY.md if I added, changed, or removed a metric name.
  • Once my PR is ready to have integration tests ran, I posted the PR in #telepresence-dev in the datawire-oss slack so that the "ok to test" label can be applied.

@thallgren
Copy link
Member

Hi @petergardfjall . Thanks for providing this. Can you please sign your commit and also please fix the lint complaint?

@petergardfjall
Copy link
Contributor Author

Hi @petergardfjall . Thanks for providing this. Can you please sign your commit and also please fix the lint complaint?

Hi @thallgren, I've addressed your comments.

One thing I noted is that in its present shape --replace won't preserve volume mounts of the original workload pod at the local mount point. I suppose that is to be expected since the replace will simply delete the workload pod (it is implemented by the deleteAppContainer patch if I'm reading it right). I suppose that patch would need to do finer-grained surgery on the application containers if the intercept is to preserve volume mounts. Perhaps something along the lines of:

  • replace image with k8s.gcr.io/pause (or similar)
  • remove readinessProbe and livenessProbe

That is perhaps a bit more similar in spirit to the swap-deployment command in Telepresence v1?

Either way I think that should not pollute this PR.
If you can provide some guidance I might take a stab at it in a follow-up PR.

@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Dec 29, 2023
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Dec 29, 2023
@thallgren
Copy link
Member

Agree about not polluting this PR. If mounts doesn't work, then that's a separate issue. Not sure why that doesn't work. It really should, even when the container is replaced.

The readinessProbe/livenessProbe intended for the deleted container is also something that needs to be fixed. Not sure about replacing the image with k8s.gcr.io/pause though. The agent really should take over whatever it's doing (including mounts).

@thallgren
Copy link
Member

This option is already present in our enterprise edition, so rather than asking you to provide an integration test, I pushed a commit to your branch with the test that we have already have.

@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Dec 29, 2023
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Dec 29, 2023
@thallgren thallgren merged commit 75a6d58 into telepresenceio:release/v2 Dec 29, 2023
18 checks passed
@petergardfjall
Copy link
Contributor Author

Agree about not polluting this PR. If mounts doesn't work, then that's a separate issue.

Opened an issue #3483 with a proposed fix in #3484.

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