diff --git a/apis/archiver/v1alpha1/helpers.go b/apis/archiver/v1alpha1/helpers.go index e097263e63..789e2e19bc 100644 --- a/apis/archiver/v1alpha1/helpers.go +++ b/apis/archiver/v1alpha1/helpers.go @@ -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 +} diff --git a/apis/kubedb/v1alpha2/mssqlserver_helpers.go b/apis/kubedb/v1alpha2/mssqlserver_helpers.go index 16194974eb..9eb763a93d 100644 --- a/apis/kubedb/v1alpha2/mssqlserver_helpers.go +++ b/apis/kubedb/v1alpha2/mssqlserver_helpers.go @@ -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