Skip to content

Revert builder.Unreachable() and add reachable check to builder.Build()#2109

Merged
openshift-merge-robot merged 2 commits into
openshift:masterfrom
lleshchi:HIVE-2300
Sep 7, 2023
Merged

Revert builder.Unreachable() and add reachable check to builder.Build()#2109
openshift-merge-robot merged 2 commits into
openshift:masterfrom
lleshchi:HIVE-2300

Conversation

@lleshchi
Copy link
Copy Markdown
Contributor

@lleshchi lleshchi commented Sep 6, 2023

With the controller-runtime upgrade from 8cfdcca, our remote client
Builder interface's Build() method got lazier. Before, if the remote
client was unreachable, Build() itself would fail. Now it won't fail
until the resulting client is actually used. This resulted in our
"unreachable" controller incorrectly marking the ClusterDeployment's
APIURLOverride as reachable when it wasn't, which had the ripple effect
of making the clustersync controller fail early by trying to use that
URL rather than falling back to the default.

This was exposed in situations where the DNS for the APIURLOverride was
being configured via a syncset: the clustersync controller tried to use
a URL that wouldn't resolve, so it couldn't sync the resource that would
make that DNS work.

Initially, to fix this issue, a Reachable() method was added to the Builder,
but on further inspection, there are many cases where uses of the Build()
method result in a client being falsely marked as reachable.

To fix, this PR reverts the Reachable() commit 576401b
and moves the reachability check to the Build() method of the Builder interface.
This internally builds the client and then uses it to query the /apis of the remote client.

xref: HIVE-2300

@openshift-ci openshift-ci Bot requested review from 2uasimojo and dlom September 6, 2023 18:05
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 6, 2023
@lleshchi
Copy link
Copy Markdown
Contributor Author

lleshchi commented Sep 6, 2023

/assign @2uasimojo

@lleshchi
Copy link
Copy Markdown
Contributor Author

lleshchi commented Sep 6, 2023

Need to add to kubeconfigBuilder as well

Copy link
Copy Markdown
Member

@2uasimojo 2uasimojo left a comment

Choose a reason for hiding this comment

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

This looks great. Just one thing: can you add a comment above the new checks explaining what they're doing? So future-we don't have to rely on git blame.

With the controller-runtime upgrade from 8cfdcca, our remote client
`Builder` interface's `Build()` method got lazier. Before, if the remote
client was unreachable, `Build()` itself would fail. Now it won't fail
until the resulting client is actually used. This resulted in our
"unreachable" controller incorrectly marking the ClusterDeployment's
APIURLOverride as reachable when it wasn't, which had the ripple effect
of making the clustersync controller fail early by trying to use that
URL rather than falling back to the default.

This was exposed in situations where the DNS for the APIURLOverride was
being configured via a syncset: the clustersync controller tried to use
a URL that wouldn't resolve, so it couldn't sync the resource that would
make that DNS work.

To fix, this commit adds a check in the `Build()` method of the `Builder`
interface. This internally builds the client and then uses it to query
the `/apis` of the remote client.

HIVE-2300

Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 7, 2023

Codecov Report

Merging #2109 (06e589d) into master (bfe7ad5) will increase coverage by 0.00%.
Report is 2 commits behind head on master.
The diff coverage is 21.42%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2109   +/-   ##
=======================================
  Coverage   57.54%   57.55%           
=======================================
  Files         187      187           
  Lines       25826    25810   -16     
=======================================
- Hits        14862    14854    -8     
+ Misses       9720     9711    -9     
- Partials     1244     1245    +1     
Files Changed Coverage Δ
pkg/remoteclient/fake.go 0.00% <ø> (ø)
pkg/remoteclient/kubeconfig.go 0.00% <0.00%> (ø)
pkg/remoteclient/mock/remoteclient_generated.go 68.96% <ø> (-3.77%) ⬇️
pkg/remoteclient/remoteclient.go 74.12% <33.33%> (+2.01%) ⬆️
...g/controller/unreachable/unreachable_controller.go 59.09% <50.00%> (ø)

@2uasimojo
Copy link
Copy Markdown
Member

/test e2e-azure

Ignore me, drive by.

/test coverage

infra flake

@openshift openshift deleted a comment from openshift-ci Bot Sep 7, 2023
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Sep 7, 2023

@lleshchi: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-azure 06e589d link false /test e2e-azure

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.

@2uasimojo
Copy link
Copy Markdown
Member

Totally different flake in e2e-azure. I won't continue to hold up this PR :)

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Sep 7, 2023
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Sep 7, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 2uasimojo, lleshchi

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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants