Skip to content

Commit

Permalink
Add ReplicationStrategy Default Value for MySQL (#1356)
Browse files Browse the repository at this point in the history
Signed-off-by: SK Ali Arman <[email protected]>
  • Loading branch information
sheikh-arman authored Dec 5, 2024
1 parent 2198d91 commit 392b6fe
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion apis/kubedb/v1/mariadb_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/utils/ptr"
kmapi "kmodules.xyz/client-go/api/v1"
"kmodules.xyz/client-go/apiextensions"
core_util "kmodules.xyz/client-go/core/v1"
Expand Down Expand Up @@ -221,7 +222,9 @@ func (m *MariaDB) SetDefaults(mdVersion *v1alpha1.MariaDBVersion) {
if m.Spec.PodTemplate.Spec.ServiceAccountName == "" {
m.Spec.PodTemplate.Spec.ServiceAccountName = m.OffshootName()
}

if m.Spec.Init != nil && m.Spec.Init.Archiver != nil && m.Spec.Init.Archiver.ReplicationStrategy == nil {
m.Spec.Init.Archiver.ReplicationStrategy = ptr.To(ReplicationStrategyNone)
}
m.setDefaultContainerSecurityContext(mdVersion, &m.Spec.PodTemplate)
m.setDefaultContainerResourceLimits(&m.Spec.PodTemplate)
m.SetTLSDefaults()
Expand Down
4 changes: 4 additions & 0 deletions apis/kubedb/v1/mysql_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/utils/ptr"
kmapi "kmodules.xyz/client-go/api/v1"
"kmodules.xyz/client-go/apiextensions"
core_util "kmodules.xyz/client-go/core/v1"
Expand Down Expand Up @@ -316,6 +317,9 @@ func (m *MySQL) SetDefaults(myVersion *v1alpha1.MySQLVersion) {
m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup = myVersion.Spec.SecurityContext.RunAsUser
}
}
if m.Spec.Init != nil && m.Spec.Init.Archiver != nil && m.Spec.Init.Archiver.ReplicationStrategy == nil {
m.Spec.Init.Archiver.ReplicationStrategy = ptr.To(ReplicationStrategyNone)
}
}

func (m *MySQL) SetTLSDefaults() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ require (
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.bytebuilders.dev/license-proxyserver v0.0.18 // indirect
go.bytebuilders.dev/license-proxyserver v0.0.19-0.20241022124046-544efbfc2bc4 // indirect
go.bytebuilders.dev/license-verifier v0.14.3 // indirect
go.bytebuilders.dev/license-verifier/kubernetes v0.14.3 // indirect
go.etcd.io/etcd/api/v3 v3.5.14 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
go.bytebuilders.dev/audit v0.0.38 h1:4DEYVfBNeAfI9rctVWmpDOvEExh3gIuPsXVAg4Z3FWA=
go.bytebuilders.dev/audit v0.0.38/go.mod h1:6RC3gMMFpAzTzGJuJg8Ghgvebde4vvXkmDtUo11ypQw=
go.bytebuilders.dev/license-proxyserver v0.0.18 h1:xBEw3qJoskrgJrzVrLKfBIoC7bQIARUlNwBIpLkPXaw=
go.bytebuilders.dev/license-proxyserver v0.0.18/go.mod h1:7wLFkvqfHwmB6MHcdTHB72M8+b63jApS59efrqZlY1E=
go.bytebuilders.dev/license-proxyserver v0.0.19-0.20241022124046-544efbfc2bc4 h1:B5OO9DFYMmFUBPyo0xFFQmn/AEK+GNXWDMPYXpjJlAg=
go.bytebuilders.dev/license-proxyserver v0.0.19-0.20241022124046-544efbfc2bc4/go.mod h1:7wLFkvqfHwmB6MHcdTHB72M8+b63jApS59efrqZlY1E=
go.bytebuilders.dev/license-verifier v0.14.3 h1:5BTwmFEgCjSlAs2Nzh3/7+u//VoF93xjqywrJiqmZsg=
go.bytebuilders.dev/license-verifier v0.14.3/go.mod h1:bNNaVbry3TZbu54pf57LkhjsFX94T6O62w0roiy1yiE=
go.bytebuilders.dev/license-verifier/kubernetes v0.14.3 h1:PlzARW7Dt/t8WHtuNOxnB7GLhgdq30smRMAPRfyrhh8=
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ github.com/zeebo/xxh3
## explicit; go 1.22.1
go.bytebuilders.dev/audit/api/v1
go.bytebuilders.dev/audit/lib
# go.bytebuilders.dev/license-proxyserver v0.0.18
# go.bytebuilders.dev/license-proxyserver v0.0.19-0.20241022124046-544efbfc2bc4
## explicit; go 1.22.0
go.bytebuilders.dev/license-proxyserver/apis/proxyserver
go.bytebuilders.dev/license-proxyserver/apis/proxyserver/v1alpha1
Expand Down

0 comments on commit 392b6fe

Please sign in to comment.