Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RabbitMQ OpsRequests #1225

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apis/ops/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,8 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
func(s *v1alpha1.RedisOpsRequest, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again
},
func(s *v1alpha1.RabbitMQOpsRequest, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again
},
}
}
113 changes: 112 additions & 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.

45 changes: 43 additions & 2 deletions apis/ops/v1alpha1/rabbitmq_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,18 @@ type RabbitMQOpsRequestSpec struct {
DatabaseRef core.LocalObjectReference `json:"databaseRef"`
// Specifies the ops request type: UpdateVersion, HorizontalScaling, VerticalScaling etc.
Type RabbitMQOpsRequestType `json:"type"`
// Specifies information necessary for upgrading rabbitmq
UpdateVersion *RabbitMQUpdateVersionSpec `json:"updateVersion,omitempty"`
// Specifies information necessary for horizontal scaling
HorizontalScaling *RabbitMQHorizontalScalingSpec `json:"horizontalScaling,omitempty"`
// Specifies information necessary for vertical scaling
VerticalScaling *RabbitMQVerticalScalingSpec `json:"verticalScaling,omitempty"`
// Specifies information necessary for volume expansion
VolumeExpansion *RabbitMQVolumeExpansionSpec `json:"volumeExpansion,omitempty"`
// Specifies information necessary for custom configuration of rabbitmq
Configuration *RabbitMQCustomConfigurationSpec `json:"configuration,omitempty"`
// Specifies information necessary for configuring TLS
TLS *TLSSpec `json:"tls,omitempty"`
// Specifies information necessary for restarting database
Restart *RestartSpec `json:"restart,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.
Expand All @@ -68,14 +76,26 @@ type RabbitMQOpsRequestSpec struct {
Apply ApplyOption `json:"apply,omitempty"`
}

// +kubebuilder:validation:Enum=VerticalScaling;VolumeExpansion;Restart
// ENUM(VerticalScaling, VolumeExpansion, Restart)
// +kubebuilder:validation:Enum=UpdateVersion;HorizontalScaling;VerticalScaling;VolumeExpansion;Restart;Reconfigure;ReconfigureTLS
// ENUM(UpdateVersion, HorizontalScaling, VerticalScaling, VolumeExpansion, Restart, Reconfigure, ReconfigureTLS)
type RabbitMQOpsRequestType string

// RabbitMQUpdateVersionSpec contains the update version information of a rabbitmq cluster
type RabbitMQUpdateVersionSpec struct {
// Specifies the target version name from catalog
TargetVersion string `json:"targetVersion,omitempty"`
}

// RabbitMQReplicaReadinessCriteria is the criteria for checking readiness of a RabbitMQ pod
// after updating, horizontal scaling etc.
type RabbitMQReplicaReadinessCriteria struct{}

// RabbitMQHorizontalScalingSpec contains the horizontal scaling information of a RabbitMQ cluster
type RabbitMQHorizontalScalingSpec struct {
// Number of node
Node *int32 `json:"node,omitempty"`
}

// RabbitMQVerticalScalingSpec contains the vertical scaling information of a RabbitMQ cluster
type RabbitMQVerticalScalingSpec struct {
// Resource spec for nodes
Expand All @@ -89,6 +109,27 @@ type RabbitMQVolumeExpansionSpec struct {
Node *resource.Quantity `json:"node,omitempty"`
}

// RabbitMQCustomConfigurationSpec is the spec for Reconfiguring the rabbitmq Settings
type RabbitMQCustomConfigurationSpec struct {
// ConfigSecret is an optional field to provide custom configuration file for database.
// +optional
ConfigSecret *core.LocalObjectReference `json:"configSecret,omitempty"`
// ApplyConfig is an optional field to provide rabbitmq configuration.
// Provided configuration will be applied to config files stored in ConfigSecret.
// If the ConfigSecret is missing, the operator will create a new k8s secret by the
// following naming convention: {db-name}-user-config .
// Expected input format:
// applyConfig:
// rabbitmq.conf: |
// key=value
// +optional
ApplyConfig map[string]string `json:"applyConfig,omitempty"`
// If set to "true", the user provided configuration will be removed.
// The rabbitmq cluster will start will default configuration that is generated by the operator.
// +optional
RemoveCustomConfig bool `json:"removeCustomConfig,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// RabbitMQOpsRequestList is a list of RabbitMQOpsRequests
Expand Down
26 changes: 23 additions & 3 deletions apis/ops/v1alpha1/rabbitmq_ops_types_enum.go

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

Loading
Loading