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

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 (9f0026d) to head (c0f448e).
Report is 2 commits behind head on main.

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.98%   58.96%   -0.02%     
==========================================
  Files         368      368              
  Lines       39000    39017      +17     
==========================================
+ Hits        23004    23007       +3     
- Misses      14532    14546      +14     
  Partials     1464     1464              

☔ 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
… 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]>
@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
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.

inconsistent log output format
2 participants