Skip to content

Commit

Permalink
Make OpsRequestType specific to databases (#988)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Oct 7, 2022
1 parent e731024 commit 35e1d5e
Show file tree
Hide file tree
Showing 40 changed files with 292 additions and 226 deletions.
4 changes: 2 additions & 2 deletions apis/ops/v1alpha1/elasticsearch_ops_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ func (e *ElasticsearchOpsRequest) GetObjectMeta() metav1.ObjectMeta {
return e.ObjectMeta
}

func (e *ElasticsearchOpsRequest) GetRequestType() OpsRequestType {
return e.Spec.Type
func (e *ElasticsearchOpsRequest) GetRequestType() string {
return string(e.Spec.Type)
}

func (e *ElasticsearchOpsRequest) GetDBRefName() string {
Expand Down
24 changes: 23 additions & 1 deletion apis/ops/v1alpha1/elasticsearch_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type ElasticsearchOpsRequestSpec struct {
// Specifies the Elasticsearch reference
DatabaseRef core.LocalObjectReference `json:"databaseRef"`
// Specifies the ops request type: Upgrade, HorizontalScaling, VerticalScaling etc.
Type OpsRequestType `json:"type"`
Type ElasticsearchOpsRequestType `json:"type"`
// Specifies information necessary for upgrading Elasticsearch
Upgrade *ElasticsearchUpgradeSpec `json:"upgrade,omitempty"`
// Specifies information necessary for horizontal scaling
Expand All @@ -75,6 +75,28 @@ type ElasticsearchOpsRequestSpec struct {
Apply ApplyOption `json:"apply,omitempty"`
}

// +kubebuilder:validation:Enum=Upgrade;UpdateVersion;HorizontalScaling;VerticalScaling;VolumeExpansion;Restart;Reconfigure;ReconfigureTLS
type ElasticsearchOpsRequestType string

const (
// Deprecated. Use UpdateVersion
ElasticsearchOpsRequestTypeUpgrade ElasticsearchOpsRequestType = "Upgrade"
// used for UpdateVersion operation
ElasticsearchOpsRequestTypeUpdateVersion ElasticsearchOpsRequestType = "UpdateVersion"
// used for HorizontalScaling operation
ElasticsearchOpsRequestTypeHorizontalScaling ElasticsearchOpsRequestType = "HorizontalScaling"
// used for VerticalScaling operation
ElasticsearchOpsRequestTypeVerticalScaling ElasticsearchOpsRequestType = "VerticalScaling"
// used for VolumeExpansion operation
ElasticsearchOpsRequestTypeVolumeExpansion ElasticsearchOpsRequestType = "VolumeExpansion"
// used for Restart operation
ElasticsearchOpsRequestTypeRestart ElasticsearchOpsRequestType = "Restart"
// used for Reconfigure operation
ElasticsearchOpsRequestTypeReconfigure ElasticsearchOpsRequestType = "Reconfigure"
// used for ReconfigureTLS operation
ElasticsearchOpsRequestTypeReconfigureTLSs ElasticsearchOpsRequestType = "ReconfigureTLS"
)

// ElasticsearchReplicaReadinessCriteria is the criteria for checking readiness of an Elasticsearch database
type ElasticsearchReplicaReadinessCriteria struct{}

Expand Down
4 changes: 2 additions & 2 deletions apis/ops/v1alpha1/etcd_ops_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ func (e *EtcdOpsRequest) GetObjectMeta() metav1.ObjectMeta {
return e.ObjectMeta
}

func (e *EtcdOpsRequest) GetRequestType() OpsRequestType {
return e.Spec.Type
func (e *EtcdOpsRequest) GetRequestType() string {
return string(e.Spec.Type)
}

func (e *EtcdOpsRequest) GetDBRefName() string {
Expand Down
22 changes: 21 additions & 1 deletion apis/ops/v1alpha1/etcd_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type EtcdOpsRequestSpec struct {
// Specifies the Etcd reference
DatabaseRef core.LocalObjectReference `json:"databaseRef"`
// Specifies the ops request type: Upgrade, HorizontalScaling, VerticalScaling etc.
Type OpsRequestType `json:"type"`
Type EtcdOpsRequestType `json:"type"`
// Specifies information necessary for upgrading Etcd
Upgrade *EtcdUpgradeSpec `json:"upgrade,omitempty"`
// Specifies information necessary for horizontal scaling
Expand All @@ -72,6 +72,26 @@ type EtcdOpsRequestSpec struct {
Apply ApplyOption `json:"apply,omitempty"`
}

// +kubebuilder:validation:Enum=UpdateVersion;HorizontalScaling;VerticalScaling;VolumeExpansion;Restart;Reconfigure;ReconfigureTLS
type EtcdOpsRequestType string

const (
// used for UpdateVersion operation
EtcdOpsRequestTypeUpdateVersion EtcdOpsRequestType = "UpdateVersion"
// used for HorizontalScaling operation
EtcdOpsRequestTypeHorizontalScaling EtcdOpsRequestType = "HorizontalScaling"
// used for VerticalScaling operation
EtcdOpsRequestTypeVerticalScaling EtcdOpsRequestType = "VerticalScaling"
// used for VolumeExpansion operation
EtcdOpsRequestTypeVolumeExpansion EtcdOpsRequestType = "VolumeExpansion"
// used for Restart operation
EtcdOpsRequestTypeRestart EtcdOpsRequestType = "Restart"
// used for Reconfigure operation
EtcdOpsRequestTypeReconfigure EtcdOpsRequestType = "Reconfigure"
// used for ReconfigureTLS operation
EtcdOpsRequestTypeReconfigureTLSs EtcdOpsRequestType = "ReconfigureTLS"
)

// EtcdReplicaReadinessCriteria is the criteria for checking readiness of a Etcd pod
// after updating, horizontal scaling etc.
type EtcdReplicaReadinessCriteria struct{}
Expand Down
4 changes: 2 additions & 2 deletions apis/ops/v1alpha1/mariadb_ops_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func (e *MariaDBOpsRequest) GetObjectMeta() metav1.ObjectMeta {
return e.ObjectMeta
}

func (e *MariaDBOpsRequest) GetRequestType() OpsRequestType {
return e.Spec.Type
func (e *MariaDBOpsRequest) GetRequestType() string {
return string(e.Spec.Type)
}

func (e *MariaDBOpsRequest) GetDBRefName() string {
Expand Down
24 changes: 23 additions & 1 deletion apis/ops/v1alpha1/mariadb_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type MariaDBOpsRequestSpec struct {
// Specifies the MariaDB reference
DatabaseRef core.LocalObjectReference `json:"databaseRef"`
// Specifies the ops request type: Upgrade, HorizontalScaling, VerticalScaling etc.
Type OpsRequestType `json:"type"`
Type MariaDBOpsRequestType `json:"type"`
// Specifies information necessary for upgrading MariaDB
Upgrade *MariaDBUpgradeSpec `json:"upgrade,omitempty"`
// Specifies information necessary for horizontal scaling
Expand All @@ -75,6 +75,28 @@ type MariaDBOpsRequestSpec struct {
Apply ApplyOption `json:"apply,omitempty"`
}

// +kubebuilder:validation:Enum=Upgrade;UpdateVersion;HorizontalScaling;VerticalScaling;VolumeExpansion;Restart;Reconfigure;ReconfigureTLS
type MariaDBOpsRequestType string

const (
// Deprecated. Use UpdateVersion
MariaDBOpsRequestTypeUpgrade MariaDBOpsRequestType = "Upgrade"
// used for UpdateVersion operation
MariaDBOpsRequestTypeUpdateVersion MariaDBOpsRequestType = "UpdateVersion"
// used for HorizontalScaling operation
MariaDBOpsRequestTypeHorizontalScaling MariaDBOpsRequestType = "HorizontalScaling"
// used for VerticalScaling operation
MariaDBOpsRequestTypeVerticalScaling MariaDBOpsRequestType = "VerticalScaling"
// used for VolumeExpansion operation
MariaDBOpsRequestTypeVolumeExpansion MariaDBOpsRequestType = "VolumeExpansion"
// used for Restart operation
MariaDBOpsRequestTypeRestart MariaDBOpsRequestType = "Restart"
// used for Reconfigure operation
MariaDBOpsRequestTypeReconfigure MariaDBOpsRequestType = "Reconfigure"
// used for ReconfigureTLS operation
MariaDBOpsRequestTypeReconfigureTLSs MariaDBOpsRequestType = "ReconfigureTLS"
)

// MariaDBReplicaReadinessCriteria is the criteria for checking readiness of an MariaDB database
type MariaDBReplicaReadinessCriteria struct{}

Expand Down
4 changes: 2 additions & 2 deletions apis/ops/v1alpha1/memcached_ops_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ func (e *MemcachedOpsRequest) GetObjectMeta() metav1.ObjectMeta {
return e.ObjectMeta
}

func (e *MemcachedOpsRequest) GetRequestType() OpsRequestType {
return e.Spec.Type
func (e *MemcachedOpsRequest) GetRequestType() string {
return string(e.Spec.Type)
}

func (e *MemcachedOpsRequest) GetDBRefName() string {
Expand Down
24 changes: 23 additions & 1 deletion apis/ops/v1alpha1/memcached_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type MemcachedOpsRequestSpec struct {
// Specifies the Memcached reference
DatabaseRef core.LocalObjectReference `json:"databaseRef"`
// Specifies the ops request type: Upgrade, HorizontalScaling, VerticalScaling etc.
Type OpsRequestType `json:"type"`
Type MemcachedOpsRequestType `json:"type"`
// Specifies information necessary for upgrading Memcached
Upgrade *MemcachedUpgradeSpec `json:"upgrade,omitempty"`
// Specifies information necessary for horizontal scaling
Expand All @@ -72,6 +72,28 @@ type MemcachedOpsRequestSpec struct {
Apply ApplyOption `json:"apply,omitempty"`
}

// +kubebuilder:validation:Enum=Upgrade;UpdateVersion;HorizontalScaling;VerticalScaling;VolumeExpansion;Restart;Reconfigure;ReconfigureTLS
type MemcachedOpsRequestType string

const (
// Deprecated. Use UpdateVersion
MemcachedOpsRequestTypeUpgrade MemcachedOpsRequestType = "Upgrade"
// used for UpdateVersion operation
MemcachedOpsRequestTypeUpdateVersion MemcachedOpsRequestType = "UpdateVersion"
// used for HorizontalScaling operation
MemcachedOpsRequestTypeHorizontalScaling MemcachedOpsRequestType = "HorizontalScaling"
// used for VerticalScaling operation
MemcachedOpsRequestTypeVerticalScaling MemcachedOpsRequestType = "VerticalScaling"
// used for VolumeExpansion operation
MemcachedOpsRequestTypeVolumeExpansion MemcachedOpsRequestType = "VolumeExpansion"
// used for Restart operation
MemcachedOpsRequestTypeRestart MemcachedOpsRequestType = "Restart"
// used for Reconfigure operation
MemcachedOpsRequestTypeReconfigure MemcachedOpsRequestType = "Reconfigure"
// used for ReconfigureTLS operation
MemcachedOpsRequestTypeReconfigureTLSs MemcachedOpsRequestType = "ReconfigureTLS"
)

// MemcachedReplicaReadinessCriteria is the criteria for checking readiness of a Memcached pod
// after updating, horizontal scaling etc.
type MemcachedReplicaReadinessCriteria struct{}
Expand Down
4 changes: 2 additions & 2 deletions apis/ops/v1alpha1/mongodb_ops_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ func (e *MongoDBOpsRequest) GetObjectMeta() metav1.ObjectMeta {
return e.ObjectMeta
}

func (e *MongoDBOpsRequest) GetRequestType() OpsRequestType {
return e.Spec.Type
func (e *MongoDBOpsRequest) GetRequestType() string {
return string(e.Spec.Type)
}

func (e *MongoDBOpsRequest) GetDBRefName() string {
Expand Down
26 changes: 25 additions & 1 deletion apis/ops/v1alpha1/mongodb_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type MongoDBOpsRequestSpec struct {
// Specifies the MongoDB reference
DatabaseRef core.LocalObjectReference `json:"databaseRef"`
// Specifies the ops request type: Upgrade, HorizontalScaling, VerticalScaling etc.
Type OpsRequestType `json:"type"`
Type MongoDBOpsRequestType `json:"type"`
// Specifies information necessary for upgrading mongodb
Upgrade *MongoDBUpgradeSpec `json:"upgrade,omitempty"`
// Specifies information necessary for horizontal scaling
Expand All @@ -80,6 +80,30 @@ type MongoDBOpsRequestSpec struct {
Apply ApplyOption `json:"apply,omitempty"`
}

// +kubebuilder:validation:Enum=Upgrade;UpdateVersion;HorizontalScaling;VerticalScaling;VolumeExpansion;Restart;Reconfigure;ReconfigureTLS;Reprovision
type MongoDBOpsRequestType string

const (
// Deprecated. Use UpdateVersion
MongoDBOpsRequestTypeUpgrade MongoDBOpsRequestType = "Upgrade"
// used for UpdateVersion operation
MongoDBOpsRequestTypeUpdateVersion MongoDBOpsRequestType = "UpdateVersion"
// used for HorizontalScaling operation
MongoDBOpsRequestTypeHorizontalScaling MongoDBOpsRequestType = "HorizontalScaling"
// used for VerticalScaling operation
MongoDBOpsRequestTypeVerticalScaling MongoDBOpsRequestType = "VerticalScaling"
// used for VolumeExpansion operation
MongoDBOpsRequestTypeVolumeExpansion MongoDBOpsRequestType = "VolumeExpansion"
// used for Restart operation
MongoDBOpsRequestTypeRestart MongoDBOpsRequestType = "Restart"
// used for Reconfigure operation
MongoDBOpsRequestTypeReconfigure MongoDBOpsRequestType = "Reconfigure"
// used for ReconfigureTLS operation
MongoDBOpsRequestTypeReconfigureTLSs MongoDBOpsRequestType = "ReconfigureTLS"
// used for Reprovision operation
MongoDBOpsRequestTypeReprovision MongoDBOpsRequestType = "Reprovision"
)

// MongoDBReplicaReadinessCriteria is the criteria for checking readiness of a MongoDB pod
// after restarting the pod
type MongoDBReplicaReadinessCriteria struct {
Expand Down
4 changes: 2 additions & 2 deletions apis/ops/v1alpha1/mysql_ops_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ func (e *MySQLOpsRequest) GetObjectMeta() metav1.ObjectMeta {
return e.ObjectMeta
}

func (e *MySQLOpsRequest) GetRequestType() OpsRequestType {
return e.Spec.Type
func (e *MySQLOpsRequest) GetRequestType() string {
return string(e.Spec.Type)
}

func (e *MySQLOpsRequest) GetDBRefName() string {
Expand Down
24 changes: 23 additions & 1 deletion apis/ops/v1alpha1/mysql_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type MySQLOpsRequestSpec struct {
// Specifies the MySQL reference
DatabaseRef core.LocalObjectReference `json:"databaseRef"`
// Specifies the ops request type: Upgrade, HorizontalScaling, VerticalScaling etc.
Type OpsRequestType `json:"type"`
Type MySQLOpsRequestType `json:"type"`
// Specifies information necessary for upgrading MySQL
Upgrade *MySQLUpgradeSpec `json:"upgrade,omitempty"`
// Specifies information necessary for horizontal scaling
Expand All @@ -75,6 +75,28 @@ type MySQLOpsRequestSpec struct {
Apply ApplyOption `json:"apply,omitempty"`
}

// +kubebuilder:validation:Enum=Upgrade;UpdateVersion;HorizontalScaling;VerticalScaling;VolumeExpansion;Restart;Reconfigure;ReconfigureTLS
type MySQLOpsRequestType string

const (
// Deprecated. Use UpdateVersion
MySQLOpsRequestTypeUpgrade MySQLOpsRequestType = "Upgrade"
// used for UpdateVersion operation
MySQLOpsRequestTypeUpdateVersion MySQLOpsRequestType = "UpdateVersion"
// used for HorizontalScaling operation
MySQLOpsRequestTypeHorizontalScaling MySQLOpsRequestType = "HorizontalScaling"
// used for VerticalScaling operation
MySQLOpsRequestTypeVerticalScaling MySQLOpsRequestType = "VerticalScaling"
// used for VolumeExpansion operation
MySQLOpsRequestTypeVolumeExpansion MySQLOpsRequestType = "VolumeExpansion"
// used for Restart operation
MySQLOpsRequestTypeRestart MySQLOpsRequestType = "Restart"
// used for Reconfigure operation
MySQLOpsRequestTypeReconfigure MySQLOpsRequestType = "Reconfigure"
// used for ReconfigureTLS operation
MySQLOpsRequestTypeReconfigureTLSs MySQLOpsRequestType = "ReconfigureTLS"
)

// MySQLReplicaReadinessCriteria is the criteria for checking readiness of a MySQL pod
// after updating, horizontal scaling etc.
type MySQLReplicaReadinessCriteria struct{}
Expand Down
Loading

0 comments on commit 35e1d5e

Please sign in to comment.