Fix bool config defaults when using OperatorConfiguration CRD
When using OperatorConfiguration CRD, boolean fields with default value of `true` (like `enable_database_access` and `debug_logging`) were incorrectly defaulting to `false` when not explicitly specified. This happened because Go initializes bool fields to `false`, and there was no coalesce logic to apply the intended defaults. The fix changes the CRD type fields from `bool` to `*bool` (pointer), allowing us to distinguish between "not specified" (nil) and "explicitly set to false". Then we use the existing `CoalesceBool` utility function to apply the correct defaults. Fixes #2575
This commit is contained in:
parent
0ac28e3aad
commit
ce7a115d4e
|
|
@ -167,8 +167,8 @@ type AWSGCPConfiguration struct {
|
|||
|
||||
// OperatorDebugConfiguration defines options for the debug mode
|
||||
type OperatorDebugConfiguration struct {
|
||||
DebugLogging bool `json:"debug_logging,omitempty"`
|
||||
EnableDBAccess bool `json:"enable_database_access,omitempty"`
|
||||
DebugLogging *bool `json:"debug_logging,omitempty"`
|
||||
EnableDBAccess *bool `json:"enable_database_access,omitempty"`
|
||||
}
|
||||
|
||||
// TeamsAPIConfiguration defines the configuration of TeamsAPI
|
||||
|
|
|
|||
|
|
@ -214,8 +214,8 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur
|
|||
result.LogicalBackupMemoryLimit = fromCRD.LogicalBackup.MemoryLimit
|
||||
|
||||
// debug config
|
||||
result.DebugLogging = fromCRD.OperatorDebug.DebugLogging
|
||||
result.EnableDBAccess = fromCRD.OperatorDebug.EnableDBAccess
|
||||
result.DebugLogging = *util.CoalesceBool(fromCRD.OperatorDebug.DebugLogging, util.True())
|
||||
result.EnableDBAccess = *util.CoalesceBool(fromCRD.OperatorDebug.EnableDBAccess, util.True())
|
||||
|
||||
// Teams API config
|
||||
result.EnableTeamsAPI = fromCRD.TeamsAPI.EnableTeamsAPI
|
||||
|
|
|
|||
Loading…
Reference in New Issue