Skip to content

Commit

Permalink
Update health checker (#672)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Aug 3, 2022
1 parent 902c36b commit 0e65567
Show file tree
Hide file tree
Showing 46 changed files with 215 additions and 158 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.24.5
kmodules.xyz/custom-resources v0.24.1
kmodules.xyz/monitoring-agent-api v0.24.0
kubedb.dev/apimachinery v0.28.0-rc.0
kubedb.dev/apimachinery v0.28.0-rc.0.0.20220803084214-1241b40d48ec
stash.appscode.dev/apimachinery v0.22.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1180,8 +1180,8 @@ kmodules.xyz/offshoot-api v0.24.2 h1:QCJEqv++x+FXe7fiTZ/zptJo83qZA4cTUO7YhMlIDvQ
kmodules.xyz/offshoot-api v0.24.2/go.mod h1:fYu0051hoJXXs70OjmIE+Q5smOgmzvYFhRJXCiFShaY=
kmodules.xyz/prober v0.24.0 h1:lh3fDBjYD9bOuFW5Usmf9mFYSNn7r0t65xeN4w2EMgw=
kmodules.xyz/prober v0.24.0/go.mod h1:leon0MFb7OWi/snhosqkNqbwYaED4VEmj7xaLxk851k=
kubedb.dev/apimachinery v0.28.0-rc.0 h1:6OZp21jgkSU8yAJONLvxM9m+dI1Cy+dAe2KXVkkHVmM=
kubedb.dev/apimachinery v0.28.0-rc.0/go.mod h1:XFyYbBJucmbwtfju+JrukS3aH70YygpuPXeb3gvQLio=
kubedb.dev/apimachinery v0.28.0-rc.0.0.20220803084214-1241b40d48ec h1:dYWVRwpeI5odbqSt7/XAdd8eAG/jLZso6IHw4gX0QAw=
kubedb.dev/apimachinery v0.28.0-rc.0.0.20220803084214-1241b40d48ec/go.mod h1:XFyYbBJucmbwtfju+JrukS3aH70YygpuPXeb3gvQLio=
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
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ type MongoDBOpsRequestOptions struct {
Timeout *metav1.Duration `json:"timeout,omitempty"`

// ApplyOption is to control the execution of OpsRequest depending on the database state.
// +kubebuilder:default:="IfReady"
// +kubebuilder:default="IfReady"
Apply opsapi.ApplyOption `json:"apply,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,14 +829,14 @@ func (e *Elasticsearch) SetTLSDefaults(esVersion *catalog.ElasticsearchVersion)
}

func (e *Elasticsearch) SetHealthCheckerDefaults() {
if e.Spec.HealthCheck.PeriodSeconds == nil {
e.Spec.HealthCheck.PeriodSeconds = pointer.Int32P(10)
if e.Spec.HealthChecker.PeriodSeconds == nil {
e.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10)
}
if e.Spec.HealthCheck.TimeoutSeconds == nil {
e.Spec.HealthCheck.TimeoutSeconds = pointer.Int32P(10)
if e.Spec.HealthChecker.TimeoutSeconds == nil {
e.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10)
}
if e.Spec.HealthCheck.FailureThreshold == nil {
e.Spec.HealthCheck.FailureThreshold = pointer.Int32P(1)
if e.Spec.HealthChecker.FailureThreshold == nil {
e.Spec.HealthChecker.FailureThreshold = pointer.Int32P(1)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,13 @@ type ElasticsearchSpec struct {
// It will be applied to all nodes. If the node level `heapSizePercentage` is specified, this global value will be overwritten.
// It defaults to 50% of memory limit.
// +optional
// +kubebuilder:default:=50
// +kubebuilder:default=50
HeapSizePercentage *int32 `json:"heapSizePercentage,omitempty"`

// HealthChecker defines attributes of the health checker
// +optional
HealthCheck HealthCheckSpec `json:"healthCheck"`
// +kubebuilder:default={periodSeconds: 10, timeoutSeconds: 10, failureThreshold: 1}
HealthChecker HealthCheckSpec `json:"healthChecker"`
}

type ElasticsearchClusterTopology struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ func (m *MariaDB) setDefaultAffinity(podTemplate *ofst.PodTemplateSpec, labels m
}

func (m *MariaDB) SetHealthCheckerDefaults() {
if m.Spec.HealthCheck.PeriodSeconds == nil {
m.Spec.HealthCheck.PeriodSeconds = pointer.Int32P(10)
if m.Spec.HealthChecker.PeriodSeconds == nil {
m.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10)
}
if m.Spec.HealthCheck.TimeoutSeconds == nil {
m.Spec.HealthCheck.TimeoutSeconds = pointer.Int32P(10)
if m.Spec.HealthChecker.TimeoutSeconds == nil {
m.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10)
}
if m.Spec.HealthCheck.FailureThreshold == nil {
m.Spec.HealthCheck.FailureThreshold = pointer.Int32P(1)
if m.Spec.HealthChecker.FailureThreshold == nil {
m.Spec.HealthChecker.FailureThreshold = pointer.Int32P(1)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ type MariaDBSpec struct {
// +optional
AllowedSchemas *AllowedConsumers `json:"allowedSchemas,omitempty"`

// HealthChecker defines attributes of the health checker
// +optional
HealthCheck HealthCheckSpec `json:"healthCheck"`
// +kubebuilder:default={periodSeconds: 10, timeoutSeconds: 10, failureThreshold: 1}
HealthChecker HealthCheckSpec `json:"healthChecker"`
}

// +kubebuilder:validation:Enum=server;archiver;metrics-exporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,14 +613,14 @@ func (m *MongoDB) SetDefaults(mgVersion *v1alpha1.MongoDBVersion, topology *core
}

func (m *MongoDB) SetHealthCheckerDefaults() {
if m.Spec.HealthCheck.PeriodSeconds == nil {
m.Spec.HealthCheck.PeriodSeconds = pointer.Int32P(10)
if m.Spec.HealthChecker.PeriodSeconds == nil {
m.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10)
}
if m.Spec.HealthCheck.TimeoutSeconds == nil {
m.Spec.HealthCheck.TimeoutSeconds = pointer.Int32P(10)
if m.Spec.HealthChecker.TimeoutSeconds == nil {
m.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10)
}
if m.Spec.HealthCheck.FailureThreshold == nil {
m.Spec.HealthCheck.FailureThreshold = pointer.Int32P(1)
if m.Spec.HealthChecker.FailureThreshold == nil {
m.Spec.HealthChecker.FailureThreshold = pointer.Int32P(1)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ type MongoDBSpec struct {
// +nullable
Arbiter *MongoArbiterNode `json:"arbiter"`

// HealthChecker defines attributes of the health checker
// +optional
HealthCheck HealthCheckSpec `json:"healthCheck"`
// +kubebuilder:default={periodSeconds: 10, timeoutSeconds: 10, failureThreshold: 1}
HealthChecker HealthCheckSpec `json:"healthChecker"`
}

// +kubebuilder:validation:Enum=server;client;metrics-exporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,14 @@ func (m *MySQL) SetTLSDefaults() {
}

func (m *MySQL) SetHealthCheckerDefaults() {
if m.Spec.HealthCheck.PeriodSeconds == nil {
m.Spec.HealthCheck.PeriodSeconds = pointer.Int32P(10)
if m.Spec.HealthChecker.PeriodSeconds == nil {
m.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10)
}
if m.Spec.HealthCheck.TimeoutSeconds == nil {
m.Spec.HealthCheck.TimeoutSeconds = pointer.Int32P(10)
if m.Spec.HealthChecker.TimeoutSeconds == nil {
m.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10)
}
if m.Spec.HealthCheck.FailureThreshold == nil {
m.Spec.HealthCheck.FailureThreshold = pointer.Int32P(1)
if m.Spec.HealthChecker.FailureThreshold == nil {
m.Spec.HealthChecker.FailureThreshold = pointer.Int32P(1)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ type MySQLSpec struct {

// Indicated whether to use DNS or IP address to address pods in a db cluster.
// If IP address is used, HostNetwork will be used. Defaults to DNS.
// +kubebuilder:default:=DNS
// +kubebuilder:default=DNS
// +optional
// +default="DNS"
UseAddressType AddressType `json:"useAddressType,omitempty"`
Expand All @@ -157,9 +157,10 @@ type MySQLSpec struct {
// +optional
AllowedReadReplicas *AllowedConsumers `json:"allowedReadReplicas,omitempty"`

// HealthCheckSpec defines attributes of the health check
//+optional
HealthCheck HealthCheckSpec `json:"healthCheck"`
// HealthChecker defines attributes of the health checker
// +optional
// +kubebuilder:default={periodSeconds: 10, timeoutSeconds: 10, failureThreshold: 1}
HealthChecker HealthCheckSpec `json:"healthChecker"`
}

// +kubebuilder:validation:Enum=server;client;metrics-exporter
Expand Down Expand Up @@ -235,7 +236,7 @@ type MySQLInnoDBClusterSpec struct {

type MySQLRouterSpec struct {
// +optional
// +kubebuilder:default:=1
// +kubebuilder:default=1
// +kubebuilder:validation:Minimum:=1
Replicas *int32 `json:"replicas,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 @@ -241,14 +241,14 @@ func (p *PerconaXtraDB) setDefaultAffinity(podTemplate *ofst.PodTemplateSpec, la
}

func (p *PerconaXtraDB) SetHealthCheckerDefaults() {
if p.Spec.HealthCheck.PeriodSeconds == nil {
p.Spec.HealthCheck.PeriodSeconds = pointer.Int32P(10)
if p.Spec.HealthChecker.PeriodSeconds == nil {
p.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10)
}
if p.Spec.HealthCheck.TimeoutSeconds == nil {
p.Spec.HealthCheck.TimeoutSeconds = pointer.Int32P(10)
if p.Spec.HealthChecker.TimeoutSeconds == nil {
p.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10)
}
if p.Spec.HealthCheck.FailureThreshold == nil {
p.Spec.HealthCheck.FailureThreshold = pointer.Int32P(1)
if p.Spec.HealthChecker.FailureThreshold == nil {
p.Spec.HealthChecker.FailureThreshold = pointer.Int32P(1)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ type PerconaXtraDBSpec struct {
// +optional
AllowedSchemas *AllowedConsumers `json:"allowedSchemas,omitempty"`

// HealthChecker defines attributes of the health checker
// +optional
HealthCheck HealthCheckSpec `json:"healthCheck"`
// +kubebuilder:default={periodSeconds: 10, timeoutSeconds: 10, failureThreshold: 1}
HealthChecker HealthCheckSpec `json:"healthChecker"`

// SystemUserSecrets contains the system user credentials
// +optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ func (p *PgBouncer) ReplicasAreReady(lister appslister.StatefulSetLister) (bool,
}

func (p *PgBouncer) SetHealthCheckerDefaults() {
if p.Spec.HealthCheck.PeriodSeconds == nil {
p.Spec.HealthCheck.PeriodSeconds = pointer.Int32P(10)
if p.Spec.HealthChecker.PeriodSeconds == nil {
p.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10)
}
if p.Spec.HealthCheck.TimeoutSeconds == nil {
p.Spec.HealthCheck.TimeoutSeconds = pointer.Int32P(10)
if p.Spec.HealthChecker.TimeoutSeconds == nil {
p.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10)
}
if p.Spec.HealthCheck.FailureThreshold == nil {
p.Spec.HealthCheck.FailureThreshold = pointer.Int32P(1)
if p.Spec.HealthChecker.FailureThreshold == nil {
p.Spec.HealthChecker.FailureThreshold = pointer.Int32P(1)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ type PgBouncerSpec struct {
// +optional
TerminationPolicy PgBouncerTerminationPolicy `json:"terminationPolicy,omitempty"`

// HealthChecker defines attributes of the health checker
// +optional
HealthCheck HealthCheckSpec `json:"healthCheck,omitempty"`
// +kubebuilder:default={periodSeconds: 10, timeoutSeconds: 10, failureThreshold: 1}
HealthChecker HealthCheckSpec `json:"healthChecker"`
}

// +kubebuilder:validation:Enum=server;archiver;metrics-exporter
Expand Down
Loading

0 comments on commit 0e65567

Please sign in to comment.