-
Notifications
You must be signed in to change notification settings - Fork 986
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
Conversation
RELEASE_REPO ?= public.ecr.aws/b6u6q9h4 | ||
RELEASE_VERSION ?= v0.2.0 | ||
RELEASE_VERSION ?= $(shell git describe --tags --always --dirty) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What on earth?
There was a problem hiding this comment.
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}" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkg/cloudprovider/aws/factory.go
Outdated
@@ -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))) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, updated
pkg/utils/project/project.go
Outdated
var ( | ||
// Version is the karpenter app version injected during compilation | ||
// when using the Makefile | ||
Version = "dev" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yessir! updated
Issue #, if available:
N/A
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.