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

Upgrade go.mod k8s.io/ go.mod to v0.31.3 and use server logger for client-go, controller-runtime #8450

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kaovilai
Copy link
Member

@kaovilai kaovilai commented Nov 24, 2024

Signed-off-by: Tiger Kaovilai [email protected]

Thank you for contributing to Velero!

Please add a summary of your change

Upgrade k8s.io/ go.mod to v0.31.3 (minor version used by https://github.com/kubernetes-sigs/controller-tools/blob/v0.16.5/go.mod#L18) and set logger for client-go to use the same logger as the rest of the codebase for consistent logging.
Upgraded controller-gen to version that support the new deps.

cat go.mod | grep '\tk8s.io' | cut -f 2 | cut -d ' ' -f 1 | xargs -I {} -L 1 sh -c 'go get {}@v0.31.3'

Also bumped to support upgraded k8s.io/ deps.

  • controller-gen to v0.16.5
  • sigs.k8s.io/controller-runtime v0.19.2
  • structs/funcs for eventhandlers are updated

Does your change fix a particular issue?

Fixes #3550 #8442

Please indicate you've done the following:

@github-actions github-actions bot added the Dependencies Pull requests that update a dependency file label Nov 24, 2024
@kaovilai kaovilai changed the title Upgrade go.mod k8s.io/ go.mod to v0.31.3 Upgrade go.mod k8s.io/ go.mod to v0.31.3 and set klog.SetLogger() Nov 24, 2024
@kaovilai kaovilai changed the title Upgrade go.mod k8s.io/ go.mod to v0.31.3 and set klog.SetLogger() Upgrade go.mod k8s.io/ go.mod to v0.31.3 and set klog.SetLogger() for client-go Nov 24, 2024
@kaovilai kaovilai marked this pull request as ready for review November 24, 2024 09:10
sseago
sseago previously approved these changes Nov 25, 2024
@kaovilai
Copy link
Member Author

fyi I need to fix go sum here before merging :D

@kaovilai kaovilai force-pushed the client-gov0.31.3 branch 2 times, most recently from 6757e8b to cf4add2 Compare November 25, 2024 17:47
@kaovilai kaovilai changed the title Upgrade go.mod k8s.io/ go.mod to v0.31.3 and set klog.SetLogger() for client-go Upgrade go.mod k8s.io/ go.mod to v0.31.2 and set klog.SetLogger() for client-go Nov 25, 2024
@kaovilai kaovilai force-pushed the client-gov0.31.3 branch 4 times, most recently from 1aeedba to ac86ced Compare November 25, 2024 18:41
Copy link
Member Author

@kaovilai kaovilai left a comment

Choose a reason for hiding this comment

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

time="2024-11-25T20:27:46Z" level=fatal msg="controller with name backup already exists. Controller names must be unique to avoid multiple controllers reporting to the same metricunable to create controllercontrollerbackup-operations" logSource="pkg/cmd/server/server.go:661"

@kaovilai kaovilai force-pushed the client-gov0.31.3 branch 3 times, most recently from f518555 to 17c2721 Compare November 25, 2024 21:19
@@ -127,7 +128,8 @@ func newdataMoverBackup(logger logrus.FieldLogger, factory client.Factory, confi
return nil, errors.Wrap(err, "error to create client config")
}

ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
Copy link
Member Author

Choose a reason for hiding this comment

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

FYI zap is being removed in this PR.

It was meant to be removed here https://github.com/vmware-tanzu/velero/pull/2561/files#r432107463 and was kept here #8046 (comment)

This means all logs are going to be affected by the default logger flags, that means if user want all logs in json, they will get all logs in json.

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 24.39024% with 31 lines in your changes missing coverage. Please review.

Project coverage is 58.96%. Comparing base (2e5df85) to head (ee7ceda).

Files with missing lines Patch % Lines
pkg/util/kube/event_handler.go 0.00% 11 Missing ⚠️
internal/hook/wait_exec_hook_handler.go 64.28% 5 Missing ⚠️
pkg/cmd/cli/datamover/backup.go 0.00% 2 Missing ⚠️
pkg/cmd/cli/datamover/restore.go 0.00% 2 Missing ⚠️
pkg/cmd/cli/nodeagent/server.go 0.00% 2 Missing ⚠️
pkg/cmd/server/server.go 0.00% 1 Missing ⚠️
pkg/controller/backup_controller.go 0.00% 1 Missing ⚠️
pkg/controller/backup_finalizer_controller.go 0.00% 1 Missing ⚠️
pkg/controller/backup_operations_controller.go 0.00% 1 Missing ⚠️
...g/controller/backup_storage_location_controller.go 0.00% 1 Missing ⚠️
... and 4 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8450   +/-   ##
=======================================
  Coverage   58.96%   58.96%           
=======================================
  Files         368      368           
  Lines       39024    39041   +17     
=======================================
+ Hits        23009    23020   +11     
- Misses      14552    14559    +7     
+ Partials     1463     1462    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kaovilai kaovilai changed the title Upgrade go.mod k8s.io/ go.mod to v0.31.2 and set klog.SetLogger() for client-go Upgrade go.mod k8s.io/ go.mod to v0.31.3 and set klog.SetLogger() for client-go Nov 25, 2024
@kaovilai kaovilai requested a review from sseago November 25, 2024 21:56
sseago
sseago previously approved these changes Nov 25, 2024
@kaovilai kaovilai changed the title Upgrade go.mod k8s.io/ go.mod to v0.31.3 and set klog.SetLogger() for client-go Upgrade go.mod k8s.io/ go.mod to v0.31.3 and set klog.SetLogger() for client-go, controller-runtime Nov 25, 2024
@kaovilai kaovilai changed the title Upgrade go.mod k8s.io/ go.mod to v0.31.3 and set klog.SetLogger() for client-go, controller-runtime Upgrade go.mod k8s.io/ go.mod to v0.31.3 and set logger for client-go, controller-runtime Nov 25, 2024
@kaovilai kaovilai changed the title Upgrade go.mod k8s.io/ go.mod to v0.31.3 and set logger for client-go, controller-runtime Upgrade go.mod k8s.io/ go.mod to v0.31.3 and use server logger for client-go, controller-runtime Nov 25, 2024
@kaovilai kaovilai requested a review from sseago November 25, 2024 22:10
sseago
sseago previously approved these changes Nov 25, 2024
@kaovilai kaovilai linked an issue Dec 2, 2024 that may be closed by this pull request
… client-go

Also bumped to support upgraded k8s.io/ deps.
- controller-gen to v0.16.5
- sigs.k8s.io/controller-runtime v0.19.2

Signed-off-by: Tiger Kaovilai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.16-candidate Dependencies Pull requests that update a dependency file has-changelog has-unit-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bump client-go to v0.31.0 or above inconsistent log output format
2 participants