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

graph-builder: add support for configuration file #69

Merged
merged 6 commits into from
Apr 10, 2019

Conversation

lucab
Copy link
Contributor

@lucab lucab commented Mar 12, 2019

This reworks plugins setup and graph-builder CLI parser to allow for sourcing complex/structured options from configuration file(s). In particular, configuration logic now cares about the following entities:

  • "options": configuration fragments (CLI flags, file snippets), optional and stringly-typed.
  • "unified config": configuration document, result of merging all options and defaults.
  • "app settings": runtime settings, result of config validation.

Ref: https://jira.coreos.com/browse/CORS-967
/cc @steveej

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 12, 2019
@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 12, 2019
@lucab lucab force-pushed the ups/config-toml branch from b328fb7 to d158577 Compare March 12, 2019 15:08
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 15, 2019
@lucab lucab force-pushed the ups/config-toml branch from d158577 to 970544e Compare March 18, 2019 13:57
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 18, 2019
@lucab
Copy link
Contributor Author

lucab commented Mar 18, 2019

Rebased to master and added graph-builder configuration options for #72 (comment).

@lucab lucab force-pushed the ups/config-toml branch 2 times, most recently from 24e4382 to f58304e Compare March 19, 2019 16:36
@lucab
Copy link
Contributor Author

lucab commented Mar 19, 2019

@steveej I've dropped all the plugins logic from here as requested, and split that to #74.

@lucab
Copy link
Contributor Author

lucab commented Mar 25, 2019

@steveej thanks for the review, I've taken most of your suggestions and amended the code. In particular, CLI and TOML are now sharing their types, and I've split a minor enhancement to #76. PTAL.

@lucab lucab force-pushed the ups/config-toml branch 3 times, most recently from 59eba02 to d5206e0 Compare April 1, 2019 14:07
@lucab
Copy link
Contributor Author

lucab commented Apr 1, 2019

@steveej I did a major rework on the PR in the direction of #69 (comment). This means that the Unified struct does not exist anymore, input parsing goes via structopt+serde, and most of the structs are re-used.

While this definitely still needs some polishing, can you please another pass to see if suits your taste better than the previous iteration?

Copy link
Contributor

@steveej steveej left a comment

Choose a reason for hiding this comment

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

The overall approach looks very clean to me, especially the simplicity of the assemble function.
I would've wished for some code generation (macros) for the merge implementations but I wouldn't block on that if there exists no ready-made solution right now.

I have added a couple of comments to be addressed and there are also some leftover from the previous review. Thanks for exploring this so thoroughly!

@lucab lucab force-pushed the ups/config-toml branch 3 times, most recently from f2d6f09 to 922ed46 Compare April 5, 2019 08:46
@lucab lucab changed the title [WIP] graph-builder: add support for configuration file graph-builder: add support for configuration file Apr 5, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 5, 2019
@lucab
Copy link
Contributor Author

lucab commented Apr 5, 2019

I added the final tests and documentation, completing the last TODOs. Dropped the WIP label, this is ready for the last round of review.

@steveej steveej self-requested a review April 6, 2019 09:10
steveej
steveej previously requested changes Apr 9, 2019
Copy link
Contributor

@steveej steveej left a comment

Choose a reason for hiding this comment

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

thanks for the nice rework!

there's a small doc change I'd like to make and a couple of questions/suggestions I added (please feel free to dismiss the suggestions).

@lucab lucab force-pushed the ups/config-toml branch from 4b98412 to 0eadb0b Compare April 9, 2019 12:55
@lucab lucab force-pushed the ups/config-toml branch from 0eadb0b to 44a5a3b Compare April 9, 2019 16:51
@lucab lucab requested a review from steveej April 9, 2019 16:52
@lucab
Copy link
Contributor Author

lucab commented Apr 9, 2019

Pushed another update addressing last comments, PTAL

Copy link
Contributor

@steveej steveej left a comment

Choose a reason for hiding this comment

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

🎉

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2019
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lucab, steveeJ

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit d392aa5 into openshift:master Apr 10, 2019
wking added a commit to wking/cincinnati that referenced this pull request Apr 3, 2020
The default seems to have lived in the 30s range since at least
517af6e (graph-builder: add support for configuration file,
2019-03-12, openshift#69).  But we can allow some latency here.  On the
cluster-version operator (CVO) side:

* cvo.New takes an argument for the poll interval [1].
* That is fed by resyncPeriod(o.ResyncInterval)() [2].
* ResyncInterval is set from minResyncPeriod [3].
* minResyncPeriod is 2 minutes [4].
* resyncPeriod adds some jitter (returning between 1x and 2x the input
  value) [5].

So should be uniformly distributed between 2 and 4 minutes.  That puts
a floor on latency in getting this information out to clusters.

It's also not a problem to add latency above the CVO-enforced floor.
A delay in minutes in getting a new release out into a channel is not
significant, because the biggest publication rush would be releasing a
CVE fix into the stable channel.  And that's already delayed by
needing to cook in the candidate and fast channels, and eventually
having the push to stable being a phased rollout.

A delay in pulling an edge that has proven itself unstable is more
serious, but we already have latencies in the minutes before alerts
fire, and Telemetry/Insights that report issues to Red Hat add
additional latencies in the minutes (Telemetry) to hours (Insights)
range.  Delaying the edge pull by a few more minutes is not going to
greatly increase overall cluster-breaks -> edge-pulled latency here.

The above discussion hopefully shows that there is little downside to
growing the latency up to several minutes.  With this commit, the
delay is 5 minutes plus the time it takes the plugins to execute (I'd
initially argued for 10m, but was bargained back down to 5 [6]).  The
upside is that it decreases our load on our external dependencies
(quay.io, GitHub), reducing issues like:

  [2020-03-31T21:35:16Z DEBUG graph_builder::graph] graph update triggered
  [2020-03-31T21:35:20Z ERROR graph_builder::graph] Checking for new commit
  [2020-03-31T21:35:20Z ERROR graph_builder::graph] Parsing {"message":"API rate limit exceeded for user ID ...","documentation_url":"https://developer.github.com/v3/#rate-limiting"} to Vec<Branch>
  [2020-03-31T21:35:20Z ERROR graph_builder::graph] invalid type: map, expected a sequence at line 1 column 0
  [2020-03-31T21:35:50Z DEBUG graph_builder::graph] graph update triggered

It's also reduces our CPU and network load, since the graph-builder
pod spends more time resting in between recalculate-the-graph spikes.
Just the load consideration is enough for me to want to tune this
latency as high as we can while keeping it well below other
edge-pulling latency components.

[1]: https://github.com/openshift/cluster-version-operator/blob/12623332615a0657a5468fae27cff1998a70bfef/pkg/cvo/cvo.go#L165
[2]: https://github.com/openshift/cluster-version-operator/blob/12623332615a0657a5468fae27cff1998a70bfef/pkg/start/start.go#L341
[3]: https://github.com/openshift/cluster-version-operator/blob/12623332615a0657a5468fae27cff1998a70bfef/pkg/start/start.go#L93
[4]: https://github.com/openshift/cluster-version-operator/blob/12623332615a0657a5468fae27cff1998a70bfef/pkg/start/start.go#L43
[5]: https://github.com/openshift/cluster-version-operator/blob/12623332615a0657a5468fae27cff1998a70bfef/pkg/start/start.go#L250-L251
[6]: openshift#264 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants