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

⚠️ Set user agent and timeout for remote cluster client #4060

Merged
merged 1 commit into from
Jan 29, 2021

Conversation

nader-ziada
Copy link
Contributor

What this PR does / why we need it:

  • set a UserAgent and Timeout for remote cluster client

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2993

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 8, 2021
@nader-ziada
Copy link
Contributor Author

/cc @fabriziopandini

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 8, 2021
@@ -26,6 +27,11 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

const (
defaultClientTimeout = 10 * time.Second
remoteClusterUserAgent = "remote-cluster"
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

So instead of something like kubernetes/ we could have cluster.x-k8s.io/ for example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok cool, I can do that

Copy link
Member

Choose a reason for hiding this comment

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

+1, it might be good to also have a component that is defined at initialization time. That way we could differentiate which component is using the remote client, which could potentially be different controllers or even different controller managers

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 8, 2021
@nader-ziada
Copy link
Contributor Author

/test pull-cluster-api-test-main

@nader-ziada
Copy link
Contributor Author

/test pull-cluster-api-test-main

is there any chance this is a flake?

@nader-ziada nader-ziada force-pushed the remote-user-agent branch 2 times, most recently from 894f33c to 8258eec Compare January 9, 2021 00:24
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 11, 2021
@vincepri
Copy link
Member

/milestone v0.4.0

@k8s-ci-robot k8s-ci-robot added this to the v0.4.0 milestone Jan 11, 2021
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 12, 2021
Comment on lines +38 to +39
func NewClusterClient(ctx context.Context, sourceName string, c client.Client, cluster client.ObjectKey) (client.Client, error) {
restConfig, err := RESTConfig(ctx, sourceName, c, cluster)
Copy link
Member

Choose a reason for hiding this comment

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

These changes make the PR a breaking change ⚠️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so are you saying we should not do that? or document it? I didn't how else to identity the base component calling

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was waiting if see if reviewers think this approach is good before updating the PR description to say its breaking

@detiber is that more in the direction you had in mind?

Copy link
Member

Choose a reason for hiding this comment

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

Mostly document it

Copy link
Contributor

Choose a reason for hiding this comment

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

This also means this PR should not be backported to 0.3 (not sure if there were plans to)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think there are any plans to back port this one

@nader-ziada
Copy link
Contributor Author

/test pull-cluster-api-test-main

@nader-ziada
Copy link
Contributor Author

/test pull-cluster-api-apidiff-main

@nader-ziada
Copy link
Contributor Author

/test pull-cluster-api-test-main

@nader-ziada nader-ziada changed the title 🌱 Set user agent and timeout for remote cluster client ⚠️ Set user agent and timeout for remote cluster client Jan 13, 2021
@nader-ziada
Copy link
Contributor Author

/test pull-cluster-api-test-main

3 similar comments
@nader-ziada
Copy link
Contributor Author

/test pull-cluster-api-test-main

@nader-ziada
Copy link
Contributor Author

/test pull-cluster-api-test-main

@vincepri
Copy link
Member

/test pull-cluster-api-test-main

@fabriziopandini
Copy link
Member

Is this a flake?

I'm not sure, in my analysis of recent failures, I don't remember other cases of errors in the path helper tests.

/test pull-cluster-api-test-main

@nader-ziada
Copy link
Contributor Author

Is this a flake?

I'm not sure, in my analysis of recent failures, I don't remember other cases of errors in the path helper tests.

/test pull-cluster-api-test-main

its been occasionally passing with me changing anything, but will take another look

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/lgtm
/assign @detiber

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 15, 2021
@nader-ziada
Copy link
Contributor Author

@detiber any comments? Thanks

@@ -266,7 +266,7 @@ func (r *KubeadmConfigReconciler) refreshBootstrapToken(ctx context.Context, con
log := ctrl.LoggerFrom(ctx)
token := config.Spec.JoinConfiguration.Discovery.BootstrapToken.Token

remoteClient, err := r.remoteClientGetter(ctx, r.Client, util.ObjectKey(cluster))
remoteClient, err := r.remoteClientGetter(ctx, "kubeadmconfig-controller", r.Client, util.ObjectKey(cluster))
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be a const?

Copy link
Contributor

Choose a reason for hiding this comment

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

same comment for all other source names

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated all of the names to const

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 29, 2021
@nader-ziada
Copy link
Contributor Author

/test pull-cluster-api-e2e-main

@nader-ziada
Copy link
Contributor Author

/retest

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jan 29, 2021

@nader-ziada: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-cluster-api-apidiff-main 3bcf832 link /test pull-cluster-api-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@nader-ziada
Copy link
Contributor Author

/test pull-cluster-api-e2e-main

@nader-ziada
Copy link
Contributor Author

@CecileRobertMichon I think its ready now, there was some flakes with the tests last night, but now seems fine, PTAL. Thanks

@detiber
Copy link
Member

detiber commented Jan 29, 2021

Apologies for the delay
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 29, 2021
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 29, 2021
@k8s-ci-robot k8s-ci-robot merged commit 5815384 into kubernetes-sigs:master Jan 29, 2021
This pull request was closed.
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set User Agent and Request Timeout for Remote Cluster Caches
6 participants