-
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
Add file sync to Event and State APIs #2978
Conversation
Codecov Report
|
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.
Thanks @Multiply for your PR.
This looks great! Can we break this in 2 PRs. Please see our in progress small PR guidelines
#2977
- With the new proto definition and event Methods.
- Integrate it with the dev flow.
That would help us concentrate on smaller changes.
Comments for the proto:
- Do you plan to send event per file synced in a container?
- in that case should we have the filename instead of file count
- or the copies are too fast and it should not matter?
- Having filename in the event will help users identify which file synced successfully and which did not so they do understand why it failed. Based on that information, they could change their sync definition if its wrong or copy the file manually. WDYT?
For the skaffold/event/event.go, Can you add methods
i. InProgress
ii. Succeeded
iii. Failed.
See Use enum instead of string for "InProgress" , "Succeeded", "Started", "Failed" #2967
Sure. I'll get on that, when we have an alignment on the proto definition (with regards to files etc.)
For our specific use case, we don't need the actual files, that was changed, but merely that a sync happened. (like the one you see in the Skaffold output when it's watching for changes)
Based on my answer above, which format do you propose? One event, with a Changes, and deletes?
Do you just want me to rename my |
so, i re-read the sync code and looks like we create a tar of all files changes in an image and only execute 1 sync. So, we can't have one sync event per file, so we can only do one sync event per image and thats what your proposed implementation does. Lets not change it.
I think for now let's not include the filename. We could support this in future, especially if tools like Cloud Code (they consume events) need information on which files were part of the failed sync and which container so they can potentially suggest a fixable action.
yes |
77d947f
to
b89858b
Compare
b4df5d9
to
c8d4499
Compare
c8d4499
to
a00065a
Compare
The problem we're facing
We're running a local builder, and we sync the built files to our container, to then serve them to the browser.
As soon as the local builder is done, it refreshes the browser, expecting it to be ready to be served, but in most instances (read; almost all instances), Skaffold hasn't started, or is not done with the file sync.
Our current solution
Add a timeout in our local builder, to reload the browser after a second. This slows down development.
Our proposed solution with the help of this PR
Listen for new Skaffold events over gRPC or plain HTTP, and reload the browser as soon as we see
FileEventSync
with aStatus
ofComplete
.The problem we have at the moment, is the browser reloads as soon as the local build tool is done, but before the files have reached the pod, so we see no changes in the browser.
With this, we can follow skaffold events in our build-chain when in watch-mode, and reload the browser as soon as Skaffold informs us that it's ready.
Without this, we have to resort to odd timeouts before doing a reload, which results in poor developer experience.
This spawned from a short chat on Slack, where we needed to reload our browsers as soon as files built on the host machine has landed inside the pods, and is ready to be served.
I forgot to create an issue after we had the initial talk, so please let me know if I need to still do that.
Relates to Event and State APIs
Should merge before : #3009
Description
Add
FileSyncEvent
that notifies about the status, file count, and image for a given file sync.Add
FileSyncState
that keeps state of current file sync.User facing changes
Before
No events are fired when file sync is triggered.
No state available for current file sync.
After
FileSyncEvent
with statusInProgress
is fired, when a file sync is triggered.FileSyncEvent
with statusFailed
is fired, if a file sync fails.FileSyncEvent
with statusComplete
is fired, when a file sync is complete without errors.FileSyncState
is updated when the events above are fired.Next PRs.
#3009
Submitter Checklist
Adds documentation as needed: user docs, YAML reference, CLI reference.Adds integration tests if needed.Reviewer Notes
Release Notes