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

feat(executor): Wait for termination using pod watch for PNS and K8SAPI executors. #4253

Merged
merged 64 commits into from
Oct 22, 2020

Conversation

alexec
Copy link
Contributor

@alexec alexec commented Oct 9, 2020

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • My organization is added to USERS.md.
  • I've signed the CLA.
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My builds are green. Try syncing with master if they are not.

This PR introduces two improvements:

  • If the PNS executor cannot get the main PID (because it is runAsNonRoot it uses a pod watch to determine if the main container terminated. This allows you to use PNS with runAsNonRoot, improving its security.
  • Replaces the K8SAPI executor hard-loop with the same code, improving its scalability.

@alexec alexec added epic/scaling type/security Security related labels Oct 9, 2020
@alexec alexec requested a review from dtaniwaki October 9, 2020 15:13
@alexec alexec marked this pull request as ready for review October 14, 2020 22:33

func UntilTerminated(kubernetesInterface kubernetes.Interface, namespace, podName, containerID string) error {
log.Infof("Waiting for container %s to be terminated", containerID)
podInterface := kubernetesInterface.CoreV1().Pods(namespace)
Copy link
Member

Choose a reason for hiding this comment

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

I like this idea. It is safer than earlier

Copy link
Member

@sarabala1979 sarabala1979 left a comment

Choose a reason for hiding this comment

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

LGTM the implementations. @jessesuen Can you quickly look at the security point of view?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/security Security related
Projects
None yet
3 participants