Skip to content

Refactor build API and controller - #335

Merged
openshift-bot merged 3 commits into
openshift:masterfrom
ironcladlou:build-cache
Nov 5, 2014
Merged

openshift-bot merged 3 commits into
openshift:masterfrom
ironcladlou:build-cache

Conversation

@ironcladlou

Copy link
Copy Markdown
Contributor

Refactor the build API and validation. Refactor the build controller
to use the upstream cache package where possible. Use watches wherever
possible.

ironcladlou and others added 2 commits November 4, 2014 15:07
Refactor the build API and validation. Refactor the build controller
to use the upstream cache package where possible. Use watches wherever
possible.
Add test coverage for refactored builds.
@ironcladlou

Copy link
Copy Markdown
Contributor Author

[test]

@ironcladlou

Copy link
Copy Markdown
Contributor Author

Will add a commit to this PR to update existing example JSON for builds.

@openshift-bot

Copy link
Copy Markdown
Contributor

@ironcladlou

Copy link
Copy Markdown
Contributor Author

[test] again with updated examples.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Please note that this is required due to the fact that pods aren't updated in storage to stay in sync with container states, so the only way to get events for container state updates right now is to poll. To retain queue semantics, we're populating the FIFO with a cache.Poller.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@smarterclayton Would something like cadvisor help here? We really need the pod status to stay in sync with their container states to avoid polling here and in the CustomPod controller for deployments.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you get your answer here? This is a hard problem and I'm not sure we can do anything better than polling.

On Nov 4, 2014, at 3:34 PM, Dan Mace [email protected] wrote:

In pkg/build/controller/factory/factory.go:

+type BuildControllerFactory struct {

  • Client *osclient.Client
  • KubeClient *kclient.Client
  • DockerBuildStrategy *strategy.DockerBuildStrategy
  • STIBuildStrategy *strategy.STIBuildStrategy
    +}

+func (factory *BuildControllerFactory) Create() *controller.BuildController {

  • buildStore := cache.NewStore()
  • cache.NewReflector(&buildLW{client: factory.Client}, &buildapi.Build{}, buildStore).Run()
  • buildQueue := cache.NewFIFO()
  • cache.NewReflector(&buildLW{client: factory.Client}, &buildapi.Build{}, buildQueue).Run()
  • podQueue := cache.NewFIFO()
  • cache.NewPoller(factory.pollPods, 10*time.Second, podQueue).Run()
    @smarterclayton Would something like cadvisor help here? We really need the pod status to stay in sync with their container states to avoid polling here and in the CustomPod controller for deployments.

—
Reply to this email directly or view it on GitHub.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@smarterclayton I got a referral to Dawn Chen. I'll follow up tomorrow. While the polling is unfortunate, I'm at least happy that we can use a queue internally. If we come up with something better we can swap in a new FIFO-feeder.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Code docs added to explain this: #344

@ironcladlou

Copy link
Copy Markdown
Contributor Author

Ready for review. cc @bparees @csrwng @jcantrill @soltysh @pmorie

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ironcladlou Is this needed since you have line 53?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jcantrill Actually I should have just made 53 look like:

var nextStatus BuildStatus

since all paths lead to an assignment.

I'm not sure if I care to rewrite history to amend the original commit for this right now though.

@bparees

bparees commented Nov 5, 2014

Copy link
Copy Markdown
Contributor

lgtm.

@bparees

bparees commented Nov 5, 2014

Copy link
Copy Markdown
Contributor

[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin up to de0758b

@soltysh

soltysh commented Nov 5, 2014

Copy link
Copy Markdown
Contributor

🎱 good to see it here

openshift-bot pushed a commit that referenced this pull request Nov 5, 2014
@openshift-bot
openshift-bot merged commit 9c00459 into openshift:master Nov 5, 2014
Comment thread pkg/build/api/types.go

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Godoc is wrong

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ironcladlou
ironcladlou deleted the build-cache branch November 7, 2014 20:01
miminar pushed a commit to miminar/origin that referenced this pull request Oct 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants