Skip to content

Commit

Permalink
feat: late init engineVersion if DBInstance is running within DBClust…
Browse files Browse the repository at this point in the history
…er (#1569)

* feat: late init engineVersion if DBInstance is running within DBCluster

Signed-off-by: Lyuben Dimitrov <l.dimitrov@reply.de>
Signed-off-by: ldimitrov <ldimitrov070@gmail.com>

* chore: fix go formatting
Signed-off-by: Lyuben Dimitrov <l.dimitrov@reply.de>

Signed-off-by: ldimitrov <ldimitrov070@gmail.com>

Signed-off-by: Lyuben Dimitrov <l.dimitrov@reply.de>
Signed-off-by: ldimitrov <ldimitrov070@gmail.com>
Co-authored-by: Lyuben Dimitrov <l.dimitrov@reply.de>
  • Loading branch information
ldimitrov and ldimitrov-abi authored Nov 15, 2022
1 parent aa3b1ce commit fcd1efb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/controller/rds/dbinstance/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ func lateInitialize(in *svcapitypes.DBInstanceParameters, out *svcsdk.DescribeDB
in.PreferredBackupWindow = aws.LateInitializeStringPtr(in.PreferredBackupWindow, db.PreferredBackupWindow)
in.StorageEncrypted = aws.LateInitializeBoolPtr(in.StorageEncrypted, db.StorageEncrypted)
in.StorageType = aws.LateInitializeStringPtr(in.StorageType, db.StorageType)
in.EngineVersion = aws.LateInitializeStringPtr(in.EngineVersion, db.EngineVersion)
// When version 5.6 is chosen, AWS creates 5.6.41 and that's totally valid.
// But we detect as if we need to update it all the time. Here, we assign
// the actual full version to our spec to avoid unnecessary update signals.
if strings.HasPrefix(aws.StringValue(db.EngineVersion), aws.StringValue(in.EngineVersion)) {
in.EngineVersion = db.EngineVersion
}
}
in.AutoMinorVersionUpgrade = aws.LateInitializeBoolPtr(in.AutoMinorVersionUpgrade, db.AutoMinorVersionUpgrade)
in.AvailabilityZone = aws.LateInitializeStringPtr(in.AvailabilityZone, db.AvailabilityZone)
Expand Down Expand Up @@ -270,13 +277,6 @@ func lateInitialize(in *svcapitypes.DBInstanceParameters, out *svcsdk.DescribeDB
in.VPCSecurityGroupIDs[i] = aws.StringValue(val.VpcSecurityGroupId)
}
}
in.EngineVersion = aws.LateInitializeStringPtr(in.EngineVersion, db.EngineVersion)
// When version 5.6 is chosen, AWS creates 5.6.41 and that's totally valid.
// But we detect as if we need to update it all the time. Here, we assign
// the actual full version to our spec to avoid unnecessary update signals.
if strings.HasPrefix(aws.StringValue(db.EngineVersion), aws.StringValue(in.EngineVersion)) {
in.EngineVersion = db.EngineVersion
}
if in.DBParameterGroupName == nil {
for i := range db.DBParameterGroups {
if db.DBParameterGroups[i].DBParameterGroupName != nil {
Expand Down

0 comments on commit fcd1efb

Please sign in to comment.