Skip to content

Commit

Permalink
fix(rdsinstance): ignore KMSKeyID in IsUpToDate + lateinit OptionGrou…
Browse files Browse the repository at this point in the history
…pName

Signed-off-by: Charel Baum (external expert on behalf of DB Netz AG) <[email protected]>
  • Loading branch information
Charel Baum (external expert on behalf of DB Netz AG) committed Aug 30, 2023
1 parent 2e52b0a commit cb8aa38
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/clients/database/rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,21 @@ func LateInitialize(in *v1beta1.RDSInstanceParameters, db *rdstypes.DBInstance)
if len(in.EnableCloudwatchLogsExports) == 0 && in.CloudwatchLogsExportConfiguration != nil {
in.EnableCloudwatchLogsExports = in.CloudwatchLogsExportConfiguration.EnableLogTypes
}

if in.OptionGroupName == nil && len(db.OptionGroupMemberships) != 0 {
// find the OptionGroup that is "in-sync", "applying", "pending-apply" or "pending-maintenance-apply"
memberships:
for _, group := range db.OptionGroupMemberships {
if group.OptionGroupName != nil && group.Status != nil {

switch awsclients.StringValue(group.Status) {
case "in-sync", "applying", "pending-apply", "pending-maintenance-apply":
in.OptionGroupName = group.OptionGroupName
break memberships
}
}
}
}
}

// IsUpToDate checks whether there is a change in any of the modifiable fields.
Expand All @@ -680,6 +695,7 @@ func IsUpToDate(ctx context.Context, kube client.Client, r *v1beta1.RDSInstance,
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "AllowMajorVersionUpgrade"),
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "MasterPasswordSecretRef"),
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "OptionGroupName"),
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "KMSKeyID"),
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "EnableCloudwatchLogsExports"),
// TODO: remove deprecated field + code. Mapping to EnableCloudwatchLogsExports while in deprecation.
cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "CloudwatchLogsExportConfiguration"),
Expand Down

0 comments on commit cb8aa38

Please sign in to comment.