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

[Design Proposal] Event API v2 #1949

Merged
merged 2 commits into from
May 20, 2019

Conversation

nkubala
Copy link
Contributor

@nkubala nkubala commented Apr 11, 2019

Slightly reworked version of #1854

@codecov-io
Copy link

Codecov Report

Merging #1949 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1949   +/-   ##
=======================================
  Coverage   52.16%   52.16%           
=======================================
  Files         180      180           
  Lines        7963     7963           
=======================================
  Hits         4154     4154           
  Misses       3420     3420           
  Partials      389      389

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 642f7f9...8a4b8cb. Read the comment docs.

}
```

The main drawback here is that for builds run in parallel, the statuses will not truly reflect reality until all builds are completed, but I don't believe users will see much of an effect from this.
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree.

  • Most of the time, the artifactsToBuild will just have one item
  • And even if there are more items, builds will usually succeed, which means the users are mainly interested in "when is the whole build cycle complete".

Copy link
Contributor

@tejal29 tejal29 Apr 22, 2019

Choose a reason for hiding this comment

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

umm i kind of disagree.
For microservices, usually # of artifactsToBuild is > 1.

Can we instead use go channels?
Build, Deploy will now consume a channel to write events or bRes to.
The runner will emit events for build artifacts that are written to the channel?

Copy link
Contributor

@corneliusweig corneliusweig Apr 23, 2019

Choose a reason for hiding this comment

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

@tejal29 I may be mistaken, but usually the build is triggered by the watcher, right? This means that the reason was some user change. And users usually make small confined changes in one source code file. Therefore I think that the queue should most of the time have just one dirty artifact (the one that edited file belongs to).
This of course does not apply to the first run where all artifacts are built.

Copy link
Contributor

@tejal29 tejal29 Apr 23, 2019

Choose a reason for hiding this comment

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

@corneliusweig good point. For dev loop this would not affect much.
Builds can be triggered by

  1. skaffold build
  2. skaffold run
  3. skaffold dev
    In first 2 cases, parallel builds happen and events will be triggered at the end of all builds.

For dev,
Ideally, one file should be part of one artifact, however if a file belong to common library then all the artifacts may need to be rebuilt.
Consider a bazel example.

apiVersion: skaffold/v1beta8
kind: Config
build:
  artifacts:
  - image: gcr.io/k8s-skaffold/skaffold-bazel-frontend
    bazel:
      target: //:skaffold_example-frontend.tar
  - image: gcr.io/k8s-skaffold/skaffold-bazel-backend
    bazel:
      target: //:skaffold_example-backend.tar

The targets skaffold_example-frontend and skaffold_example-backend depend on target //common-lib
In this case if user changes a file in common-lib, both of the images should trigger a build

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this is the key contentious part in this redesign.
go channels would be definitely a correct solution to stream build events - but it feels like a very large scale change. That could be a follow-up - or maybe we can totally punt it until we see evidence around needing it - and go with the @corneliusweig's assumption that I think can be true as well that - except the first build - most of the actual builds are going to be single artifact builds.
Also, as I mentioned above, I agree that we should consult with the IDE teams on "batch" vs "streamed" build events.

Copy link
Contributor

Choose a reason for hiding this comment

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

go channels would be definitely a correct solution to stream build events - but it feels like a very large scale change.

I don't agree "a very large scale change" should be a measure to punt or shelf functionality to implement for later.
We don't have evidence for our current assumption either which is "most of the times its a single artifact build"
Maybe our assumption is wrong.

That being said, we need arrive to a reasonable decision especially in this scenario where do not have data on how users are using skaffold, how long their build are, and hence stakeholders come in to picture.
We do need to make it sure, the consumers of Event API know that these events are now going to be batched.

Copy link
Contributor

Choose a reason for hiding this comment

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

For the record - I did change my mind on this and pushed for keeping the "realtime" behavior in our conversations.

Copy link
Contributor

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

makes sense to me!

if res.Error != nil {
event.BuildFailed(res.Target, res.Error)
} else {
event.BuildComplete(res.Target)
Copy link
Contributor

Choose a reason for hiding this comment

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

Who are consuming these events?
Is it the IDE team? If that is the case, we should get them involved as a stake holder.

Copy link
Contributor

Choose a reason for hiding this comment

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

In general I agree, and they are actively testing the functionality.
This redesign is targeting the internal details and should not impact the functionality of the Event API. Not sure if it would be productive to involve them at this level, they are interfacing with the HTTP/gRPC level.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, in this re-design we are changing the functionality a little bit since we are changing when the events get triggered.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually - I take that back - the change in "streaming" vs "batch" events for multi-artifact builds is very much worthwhile to bring up to the IDE teams.

* Author: Nick Kubala
* Design Shepherd: Any volunteers? :)
* Date: 04/11/19
* Status: [Reviewed/Cancelled/Under implementation/Complete]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Status: [Reviewed/Cancelled/Under implementation/Complete]
* Status: [Cancelled]

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

Let's merge this in for historical decision tracking

@nkubala nkubala merged commit 22011a9 into GoogleContainerTools:master May 20, 2019
@nkubala nkubala deleted the event-api-design branch May 20, 2019 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants