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

Customize User-Agent with k8sec version #153

Merged
merged 1 commit into from
Mar 1, 2022
Merged

Conversation

bendrucker
Copy link
Contributor

Sets a custom User-Agent header with requests made by k8sec. This allows administrators to track usage of k8sec via apiserver's audit logs.

By default, client-go attempts to assemble a user-agent string that contains information about its version/runtime:

https://github.com/kubernetes/client-go/blob/782ff783b635df54ddf44d55f3bd3e48eb4dcb9a/rest/config.go#L498-L506

If you'd like to keep this, there's an option to append your own user agent info to these defaults. However, since a given version of k8sec will be built with a specific version of client-go, it seems like just including the main tool version is the right move.

@dtan4
Copy link
Owner

dtan4 commented Mar 1, 2022

Confirmed apiserver audit log contains this custom user agent: "k8sec/v0.6.0"

Copy link
Owner

@dtan4 dtan4 left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Sorry for the late reply!

@dtan4 dtan4 merged commit c05895f into dtan4:master Mar 1, 2022
@dtan4
Copy link
Owner

dtan4 commented Mar 1, 2022

Released as 0.8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants