Skip to content

Conversation

@wking
Copy link
Member

@wking wking commented Dec 17, 2021

Since openshift/installer#4112, clusters born in 4.7 or later default to not having an explicit spec.upstream, so they rely on the CVO's internal default. However, in that case, u.Upstream will be an empty string, while by this point in syncAvailableUpdates, upstream will have been set to the default value. This commit splits up the "do we really need to check?" logic into a number of distinct cases, and gives them more specific logging, to make it easier to understand and confirm the desired behavior:

a. If we have no cached data, we need to pull a graph.
b. If it's been over minimumUpdateCheckInterval since our last check, we need to pull a graph. Even if nothing has changed on our side, our data is sufficiently stale to need a refresh.
c. If the channel has changed, we have different interests, and we need to pull a graph to hear what the upstream recommends for this new set of interests.
d. If the upstream hasn't changed, because:
i. The current upstream (explicitly or by default) matches the old explicit upstream, or
ii. The current upstream (explicitly or by default) matches the default, and the old upstream was unset.
then everything's the same on our side, and our cached graph is recent, so we don't need to do anything.
e. Otherwise, the upstream has changed, and we need to pull a graph to see what our new guide has to suggest.

Cases for upstream:

  • A -> A: Handled by d.i.
  • A -> B: Handled by e.
  • A -> unset (defaulted) or default: Handled by e.
  • Unset or default -> A: Handled by e.
  • Default -> default: Handled in d.i.
  • Default -> unset (defaulted): Handled in d.i.
  • Unset -> default: Handled by d.ii, new in this commit, previously resulted in an excessive pull.
  • Unset -> unset (defaulted): Handled by d.ii, new in this commit, previously resulted in an excessive pull.

@wking wking force-pushed the default-upstream-in-recent-update-throttling branch from ae7560a to 1640c28 Compare December 17, 2021 08:45
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 17, 2021
…e throttling

Since [1], clusters born in 4.7 or later default to not having an
explicit spec.upstream, so they rely on the CVO's internal default.
However, in that case, u.Upstream will be an empty string, while by
this point in syncAvailableUpdates, upstream will have been set to the
default value.  This commit splits up the "do we really need to
check?" logic into a number of distinct cases, and gives them more
specific logging, to make it easier to understand and confirm the
desired behavior:

a. If we have no cached data, we need to pull a graph.
b. If it's been over minimumUpdateCheckInterval since our last check,
   we need to pull a graph.  Even if nothing has changed on our side,
   our data is sufficiently stale to need a refresh.
c. If the channel has changed, we have different interests, and we
   need to pull a graph to hear what the upstream recommends for this
   new set of interests.
d. If the upstream hasn't changed, because:
   i. The current upstream (explicitly or by default) matches the old
      explicit upstream, or
   ii. The current upstream (explicitly or by default) matches the
       default, and the old upstream was unset.
   then everything's the same on our side, and our cached graph is
   recent, so we don't need to do anything.
e. Otherwise, the upstream has changed, and we need to pull a graph to
   see what our new guide has to suggest.

Cases for upstream:

* A -> A: Handled by d.i.
* A -> B: Handled by e.
* A -> unset (defaulted) or default: Handled by e.
* Unset or default -> A: Handled by e.
* Default -> default: Handled in d.i.
* Default -> unset (defaulted): Handled in d.i.
* Unset -> default: Handled by d.ii, new in this commit, previously
  resulted in an excessive pull.
* Unset -> unset (defaulted): Handled by d.ii, new in this commit,
  previously resulted in an excessive pull.

[1]: openshift/installer#4112
@wking wking force-pushed the default-upstream-in-recent-update-throttling branch from 1640c28 to 36c670f Compare December 17, 2021 18:00
@wking wking changed the title pkg/cvo/availableupdates: Acount for default upstream in recent-change throttling Bug 2033745: pkg/cvo/availableupdates: Acount for default upstream in recent-change throttling Dec 17, 2021
@openshift-ci openshift-ci bot added the bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. label Dec 17, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 17, 2021

@wking: This pull request references Bugzilla bug 2033745, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.10.0) matches configured target release for branch (4.10.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @jianlinliu

Details

In response to this:

Bug 2033745: pkg/cvo/availableupdates: Acount for default upstream in recent-change throttling

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Dec 17, 2021
@openshift-ci openshift-ci bot requested a review from jianlinliu December 17, 2021 18:21
if u != nil && u.Upstream == upstream && u.Channel == channel && u.RecentlyChanged(optr.minimumUpdateCheckInterval) {
klog.V(4).Infof("Available updates were recently retrieved, will try later.")
if u == nil {
klog.V(4).Info("First attempt to retrieve available updates")
Copy link
Member

Choose a reason for hiding this comment

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

Why not add upstream url for logging?

Copy link
Member Author

Choose a reason for hiding this comment

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

We log that later, when we actually make the request:

$ git --no-pager grep 'to request updates from' pkg/cincinnati
pkg/cincinnati/cincinnati.go:                   klog.V(5).Infof("Using a root CA pool with 0 root CA subjects to request updates from %s", uri)
pkg/cincinnati/cincinnati.go:                   klog.V(5).Infof("Using a root CA pool with %n root CA subjects to request updates from %s", len(c.transport.TLSClientConfig.RootCAs.Subjects()), uri)
pkg/cincinnati/cincinnati.go:                   klog.V(5).Infof("Using proxy %s to request updates from %s", proxy.Host, uri)

In between this line and that, we can still bail out for reasons like "channel is empty"

Copy link
Member

@LalatenduMohanty LalatenduMohanty 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
Copy link
Contributor

openshift-ci bot commented Dec 17, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: LalatenduMohanty, wking

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [LalatenduMohanty,wking]

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

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 17, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 17, 2021

@wking: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit ede5b83 into openshift:master Dec 17, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 17, 2021

@wking: All pull requests linked via external trackers have merged:

Bugzilla bug 2033745 has been moved to the MODIFIED state.

Details

In response to this:

Bug 2033745: pkg/cvo/availableupdates: Acount for default upstream in recent-change throttling

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@wking wking deleted the default-upstream-in-recent-update-throttling branch December 17, 2021 23:08
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. bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants