-
-
Notifications
You must be signed in to change notification settings - Fork 72
Simplify logging #256
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
base: master
Are you sure you want to change the base?
Simplify logging #256
Conversation
1acace9 to
e82ee23
Compare
e82ee23 to
bcfa7dd
Compare
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.
Pull request overview
This pull request simplifies the logging infrastructure by consolidating to a single zap logger, removes sensitive password information from error logs, and refactors the cloud provider configuration to use a type-safe enum with case-insensitive parsing.
Key changes:
- Consolidated logging to use a single zap logger instance stored as a struct field instead of passing loggers as parameters
- Fixed security issue where database password could be logged on connection failures
- Introduced CloudProvider as a typed enum with case-insensitive parsing support
- Cleaned up struct field naming from snake_case to camelCase
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cmd/main.go | Updated logger initialization, removed setupLog variable, added protection against logging sensitive PostgresPass on connection failures (with typo in log field name) |
| pkg/config/config.go | Introduced CloudProvider type with enum constants and case-insensitive ParseCloudProvider function |
| pkg/postgres/postgres.go | Removed logger parameters from interface methods, changed from log.Fatal to returning errors, renamed struct fields to camelCase, updated to use CloudProvider constants |
| pkg/postgres/role.go | Removed logger parameter from DropRole and updated GetConnection call |
| pkg/postgres/database.go | Removed logger parameters from CreateSchema, CreateExtension, DropDatabase, SetSchemaPrivileges, and updated to use internal logger field |
| pkg/postgres/aws.go | Removed logger parameter from DropRole, updated to use internal logger field |
| pkg/postgres/azure.go | Removed logger parameter from DropRole |
| pkg/postgres/gcp.go | Removed logger parameter from DropRole, removed blank line, updated to use internal logger field |
| pkg/postgres/mock/postgres.go | Updated mock signatures to match interface changes (removed logger parameters) |
| internal/controller/postgresuser_controller.go | Updated cloudProvider field type to config.CloudProvider, removed logger parameter from DropRole calls |
| internal/controller/postgres_controller.go | Removed logger parameters from all postgres method calls, added blank lines after function definitions |
| internal/controller/postgresuser_controller_test.go | Updated mock expectations to remove logger parameter |
| internal/controller/postgres_controller_test.go | Updated mock expectations to remove logger parameter, removed excess blank lines |
| config/crd/bases/db.movetokube.com_postgresusers.yaml | Reformatted descriptions to multi-line format, added enableIamAuth to required fields in status, reordered status fields |
| config/crd/bases/db.movetokube.com_postgres.yaml | Reformatted descriptions to multi-line format |
| api/v1alpha1/zz_generated.deepcopy.go | Added DeepCopy methods for PostgresUserAWSSpec, updated PostgresUserSpec DeepCopyInto to handle AWS field |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
792575e to
a58ac2f
Compare
d85ccf4 to
1b4bb72
Compare
Should fix #76 , #77 and #49
Also fix a drift issue between the go definition and the generated code from it. Probably one of the previous PR's included manual changes to the file. I updated the definition file to be in sync.