Skip to content

add useragent with package version - #2744

Merged
k8s-ci-robot merged 4 commits into
kubernetes-client:mainfrom
davidgamero:useragent
Jan 14, 2026
Merged

k8s-ci-robot merged 4 commits into
kubernetes-client:mainfrom
davidgamero:useragent

Conversation

@davidgamero

Copy link
Copy Markdown
Contributor

make debugging easier by including a user agent with package version

following similar pattern to go client https://github.com/kubernetes/client-go/blob/0b06cf5bf0e19c0f026fd5eef7eecb5a346ca95f/rest/config.go#L524

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 13, 2026

@cjihrig cjihrig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with some minor nits.

Comment thread src/config_test.ts Resolved
Comment thread src/config_test.ts Resolved
Comment thread src/config_test.ts Resolved
Comment thread src/config_test.ts Resolved
Comment thread src/config.ts Resolved
@davidgamero

Copy link
Copy Markdown
Contributor Author

thank you i've updated to include the suggestions

Comment thread src/config.ts Outdated

function getUserAgent(): string {
const version = packagejson.version ?? '';
return `kubernetes-javascript-client/${version}`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we name it kubernetes-client-javascript to better match the org/repo name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

makes sense to me

Comment thread src/config_test.ts Outdated
true,
`User-Agent should include version ${expectedVersion}`,
);
t.after(async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be moved to right after the server is started. Otherwise, if any assertions fail, this will never be added.

@cjihrig cjihrig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 14, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cjihrig, davidgamero

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 [cjihrig,davidgamero]

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 4dd20a6 into kubernetes-client:main Jan 14, 2026
10 checks passed
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.

4 participants