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

Log pods for which we deployed the owner #4586

Closed
wants to merge 1 commit into from

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented Jul 29, 2020

This PR is an experiment. Many things are broken.

This is how application logs work in Skaffold:

  • A logger watches for all the pod event in a set of namespaces
  • For each pod event, we look for the images used in the pod.
  • If any container in that pod uses an image that Skaffold built, we output the logs for that container

This is tricky because:

  • We might end up logging a pod that was deployed beforehand and uses the same image tags.
  • We miss the pods that Skaffold deployed but that use pre-built images

We tried to rely on the runID label to solve that issue but it also has issues:

  • The runID mechanism break idempotency: a skaffold run just after a skaffold run should do nothing. With the runID, every object is updated.
  • If we switch from a runID label to a runID annotation, it will not cascade down to the pods.

This PR introduces a new mechanism:

  • kubectl/kustomize deployer, returns the list of resources it applied, with their uid. We keep that.
  • helm deployer used to add a label to the resources it deployed. Instead, we'll collect all the uids.
  • the pod watcher, when it sees a pod event looks for the top level parent and checks that this is in the set of uids we deployed.

Signed-off-by: David Gageot [email protected]

}

var resources kubectl.Resources

for _, res := range results {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this loops []Artifacts which only contains skaffold-built images, this still won't select containers for pre-built images which belong to a different Deployment altogether; it only improves upon init containers and multi-container pods, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

exactly. Not yet.

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

Successfully merging this pull request may close these issues.

3 participants