Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
k8s.io/klog/v2 v2.130.1
kmodules.xyz/client-go v0.30.44
kmodules.xyz/custom-resources v0.30.0
kubedb.dev/apimachinery v0.51.1-0.20250127085441-7f9ee3e6b9a6
kubedb.dev/apimachinery v0.51.1-0.20250202160510-47fd90cafff2
sigs.k8s.io/controller-runtime v0.18.4
xorm.io/xorm v1.3.6
)
Expand Down Expand Up @@ -128,7 +128,7 @@ require (
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/time v0.6.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
gomodules.xyz/mergo v0.3.13 // indirect
gomodules.xyz/pointer v0.1.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
Expand Down Expand Up @@ -663,8 +663,8 @@ kmodules.xyz/monitoring-agent-api v0.30.2 h1:sAgz5P5EXZqhlj1NzJ+QltAgeIx5bGSMj+a
kmodules.xyz/monitoring-agent-api v0.30.2/go.mod h1:BoZFPDDRB7J39CcUsSDlzgW8PQCwik4ILPleyUob+Mg=
kmodules.xyz/offshoot-api v0.30.1 h1:TrulAYO+oBsXe9sZZGTmNWIuI8qD2izMpgcTSPvgAmI=
kmodules.xyz/offshoot-api v0.30.1/go.mod h1:T3mpjR6fui0QzOcmQvIuANytW48fe9ytmy/1cgx6D4g=
kubedb.dev/apimachinery v0.51.1-0.20250127085441-7f9ee3e6b9a6 h1:E03N1SRs3wWppLqHHrfMB1hzNdsgTBI5UwCzMxfWOHI=
kubedb.dev/apimachinery v0.51.1-0.20250127085441-7f9ee3e6b9a6/go.mod h1:pbuXlEZM70Uw1SnSGH7bbzcAiwEYq4NX0CRG8ugODNY=
kubedb.dev/apimachinery v0.51.1-0.20250202160510-47fd90cafff2 h1:zTndwFlUsEHKQvRgPLL4YPf7gPyw1FZ2YI//UiHtn2k=
kubedb.dev/apimachinery v0.51.1-0.20250202160510-47fd90cafff2/go.mod h1:RhOv3GMkMT1GtYE8WTqF7QZAuENDBObKKN4lTJr8YDM=
kubeops.dev/petset v0.0.7 h1:F77BTRfUqRVO7kNc8q2oFSSviDmYBqni/osXqu0kgJ4=
kubeops.dev/petset v0.0.7/go.mod h1:lt0SZV4ohRy7RiwLNUnMoauG4lCbcRbSqhMg20rdUQg=
kubeops.dev/sidekick v0.0.10 h1:/lOT+yV920F6TTPLc7bKR9HLAG/Yx+sTRm1C7rUz744=
Expand Down
4 changes: 2 additions & 2 deletions vendor/golang.org/x/time/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type MariaDBVersionSpec struct {
Version string `json:"version"`
// Database Image
DB MariaDBVersionDatabase `json:"db"`
// Maxscale Image
// +optional
Maxscale MariaDBVersionMaxscale `json:"maxscale"`
// Exporter Image
Exporter MariaDBVersionExporter `json:"exporter"`
// Coordinator Image
Expand Down Expand Up @@ -87,6 +90,14 @@ type MariaDBVersionDatabase struct {
Image string `json:"image"`
}

// MariaDBVersionMaxscale is the mariadb maxscale image
type MariaDBVersionMaxscale struct {
Image string `json:"image"`
// SecurityContext is for the additional config for the maxscale container
// +optional
SecurityContext SecurityContext `json:"securityContext"`
}

// MariaDBVersionExporter is the image for the MariaDB exporter
type MariaDBVersionExporter struct {
Image string `json:"image"`
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 19 additions & 12 deletions vendor/kubedb.dev/apimachinery/apis/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ func SetDefaultResourceLimits(req *core.ResourceRequirements, defaultResources c
// - return limit
// else
// - return default

calLimit := func(name core.ResourceName, defaultValue resource.Quantity) resource.Quantity {
if r, ok := req.Requests[name]; ok {
// l is greater than r == 1.
if l, exist := req.Limits[name]; exist && l.Cmp(r) == 1 {
if l, exist := req.Limits[name]; exist && l.Cmp(r) > 0 {
return l
}
return r
Expand All @@ -56,6 +56,7 @@ func SetDefaultResourceLimits(req *core.ResourceRequirements, defaultResources c
}
return defaultValue
}

// if request is not set,
// - if limit exists:
// - copy limit
Expand All @@ -64,15 +65,15 @@ func SetDefaultResourceLimits(req *core.ResourceRequirements, defaultResources c
// else
// - return request
// endif
calRequest := func(name core.ResourceName, defaultValue resource.Quantity) resource.Quantity {
if r, ok := req.Requests[name]; !ok {
if l, exist := req.Limits[name]; exist {
return l
}
return defaultValue
} else {
calRequest := func(name core.ResourceName, defaultValue resource.Quantity, originalLimit resource.Quantity) resource.Quantity {
if r, ok := req.Requests[name]; ok {
return r
}
if originalLimit.Value() > 0 {
// If original Limits existed, use them for Requests
return originalLimit
}
return defaultValue
}

if req.Limits == nil {
Expand All @@ -82,13 +83,19 @@ func SetDefaultResourceLimits(req *core.ResourceRequirements, defaultResources c
req.Requests = core.ResourceList{}
}

// Calculate the limits first
// Store the original Limits to differentiate between newly set and existing values
originalLimits := make(map[core.ResourceName]resource.Quantity)
for l := range req.Limits {
originalLimits[l] = req.Limits[l]
}

// Calculate limits first
for l := range defaultResources.Limits {
req.Limits[l] = calLimit(l, defaultResources.Limits[l])
}

// Once the limit is calculated, Calculate requests
// Calculate requests after limits
for r := range defaultResources.Requests {
req.Requests[r] = calRequest(r, defaultResources.Requests[r])
req.Requests[r] = calRequest(r, defaultResources.Requests[r], originalLimits[r])
}
}
24 changes: 22 additions & 2 deletions vendor/kubedb.dev/apimachinery/apis/kubedb/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,23 @@ const (
MariaDBMetricsExporterTLSVolumeName = "metrics-exporter-config"
MariaDBMetricsExporterConfigPath = "/etc/mysql/config/exporter"
MariaDBDataVolumeName = "data"
DatabasePodPrimaryComponent = "Primary"
DatabasePodMasterComponent = "Master"
DatabasePodSlaveComponent = "Slave"

// Maxscale
MaxscaleCommonName = "mx"
MaxscaleContainerName = "maxscale"
MaxscaleInitContainerName = "maxscale-init"
MaxscaleServerName = "server"
MaxscaleConfigName = "config"
MaxscaleConfigPath = "/etc/maxscale.cnf.d"
MaxscaleDefaultConfigName = "default-config"
MaxscaleDefaultConfigPath = "/etc/maxscale"
MaxscaleDataVolumeName = "data"
MaxscaleDataVolumePath = "/var/lib/maxscale"
MaxscaleUIPort = 8989
MaxscaleUIPortName = "ui"

// =========================== SingleStore Constants ============================
SinglestoreDatabasePortName = "db"
Expand Down Expand Up @@ -416,9 +433,12 @@ const (
MSSQLDatabasePortName = "db"
MSSQLPrimaryServicePortName = "primary"
MSSQLSecondaryServicePortName = "secondary"
MSSQLCoordinatorPortName = "coordinator"
MSSQLCoordinatorClientPortName = "coordinatclient"
MSSQLDatabasePort = 1433
MSSQLDatabaseMirroringEndpointPort = 5022
MSSQLCoordinatorPort = 2381
MSSQLCoordinatorPort = 2380
MSSQLCoordinatorClientPort = 2379
MSSQLMonitoringDefaultServicePort = 9399

// environment variables
Expand Down Expand Up @@ -1695,7 +1715,7 @@ var (
core.ResourceMemory: resource.MustParse("1.5Gi"),
},
Limits: core.ResourceList{
core.ResourceMemory: resource.MustParse("4Gi"),
core.ResourceMemory: resource.MustParse("2Gi"),
},
}

Expand Down
Loading
Loading