Skip to content

Commit

Permalink
Prepare for release v0.30.0-rc.1 (#690)
Browse files Browse the repository at this point in the history
ProductLine: KubeDB

Release: v2022.12.24-rc.1

Release-tracker: kubedb/CHANGELOG#61
Signed-off-by: 1gtm <[email protected]>

Signed-off-by: 1gtm <[email protected]>
  • Loading branch information
1gtm authored Dec 24, 2022
1 parent 1bf92e0 commit f91038a
Show file tree
Hide file tree
Showing 26 changed files with 1,980 additions and 315 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
kmodules.xyz/client-go v0.25.13
kmodules.xyz/custom-resources v0.25.1
kmodules.xyz/monitoring-agent-api v0.25.0
kubedb.dev/apimachinery v0.30.0-rc.0
kubedb.dev/apimachinery v0.30.0-rc.1
stash.appscode.dev/apimachinery v0.24.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -999,8 +999,8 @@ kmodules.xyz/offshoot-api v0.25.0 h1:Svq9da/+sg5afOjpgo9vx2J/Lu90Mo0aFxkdQmgKnGI
kmodules.xyz/offshoot-api v0.25.0/go.mod h1:ysEBn7LJuT3+s8ynAQA/OG0BSsJugXa6KGtDLMRjlKo=
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.30.0-rc.0 h1:mtQMy80JlJXdvOVTf59jCI689wkPbQo+mjLah5dJv3k=
kubedb.dev/apimachinery v0.30.0-rc.0/go.mod h1:Uv/URB0rk9wvOvGP7iCkPhCndBoCiQvYNyHTKnVUR4U=
kubedb.dev/apimachinery v0.30.0-rc.1 h1:grV9luht00H0mpYQEnsfrXBPC0j8M9IykBnz4lRmrFc=
kubedb.dev/apimachinery v0.30.0-rc.1/go.mod h1:S6OFRiK8WWDwIRo/P4c2N8iWWo7+JpRMKamBctMw7Pc=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
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 @@ -61,7 +61,7 @@ type PgBouncerAutoscaler struct {
type PgBouncerAutoscalerSpec struct {
// scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics
// should be collected, as well as to actually change the replica count.
ScaleTargetRef core.LocalObjectReference `json:"scaleTargetRef"`
ServerRef core.LocalObjectReference `json:"serverRef"`
// minReplicas is the lower limit for the number of replicas to which the autoscaler
// can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the
// alpha feature gate HPAScaleToZero is enabled and at least one Object or External
Expand Down

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

30 changes: 16 additions & 14 deletions vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,24 +434,26 @@ const (

RedisKeyFileSecretSuffix = "key"
RedisPEMSecretSuffix = "pem"
RedisRootUsername = "root"
RedisRootUsername = "default"
EnvRedisUser = "USERNAME"
EnvRedisPassword = "REDISCLI_AUTH"

// =========================== PgBouncer Constants ============================
PgBouncerUpstreamServerCA = "upstream-server-ca.crt"
PgBouncerUpstreamServerClientCert = "upstream-server-client.crt"
PgBouncerUpstreamServerClientKey = "upstream-server-client.key"
PgBouncerClientCrt = "client.crt"
PgBouncerClientKey = "client.key"
PgBouncerCACrt = "ca.crt"
PgBouncerTLSCrt = "tls.crt"
PgBouncerTLSKey = "tls.key"
PgBouncerDatabasePortName = "db"
PgBouncerPrimaryServicePortName = "primary"
PgBouncerDatabasePort = 5432
PgBouncerConfigFile = "pgbouncer.ini"
PgBouncerAdminUsername = "kubedb"
PgBouncerUpstreamServerCA = "upstream-server-ca.crt"
PgBouncerUpstreamServerClientCert = "upstream-server-client.crt"
PgBouncerUpstreamServerClientKey = "upstream-server-client.key"
PgBouncerClientCrt = "client.crt"
PgBouncerClientKey = "client.key"
PgBouncerCACrt = "ca.crt"
PgBouncerTLSCrt = "tls.crt"
PgBouncerTLSKey = "tls.key"
PgBouncerDatabasePortName = "db"
PgBouncerPrimaryServicePortName = "primary"
PgBouncerDatabasePort = 5432
PgBouncerConfigFile = "pgbouncer.ini"
PgBouncerAdminUsername = "pgbouncer"
PgBouncerDefaultPoolMode = "session"
PgBouncerDefaultIgnoreStartupParameters = "empty"
)

// List of possible condition types for a KubeDB object
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 @@ -102,9 +102,16 @@ func (p PgBouncer) GoverningServiceName() string {
}

func (p PgBouncer) GetAuthSecretName() string {
if p.Spec.AuthSecret != nil && p.Spec.AuthSecret.Name != "" {
return p.Spec.AuthSecret.Name
}
return meta_util.NameWithSuffix(p.OffshootName(), "auth")
}

func (p PgBouncer) GetBackendSecretName() string {
return meta_util.NameWithSuffix(p.OffshootName(), "backend")
}

func (p PgBouncer) ConfigSecretName() string {
return meta_util.NameWithSuffix(p.ServiceName(), "config")
}
Expand Down Expand Up @@ -174,20 +181,16 @@ func (p *PgBouncer) SetDefaults() {
p.Spec.TerminationPolicy = PgBouncerTerminationPolicyDelete
}

p.setConnectionPoolConfigDefaults()

if p.Spec.TLS != nil {
if p.Spec.SSLMode == "" {
p.Spec.SSLMode = PgBouncerSSLModeVerifyFull
}
if p.Spec.ConnectionPool.AuthType == "" {
p.Spec.ConnectionPool.AuthType = PgBouncerClientAuthModeMD5
}
} else {
if p.Spec.SSLMode == "" {
p.Spec.SSLMode = PgBouncerSSLModeDisable
}
if p.Spec.ConnectionPool.AuthType == "" {
p.Spec.ConnectionPool.AuthType = PgBouncerClientAuthModeMD5
}
}

p.Spec.Monitor.SetDefaults()
Expand Down Expand Up @@ -218,6 +221,7 @@ func (p *PgBouncer) GetPersistentSecrets() []string {
}
var secrets []string
secrets = append(secrets, p.GetAuthSecretName())
secrets = append(secrets, p.GetBackendSecretName())
secrets = append(secrets, p.ConfigSecretName())

return secrets
Expand Down Expand Up @@ -252,3 +256,45 @@ func (p *PgBouncer) SetHealthCheckerDefaults() {
p.Spec.HealthChecker.FailureThreshold = pointer.Int32P(1)
}
}

func (p *PgBouncer) setConnectionPoolConfigDefaults() {
if p.Spec.ConnectionPool == nil {
p.Spec.ConnectionPool = &ConnectionPoolConfig{}
}
if p.Spec.ConnectionPool.Port == nil {
p.Spec.ConnectionPool.Port = pointer.Int32P(5432)
}
if p.Spec.ConnectionPool.PoolMode == "" {
p.Spec.ConnectionPool.PoolMode = PgBouncerDefaultPoolMode
}
if p.Spec.ConnectionPool.MaxClientConnections == nil {
p.Spec.ConnectionPool.MaxClientConnections = pointer.Int64P(100)
}
if p.Spec.ConnectionPool.DefaultPoolSize == nil {
p.Spec.ConnectionPool.DefaultPoolSize = pointer.Int64P(20)
}
if p.Spec.ConnectionPool.MinPoolSize == nil {
p.Spec.ConnectionPool.MinPoolSize = pointer.Int64P(0)
}
if p.Spec.ConnectionPool.ReservePoolSize == nil {
p.Spec.ConnectionPool.ReservePoolSize = pointer.Int64P(0)
}
if p.Spec.ConnectionPool.ReservePoolTimeoutSeconds == nil {
p.Spec.ConnectionPool.ReservePoolTimeoutSeconds = pointer.Int64P(5)
}
if p.Spec.ConnectionPool.MaxDBConnections == nil {
p.Spec.ConnectionPool.MaxDBConnections = pointer.Int64P(0)
}
if p.Spec.ConnectionPool.MaxUserConnections == nil {
p.Spec.ConnectionPool.MaxUserConnections = pointer.Int64P(0)
}
if p.Spec.ConnectionPool.StatsPeriodSeconds == nil {
p.Spec.ConnectionPool.StatsPeriodSeconds = pointer.Int64P(60)
}
if p.Spec.ConnectionPool.AuthType == "" {
p.Spec.ConnectionPool.AuthType = PgBouncerClientAuthModeMD5
}
if p.Spec.ConnectionPool.IgnoreStartupParameters == "" {
p.Spec.ConnectionPool.IgnoreStartupParameters = PgBouncerDefaultIgnoreStartupParameters
}
}
Loading

0 comments on commit f91038a

Please sign in to comment.