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

add user-agent string #352

Merged
merged 5 commits into from
Apr 9, 2021
Merged

add user-agent string #352

merged 5 commits into from
Apr 9, 2021

Conversation

bwagner5
Copy link
Contributor

@bwagner5 bwagner5 commented Apr 8, 2021

Issue #, if available:
N/A

Description of changes:

  • Add a karpenter specific user-agent string w/ version to the AWS session

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

JacobGabrielson
JacobGabrielson previously approved these changes Apr 8, 2021
RELEASE_REPO ?= public.ecr.aws/b6u6q9h4
RELEASE_VERSION ?= v0.2.0
RELEASE_VERSION ?= $(shell git describe --tags --always --dirty)
Copy link
Contributor

Choose a reason for hiding this comment

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

What on earth?

Copy link
Contributor

Choose a reason for hiding this comment

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

RELEASE_MANIFEST = releases/${CLOUD_PROVIDER}/manifest.yaml

## Inject the app version into project.Version
LDFLAGS ?= "-ldflags=-X=github.com/awslabs/karpenter/pkg/utils/project.Version=${RELEASE_VERSION}"
Copy link
Contributor

Choose a reason for hiding this comment

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

How do these get picked up. Don't we need something on line 8?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, line 8 already includes ${GOFLAGS} which includes the LDFLAGS since they are apart of the GOFLAGS.

Copy link
Contributor

Choose a reason for hiding this comment

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

Uploading image.png…

@@ -51,6 +54,8 @@ type Factory struct {

func NewFactory(options cloudprovider.Options) *Factory {
sess := withRegion(session.Must(session.NewSession(&aws.Config{STSRegionalEndpoint: endpoints.RegionalSTSEndpoint})))
// add karpenter user-agent string to AWS session
sess.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler(fmt.Sprintf("karpenter.sh-%s", project.Version)))
Copy link
Contributor

Choose a reason for hiding this comment

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

can you encapsulate this into withUserAgent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, updated

var (
// Version is the karpenter app version injected during compilation
// when using the Makefile
Version = "dev"
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this ever show as dev if we use git tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if someone does go build ./... or something like that without specifying the LDFLAGS (so not using the Makefile)

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting. Can we say unspecified, instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yessir! updated

JacobGabrielson
JacobGabrielson previously approved these changes Apr 8, 2021
@bwagner5 bwagner5 merged commit 176ba09 into aws:main Apr 9, 2021
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.

3 participants