Skip to content

Commit

Permalink
Remove unused mssql ops api fields, defaulting exporter port (#1334)
Browse files Browse the repository at this point in the history
Signed-off-by: Neaj Morshad <neaj@appscode.com>
  • Loading branch information
Neaj-Morshad-101 authored Oct 31, 2024
1 parent 241cc2e commit 019239f
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 25 deletions.
3 changes: 0 additions & 3 deletions apis/autoscaling/v1alpha1/mssqlserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ type MSSQLServerStorageAutoscalerSpec struct {
}

type MSSQLServerOpsRequestOptions struct {
// Specifies the Readiness Criteria
ReadinessCriteria *opsapi.MSSQLServerReplicaReadinessCriteria `json:"readinessCriteria,omitempty"`

// Timeout for each step of the ops request in second. If a step doesn't finish within the specified timeout, the ops request will result in failure.
Timeout *metav1.Duration `json:"timeout,omitempty"`

Expand Down
10 changes: 2 additions & 8 deletions apis/autoscaling/v1alpha1/openapi_generated.go

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

2 changes: 1 addition & 1 deletion apis/autoscaling/v1alpha1/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type ComputeAutoscalerSpec struct {
// +optional
ResourceDiffPercentage int32 `json:"resourceDiffPercentage,omitempty"`

// Specifies the minimum pod life time. The default is 15m.
// Specifies the minimum pod lifetime. The default is 15m.
// If the resource Request is inside the recommended range & there is no quickOOM (out-of-memory),
// we can still update the pod, if that pod's lifeTime is greater than this threshold.
// +optional
Expand Down
5 changes: 0 additions & 5 deletions apis/autoscaling/v1alpha1/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions apis/kubedb/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ const (
MSSQLDatabasePort = 1433
MSSQLDatabaseMirroringEndpointPort = 5022
MSSQLCoordinatorPort = 2381
MSSQLMonitoringDefaultServicePort = 9399

// environment variables
EnvAcceptEula = "ACCEPT_EULA"
Expand Down
10 changes: 8 additions & 2 deletions apis/kubedb/v1alpha2/mssqlserver_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,14 @@ func (m *MSSQLServer) SetDefaults() {

m.setDefaultContainerResourceLimits(m.Spec.PodTemplate)

m.Spec.Monitor.SetDefaults()
if m.Spec.Monitor != nil && m.Spec.Monitor.Prometheus != nil {
if m.Spec.Monitor != nil {
if m.Spec.Monitor.Prometheus == nil {
m.Spec.Monitor.Prometheus = &mona.PrometheusSpec{}
}
if m.Spec.Monitor.Prometheus.Exporter.Port == 0 {
m.Spec.Monitor.Prometheus.Exporter.Port = kubedb.MSSQLMonitoringDefaultServicePort
}
m.Spec.Monitor.SetDefaults()
if m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil {
m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = mssqlVersion.Spec.SecurityContext.RunAsUser
}
Expand Down
2 changes: 1 addition & 1 deletion apis/ops/v1alpha1/mssqlserver_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ type MSSQLServerVerticalScalingSpec struct {

// MSSQLServerVolumeExpansionSpec is the spec for MSSQLServer volume expansion
type MSSQLServerVolumeExpansionSpec struct {
// volume specification for Postgres
// volume specification for MSSQLServer
MSSQLServer *resource.Quantity `json:"mssqlserver,omitempty"`
Mode VolumeExpansionMode `json:"mode"`
}
Expand Down
2 changes: 1 addition & 1 deletion apis/ops/v1alpha1/openapi_generated.go

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

2 changes: 0 additions & 2 deletions crds/autoscaling.kubedb.com_mssqlserverautoscalers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ spec:
- IfReady
- Always
type: string
readinessCriteria:
type: object
timeout:
type: string
type: object
Expand Down
4 changes: 2 additions & 2 deletions pkg/phase/phase.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func PhaseFromCondition(conditions []kmapi.Condition) olddbapi.DatabasePhase {
return olddbapi.DatabasePhaseDataRestoring
}
}
if cutil.IsConditionFalse(conditions, kubedb.DatabaseDataRestored) {
if cutil.HasCondition(conditions, kubedb.DatabaseDataRestored) && cutil.IsConditionFalse(conditions, kubedb.DatabaseDataRestored) {
return olddbapi.DatabasePhaseNotReady
}

Expand Down Expand Up @@ -204,7 +204,7 @@ func PhaseFromConditionV1(conditions []kmapi.Condition) dbapi.DatabasePhase {
return dbapi.DatabasePhaseDataRestoring
}
}
if cutil.IsConditionFalse(conditions, kubedb.DatabaseDataRestored) {
if cutil.HasCondition(conditions, kubedb.DatabaseDataRestored) && cutil.IsConditionFalse(conditions, kubedb.DatabaseDataRestored) {
return dbapi.DatabasePhaseNotReady
}

Expand Down

0 comments on commit 019239f

Please sign in to comment.