Skip to content

Conversation

@pcallewaert
Copy link
Contributor

@pcallewaert pcallewaert commented Sep 26, 2025

  • Use one logger for all
  • Use only the zap logger
  • Fix printing sensitive information when database connection failed
  • Refactor cloud provider config, it is now case insentive

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.

Copy link

Copilot AI left a 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.

@pcallewaert pcallewaert force-pushed the chore/simplify-logging branch 2 times, most recently from 792575e to a58ac2f Compare December 17, 2025 08:29
@pcallewaert pcallewaert requested a review from hitman99 December 17, 2025 08:38
@pcallewaert pcallewaert marked this pull request as ready for review December 17, 2025 08:39
@pcallewaert pcallewaert force-pushed the chore/simplify-logging branch from d85ccf4 to 1b4bb72 Compare December 17, 2025 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sensitive data should be hidden from logs

2 participants