-
Notifications
You must be signed in to change notification settings - Fork 95
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
Bug 1881907: Adds cluster version into the User-Agent header #175
Bug 1881907: Adds cluster version into the User-Agent header #175
Conversation
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.
It looks ok (giving the ?
string is expected by consumers)
/retest |
2 similar comments
/retest |
/retest |
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.
lgtm
/retest |
Looks good codewise but haven't a chance to try out: did anyone of the reviewers tried running this end2end? |
Don't know |
Ok, I've tested via cluste-bot, as well as locally, and have seen the archvie getting though end2end, with the changes, so looks good from this perspective. Code-wise, I know it follows an already established pattern, where the gatherer loads some info about the cluster and the client uses it when uploading the data. Said that, I don't like that approach a lot, as it couples the gathering and uploading in some unexpected way (what would happen if we had a configuration to not gather the cluster operators data). Therefore, I'm good with acking this, as long as we have some refactoring task to decouple getting data for preparing the client from the generic gathering. |
The ClusterVersion is also from the gathering part, so I basically followed that pattern. IMO probably most of insights operator should be refactored, or at least the gathering part.
|
Good work, thank you! Woudln't it be better to use RELEASE_VERSION env variable, which doesn't read value from cluster, but from Pod actually running ? Maybe we could refactor the expression to method to return UserAgent value, together with waiting for ClusterVersion.
|
@iNecas what do you think about ^ ? |
/retest |
@iNecas @martinkunc please review :) |
@0sewa0: This pull request references Bugzilla bug 1881907, which is invalid:
Comment In response to this:
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. |
/bugzilla refresh |
@0sewa0: This pull request references Bugzilla bug 1881907, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
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. |
gitVersion = releaseVersionEnv | ||
} | ||
gitVersion = fmt.Sprintf("%s-%s", gitVersion, v.GitCommit) | ||
return fmt.Sprintf("insights-operator/%s cluster/%s", gitVersion, cv.Spec.ClusterID) |
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.
Have you tried with real cluster, when trying against one, I'm getting v0.0.0-master+$Format:%h$-$Format:%H$
in the gitVersion
, which doesn't look right.
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 can I try it on a 'real cluster' ? I always run it locally while pointing at a cluster created by cluster-bot
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.
So after a bit of investigation the build command doesn't seem to work as intended. The values the version
returns are the defaults for that package and not the special ones that we should be setting during build.
build:
go build -ldflags "-X github.com/openshift/insights-operator/vendor/k8s.io/client-go/pkg/version.gitCommit=$$(git rev-parse HEAD) -X github.com/openshift/insights-operator/vendor/k8s.io/client-go/pkg/version.gitVersion=v1.0.0+$$(git rev-parse --short=7 HEAD)" -o bin/insights-operator ./cmd/insights-operator
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.
Yes, that is right. That is why this change prefers RELEASE_VERSION envvar. If the var is set, it overrides the value built-in the package. Setting it should then affect Debug as well.
At some point later we would also like to resolve filling version in the ldflags, but I would do it in a separate CL.
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.
I tested by using the envvar, which works but it still appends the v.GitCommit
to the the value of the envvar and that will be"$Format:%H$"
. So the gitVersion
will be {RELEASE_VERSION} - $Format:%H$
the commit part of it not really helpful
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.
When you build it with make build, it should set the gitVersion in the binary, when you run the binnary afterwards, will it have it set right ? It should.
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.
conclusion: the make build
had incorrect path to the packages where it tried to set the variables.
incorrect path: github.com/openshift/insights-operator/vendor/k8s.io/client-go/pkg/version.gitCommit
correct path: k8s.io/client-go/pkg/version.gitCommit
Thank you, Marcell, good work. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 0sewa0, martinkunc, rluders, tisnik 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:
Approvers can indicate their approval by writing |
/retest |
1 similar comment
/retest |
@0sewa0: All pull requests linked via external trackers have merged: Bugzilla bug 1881907 has been moved to the MODIFIED state. In response to this:
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. |
No description provided.