Skip to content

Commit

Permalink
Fix availabilityGroup panic; Set defults to logBackupOptions (#1370)
Browse files Browse the repository at this point in the history
Signed-off-by: Arnob kumar saha <[email protected]>
  • Loading branch information
ArnobKumarSaha authored Dec 18, 2024
1 parent a471a5b commit e9eda10
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apis/archiver/v1alpha1/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,13 @@ func (_ MariaDBArchiver) CustomResourceDefinition() *apiextensions.CustomResourc
func (_ MSSQLServerArchiver) CustomResourceDefinition() *apiextensions.CustomResourceDefinition {
return crds.MustCustomResourceDefinition(SchemeGroupVersion.WithResource(ResourcePluralMSSQLServerArchiver))
}

func SetDefaultLogBackupOptions(log *LogBackupOptions) *LogBackupOptions {
if log == nil {
log = &LogBackupOptions{
SuccessfulLogHistoryLimit: 5,
FailedLogHistoryLimit: 5,
}
}
return log
}
3 changes: 3 additions & 0 deletions apis/kubedb/v1alpha2/mssqlserver_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ func (m *MSSQLServer) SetDefaults() {
m.Spec.Replicas = pointer.Int32P(1)
}
} else if m.IsAvailabilityGroup() {
if m.Spec.Topology.AvailabilityGroup == nil {
m.Spec.Topology.AvailabilityGroup = &MSSQLServerAvailabilityGroupSpec{}
}
if m.Spec.Topology.AvailabilityGroup.LeaderElection == nil {
m.Spec.Topology.AvailabilityGroup.LeaderElection = &MSSQLServerLeaderElectionConfig{
// The upper limit of election timeout is 50000ms (50s), which should only be used when deploying a
Expand Down

0 comments on commit e9eda10

Please sign in to comment.