-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Wire up debug events #3645
Wire up debug events #3645
Conversation
- adds SkaffoldRunner.isDebugMode()
Codecov Report
|
pkg/skaffold/runner/debugging.go
Outdated
// isDebugMode returns true if we're running for debugging. | ||
func (r *SkaffoldRunner) isDebugMode() bool { | ||
return r.runCtx.Opts.Command == "debug" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I introduced this function to test whether Skaffold was launched as skaffold debug
. This works for debug, but it doesn't seem a great pattern — for example, debug effectively invokes dev under the hood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we already have a runContext.DevMode
that serves a similar purpose. Can we make this similar? I don't have a preference towards either, I just don't want inconsistency.
// Notify only when a container is Running or Terminated (not Waiting) | ||
// "ADDED" is never interesting since no containers are Running yet | ||
// "MODIFIED" may now have containers in Running or Terminated | ||
// "DELETED" if the pod is deleted | ||
if evt.Type != watch.Modified && evt.Type != watch.Deleted { | ||
continue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I observed when prototyping this functionality that I couldn't rely on the pod status. Rather I had to check on pod MODIFIED and DELETED events and then look at and track the individual container status (see below in checkPod()
). I would get spurious debug events otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, tried it and works
82f5168
to
1af9841
Compare
1af9841
to
e610746
Compare
Hmm...the new test just flaked:
|
I'm worried about the flake of TestDebugEventsRPC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to figure out what broke with --status-check=true
that just got merged to be the default.
So the cause is that I deviate from port-forwarding's watch event filtering, which looks at ADDED and MODIFIED events, whereas the container manager only looks at MODIFIED and DELETED watch events. Prior to the status checks, ADDED events seemed spurious as they had no Removing this watch event filtering and using only the container status makes everything work again. |
PTAL @balopat |
Relates to #3122 (#3564, #3609)
Fixes #2211
Description
This PR wires up the new
DebuggingContainerEvent
(#3609) to be fired by Skaffold when observing a debuggable container starting or terminating. These debugging containers are exposed via the Skaffold state object. With this PR, the IDEs can monitor for events to populate UIs.User facing changes
New events and addition to the Skaffold state.
There are no changes to the log. Although some logging may be useful for users seeking to configure their debuggers manually, I figured the port-forwarding messages would usually be sufficient.
`/v1/events` stream of `skaffold debug` within `examples/jib`
In this example, we do a
skaffold debug
, and then kill the deployed pod. The deployment starts a new pod. We get a terminated event for the container for the killed pod.The `/v1/state` listing debugging containers
Next PRs.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
Adds documentation as needed: user docs, YAML reference, CLI reference.already doneReviewer Notes
Release Notes