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

🐛 Fix Defaulting of the User Agent #2435

Merged
merged 1 commit into from Aug 4, 2023

Conversation

alvaroaleman
Copy link
Member

This broke when we added the HTTP client, because the user-agent gets set by a roundtripper that is constructed within rest.HTTPClientFor. As a result, we have to default it before we do that. Currently, it ends up being defaulted to Go-http-client which is not very useful.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 3, 2023
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 3, 2023
@FillZpp
Copy link
Contributor

FillZpp commented Aug 4, 2023

LGTM. Nit: the rest.DefaultKubernetesUserAgent() only contains the version of client-go, should we have a default user-agent that also shows the version of controller-runtime?

This broke when we added the HTTP client, because the user-agent gets
set by a roundtripper that is constructed within `rest.HTTPClientFor`.
As a result, we have to default it before we do that. Currently, it ends
up being defaulted to `Go-http-client` which is not very useful.
@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 Aug 4, 2023
@alvaroaleman
Copy link
Member Author

LGTM. Nit: the rest.DefaultKubernetesUserAgent() only contains the version of client-go, should we have a default user-agent that also shows the version of controller-runtime?

No real strong opinion either way, but I don't think that version is currently available to us?

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

Merging this right now, given that it fixes the underlying bug. @FillZpp let's follow-up on having a more useful user agent with controller-runtime in mind

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 4, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, 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:
  • OWNERS [alvaroaleman,vincepri]

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 merged commit bc27961 into kubernetes-sigs:main Aug 4, 2023
9 checks passed
@alvaroaleman
Copy link
Member Author

/cherrypick release-0.15

@alvaroaleman alvaroaleman deleted the fix-ua-2 branch August 4, 2023 15:13
@k8s-infra-cherrypick-robot

@alvaroaleman: #2435 failed to apply on top of branch "release-0.15":

Applying: bug: Fix Defaulting of the User Agent
Using index info to reconstruct a base tree...
M	pkg/cache/cache.go
M	pkg/cluster/cluster.go
M	pkg/manager/manager.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/manager/manager.go
CONFLICT (content): Merge conflict in pkg/manager/manager.go
Auto-merging pkg/cluster/cluster.go
Auto-merging pkg/cache/cache.go
CONFLICT (content): Merge conflict in pkg/cache/cache.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 bug: Fix Defaulting of the User Agent
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-0.15

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.

pperiyasamy added a commit to pperiyasamy/cluster-network-operator that referenced this pull request Feb 13, 2024
The bump is needed to restore fieldmanager value to 'cluster=network-operator'
as a fix in this version does it.
kubernetes-sigs/controller-runtime#2435

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
pperiyasamy added a commit to pperiyasamy/cluster-network-operator that referenced this pull request Feb 13, 2024
The bump is needed to restore fieldmanager value to 'cluster-network-operator'
as a fix in this version does it.
kubernetes-sigs/controller-runtime#2435

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
pperiyasamy added a commit to pperiyasamy/cluster-network-operator that referenced this pull request Feb 15, 2024
The bump is needed to restore fieldmanager value to 'cluster-network-operator'
as a fix in this version does it.
kubernetes-sigs/controller-runtime#2435

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
pperiyasamy added a commit to pperiyasamy/cluster-network-operator that referenced this pull request Feb 20, 2024
The bump is needed to restore fieldmanager value to 'cluster-network-operator'
as a fix in this version does it.
kubernetes-sigs/controller-runtime#2435

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
pperiyasamy added a commit to pperiyasamy/cluster-network-operator that referenced this pull request Feb 21, 2024
The bump is needed to restore fieldmanager value to 'cluster-network-operator'
as a fix in this version does it.
kubernetes-sigs/controller-runtime#2435

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
pperiyasamy added a commit to pperiyasamy/cluster-network-operator that referenced this pull request Mar 4, 2024
The bump is needed to restore fieldmanager value to 'cluster-network-operator'
as a fix in this version does it.
kubernetes-sigs/controller-runtime#2435

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants