Skip to content

Commit

Permalink
Prepare for release v0.38.0
Browse files Browse the repository at this point in the history
ProductLine: KubeDB

Release: v2023.12.11

Release-tracker: kubedb/CHANGELOG#77
Signed-off-by: 1gtm <[email protected]>
  • Loading branch information
1gtm committed Dec 8, 2023
1 parent a99b285 commit 90473e9
Show file tree
Hide file tree
Showing 17 changed files with 200 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
kmodules.xyz/client-go v0.25.43
kmodules.xyz/custom-resources v0.25.2
kmodules.xyz/monitoring-agent-api v0.25.6
kubedb.dev/apimachinery v0.38.0-rc.1
kubedb.dev/apimachinery v0.38.0
kubedb.dev/db-client-go v0.0.8-0.20230818101900-6ddd035705ef
sigs.k8s.io/controller-runtime v0.13.1
sigs.k8s.io/yaml v1.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1413,8 +1413,8 @@ kmodules.xyz/offshoot-api v0.25.5 h1:erUtTDj9iljikd9CvrCz0E32P5mgEqq1NYxy06lxrNo
kmodules.xyz/offshoot-api v0.25.5/go.mod h1:wotLtcXWHw6KrWX6Ry2EsHn2I2QTvyLX7gXAuwBjkFc=
kmodules.xyz/prober v0.25.0 h1:R5uRLHJEvEtEoogj+vaTAob0Btph6+PX5IlS6hPh8PA=
kmodules.xyz/prober v0.25.0/go.mod h1:z4RTnjaajNQa/vPltsiOnO3xI716I/ziD2ac2Exm+1M=
kubedb.dev/apimachinery v0.38.0-rc.1 h1:EkqgCtr6JA9AIlhUSHBmxN04AnjEEYWcaxUtP3JjVL0=
kubedb.dev/apimachinery v0.38.0-rc.1/go.mod h1:cIralklbh1plpXPLCMweCATKzQV/YwX6RRzroiMCKGE=
kubedb.dev/apimachinery v0.38.0 h1:ggYtuTZFnEf4IrqVQ25EzVuOkBDSBWoin+tntajScIU=
kubedb.dev/apimachinery v0.38.0/go.mod h1:cIralklbh1plpXPLCMweCATKzQV/YwX6RRzroiMCKGE=
kubedb.dev/db-client-go v0.0.8-0.20230818101900-6ddd035705ef h1:1efGdivo8V46zH0umhrmSbJ1eBwqZcqQ6kMcKHe5+d0=
kubedb.dev/db-client-go v0.0.8-0.20230818101900-6ddd035705ef/go.mod h1:rjVBtbrycRJg1SAa/YMNmQerbhTt+4CXW737rNG6wAM=
kubeops.dev/sidekick v0.0.3 h1:xkIcgnOgBAblhDbsIWIJOIhAGZLzWieqPpm1VhGHTlU=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// nolint:goconst
package v1alpha1

import (
Expand Down
22 changes: 22 additions & 0 deletions vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ const (

SharedBuffersGbAsKiloByte = 1024 * 1024
SharedBuffersMbAsKiloByte = 1024
IPS_LOCK = "IPC_LOCK"
SYS_RESOURCE = "SYS_RESOURCE"
DropCapabilityALL = "ALL"

// =========================== ProxySQL Constants ============================
LabelProxySQLName = ProxySQLKey + "/name"
Expand Down Expand Up @@ -676,6 +679,17 @@ var (
core.ResourceMemory: resource.MustParse("256Mi"),
},
}
defaultArbiter = core.ResourceRequirements{
Requests: core.ResourceList{
core.ResourceStorage: resource.MustParse("2Gi"),
// these are the default cpu & memory for a coordinator container
core.ResourceCPU: resource.MustParse(".200"),
core.ResourceMemory: resource.MustParse("256Mi"),
},
Limits: core.ResourceList{
core.ResourceMemory: resource.MustParse("256Mi"),
},
}

// DefaultResourcesElasticSearch must be used for elasticsearch
// to avoid OOMKILLED while deploying ES V8
Expand All @@ -690,6 +704,14 @@ var (
}
)

func DefaultArbiter(computeOnly bool) core.ResourceRequirements {
cp := defaultArbiter.DeepCopy()
if computeOnly {
delete(cp.Requests, core.ResourceStorage)
}
return *cp
}

const (
InitFromGit = "init-from-git"
InitFromGitMountPath = "/git"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// nolint:goconst
package v1alpha2

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (k *Kafka) SetupWebhookWithManager(mgr ctrl.Manager) error {
Complete()
}

//+kubebuilder:webhook:path=/mutate-kafka-kubedb-com-v1alpha1-kafka,mutating=true,failurePolicy=fail,sideEffects=None,groups=kubedb.com,resources=kafkas,verbs=create,versions=v1alpha1,name=mkafka.kb.io,admissionReviewVersions={v1,v1beta1}
//+kubebuilder:webhook:path=/mutate-kafka-kubedb-com-v1alpha1-kafka,mutating=true,failurePolicy=fail,sideEffects=None,groups=kubedb.com,resources=kafkas,verbs=create;update,versions=v1alpha1,name=mkafka.kb.io,admissionReviewVersions={v1,v1beta1}

var _ webhook.Defaulter = &Kafka{}

Expand Down

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 @@ -261,7 +261,7 @@ func (p *Postgres) SetDefaults(postgresVersion *catalog.PostgresVersion, topolog
// So that /var/pv directory have the group permission for the RunAsGroup user GID.
// Otherwise, We will get write permission denied.
p.Spec.PodTemplate.Spec.SecurityContext.FSGroup = p.Spec.PodTemplate.Spec.ContainerSecurityContext.RunAsGroup

p.SetArbiterDefault()
p.Spec.Monitor.SetDefaults()
p.SetTLSDefaults()
p.SetHealthCheckerDefaults()
Expand All @@ -272,6 +272,15 @@ func (p *Postgres) SetDefaults(postgresVersion *catalog.PostgresVersion, topolog
}
}

func (p *Postgres) SetArbiterDefault() {
if p.Spec.Arbiter == nil {
p.Spec.Arbiter = &ArbiterSpec{
Resources: core.ResourceRequirements{},
}
}
apis.SetDefaultResourceLimits(&p.Spec.Arbiter.Resources, DefaultArbiter(false))
}

func (p *Postgres) setDefaultInitContainerSecurityContext(podTemplate *ofst.PodTemplateSpec, pgVersion *catalog.PostgresVersion) {
if podTemplate == nil {
return
Expand Down Expand Up @@ -322,17 +331,44 @@ func (p *Postgres) setDefaultContainerSecurityContext(podTemplate *ofst.PodTempl
if podTemplate.Spec.SecurityContext.FSGroup == nil {
podTemplate.Spec.SecurityContext.FSGroup = pgVersion.Spec.SecurityContext.RunAsUser
}
p.setDefaultCapabilitiesForPostgres(podTemplate.Spec.ContainerSecurityContext)
p.assignDefaultContainerSecurityContext(podTemplate.Spec.ContainerSecurityContext, pgVersion)
}

func (p *Postgres) setDefaultCapabilitiesForPostgres(sc *core.SecurityContext) {
if sc.Capabilities == nil {
sc.Capabilities = &core.Capabilities{
Add: []core.Capability{IPS_LOCK, SYS_RESOURCE},
}
} else {
newCapabilities := &core.Capabilities{}
caps := []core.Capability{IPS_LOCK, SYS_RESOURCE}
if sc.Capabilities.Add == nil {
newCapabilities.Add = caps
} else {
newCapabilities.Add = sc.Capabilities.Add
for i := range caps {
found := false
for _, capability := range sc.Capabilities.Add {
if caps[i] == capability {
found = true
}
}
if !found {
newCapabilities.Add = append(newCapabilities.Add, caps[i])
}
}
}
sc.Capabilities = newCapabilities
}
}

func (p *Postgres) assignDefaultContainerSecurityContext(sc *core.SecurityContext, pgVersion *catalog.PostgresVersion) {
if sc.AllowPrivilegeEscalation == nil {
sc.AllowPrivilegeEscalation = pointer.BoolP(false)
}
if sc.Capabilities == nil {
sc.Capabilities = &core.Capabilities{
Drop: []core.Capability{"ALL"},
}
sc.Capabilities = &core.Capabilities{}
}
if sc.RunAsNonRoot == nil {
sc.RunAsNonRoot = pointer.BoolP(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ type PostgresSpec struct {
// Archiver controls database backup using Archiver CR
// +optional
Archiver *Archiver `json:"archiver,omitempty"`

// Arbiter controls spec for arbiter pods
// +optional
Arbiter *ArbiterSpec `json:"arbiter,omitempty"`
}

type ArbiterSpec struct {
// Compute Resources required by the sidecar container.
// +optional
Resources core.ResourceRequirements `json:"resources,omitempty"`
}

// PostgreLeaderElectionConfig contains essential attributes of leader election.
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.

Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ type PostgresVerticalScalingSpec struct {
Postgres *core.ResourceRequirements `json:"postgres,omitempty"`
Exporter *core.ResourceRequirements `json:"exporter,omitempty"`
Coordinator *core.ResourceRequirements `json:"coordinator,omitempty"`
Arbiter *core.ResourceRequirements `json:"arbiter,omitempty"`
}

// PostgresVolumeExpansionSpec is the spec for Postgres volume expansion
type PostgresVolumeExpansionSpec struct {
// volume specification for Postgres
Postgres *resource.Quantity `json:"postgres,omitempty"`
Arbiter *resource.Quantity `json:"arbiter,omitempty"`
Mode *VolumeExpansionMode `json:"mode,omitempty"`
}

Expand Down

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 @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// nolint:goconst
package v1alpha1

import (
Expand Down
22 changes: 22 additions & 0 deletions vendor/kubedb.dev/apimachinery/crds/kubedb.com_postgreses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,28 @@ spec:
type: object
x-kubernetes-map-type: atomic
type: object
arbiter:
properties:
resources:
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
type: object
type: object
archiver:
properties:
pause:
Expand Down
Loading

0 comments on commit 90473e9

Please sign in to comment.