-
Notifications
You must be signed in to change notification settings - Fork 132
Fix version logging at binary startup. #985
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
Conversation
Signed-off-by: Saketh Kalaga <51327242+renormalize@users.noreply.github.com>
aaronfern
left a comment
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.
Thanks for the PR!
What is the impact when MCM runs locally as a process? I assume that Version and GitSha will not be printed. Is that correct?
|
Thanks for the review @aaronfern! When MCM is run locally as a process, if the verbosity level is sufficient, then the Version and Git SHA are both printed. ❯ ./bin/machine-controller-manager --v=3
I0416 13:14:12.194054 91628 flags.go:57] FLAG: --address="0.0.0.0"
I0416 13:14:12.194453 91628 flags.go:57] FLAG: --autoscaler-scaldown-annotation-during-rollout="true"
...a bunch of flags...
I0416 13:14:12.194513 91628 flags.go:57] FLAG: --v="3"
I0416 13:14:12.194515 91628 flags.go:57] FLAG: --vmodule=""
I0416 13:14:12.194538 91628 version.go:24] machine-controller-manager Version: v0.58.0-dev
I0416 13:14:12.194543 91628 version.go:25] Git SHA: 48cab6d7e
I0416 13:14:12.194546 91628 version.go:26] Go Version: go1.24.2
I0416 13:14:12.194549 91628 version.go:27] Go OS/Arch: darwin/arm64
W0416 13:14:12.194557 91628 client_config.go:659] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
W0416 13:14:12.194562 91628 client_config.go:664] error creating inClusterConfig, falling back to default config: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variableThe logs print Git SHA When verbosity is not sufficient: ❯ ./bin/machine-controller-manager
W0416 13:17:02.278256 92616 client_config.go:659] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
W0416 13:17:02.278834 92616 client_config.go:664] error creating inClusterConfig, falling back to default config: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable |
I meant more from the pov of someone running |
|
The Git SHA word is left empty, and the binary proceeds running as is, no regression is observed. Perhaps I could enhance the |
|
The |
aaronfern
left a comment
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.
Thanks for the changes!
/lgtm
What this PR does / why we need it:
Version information is not being logged at startup currently.
machine-controller-manager/cmd/machine-controller-manager/app/controllermanager.go
Line 78 in 57dad3e
does not really print anything meaningful. Currently it prints the following:
which is the template string present in client-go@v0.31.0/pkg/version/base.go. As described in the linked file a few lines above:
where the modification is not being done by the build process in this repository, and is unnecessarily complicated for what it does.
I've introduced a simple
pkg/version/version.gowhere exported variables are written during linking throughldflagslike other projects in @gardener.Release note: