From 321ab43b8de8938eccb5a24ca7e812709e095301 Mon Sep 17 00:00:00 2001 From: raihankhan Date: Tue, 14 May 2024 15:07:23 +0600 Subject: [PATCH 1/3] Add RabbitMQ OpsRequests Signed-off-by: raihankhan --- apis/ops/v1alpha1/openapi_generated.go | 29 +++++++++++++++++++- apis/ops/v1alpha1/rabbitmq_ops_types.go | 12 ++++++-- apis/ops/v1alpha1/rabbitmq_ops_types_enum.go | 26 ++++++++++++++++-- apis/ops/v1alpha1/zz_generated.deepcopy.go | 26 ++++++++++++++++++ crds/ops.kubedb.com_rabbitmqopsrequests.yaml | 10 +++++++ 5 files changed, 97 insertions(+), 6 deletions(-) diff --git a/apis/ops/v1alpha1/openapi_generated.go b/apis/ops/v1alpha1/openapi_generated.go index 2ac1640bdb..6396e6d360 100644 --- a/apis/ops/v1alpha1/openapi_generated.go +++ b/apis/ops/v1alpha1/openapi_generated.go @@ -576,6 +576,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/ops/v1alpha1.ProxySQLReplicaReadinessCriteria": schema_apimachinery_apis_ops_v1alpha1_ProxySQLReplicaReadinessCriteria(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.ProxySQLUpdateVersionSpec": schema_apimachinery_apis_ops_v1alpha1_ProxySQLUpdateVersionSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.ProxySQLVerticalScalingSpec": schema_apimachinery_apis_ops_v1alpha1_ProxySQLVerticalScalingSpec(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQHorizontalScalingSpec": schema_apimachinery_apis_ops_v1alpha1_RabbitMQHorizontalScalingSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQOpsRequest": schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequest(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQOpsRequestList": schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequestList(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQOpsRequestSpec": schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequestSpec(ref), @@ -27494,6 +27495,26 @@ func schema_apimachinery_apis_ops_v1alpha1_ProxySQLVerticalScalingSpec(ref commo } } +func schema_apimachinery_apis_ops_v1alpha1_RabbitMQHorizontalScalingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RabbitMQHorizontalScalingSpec contains the horizontal scaling information of a RabbitMQ cluster", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Number of node", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + } +} + func schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequest(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -27611,6 +27632,12 @@ func schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequestSpec(ref common.Ref Format: "", }, }, + "horizontalScaling": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for horizontal scaling", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQHorizontalScalingSpec"), + }, + }, "verticalScaling": { SchemaProps: spec.SchemaProps{ Description: "Specifies information necessary for vertical scaling", @@ -27647,7 +27674,7 @@ func schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequestSpec(ref common.Ref }, }, Dependencies: []string{ - "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQVerticalScalingSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQVolumeExpansionSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RestartSpec"}, + "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQHorizontalScalingSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQVerticalScalingSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQVolumeExpansionSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RestartSpec"}, } } diff --git a/apis/ops/v1alpha1/rabbitmq_ops_types.go b/apis/ops/v1alpha1/rabbitmq_ops_types.go index 663b189d05..ea47e365cd 100644 --- a/apis/ops/v1alpha1/rabbitmq_ops_types.go +++ b/apis/ops/v1alpha1/rabbitmq_ops_types.go @@ -55,6 +55,8 @@ 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 horizontal scaling + HorizontalScaling *RabbitMQHorizontalScalingSpec `json:"horizontalScaling,omitempty"` // Specifies information necessary for vertical scaling VerticalScaling *RabbitMQVerticalScalingSpec `json:"verticalScaling,omitempty"` // Specifies information necessary for volume expansion @@ -68,14 +70,20 @@ 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 // 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 diff --git a/apis/ops/v1alpha1/rabbitmq_ops_types_enum.go b/apis/ops/v1alpha1/rabbitmq_ops_types_enum.go index 9ef149b68b..ee2c324701 100644 --- a/apis/ops/v1alpha1/rabbitmq_ops_types_enum.go +++ b/apis/ops/v1alpha1/rabbitmq_ops_types_enum.go @@ -12,20 +12,32 @@ import ( ) const ( + // RabbitMQOpsRequestTypeUpdateVersion is a RabbitMQOpsRequestType of type UpdateVersion. + RabbitMQOpsRequestTypeUpdateVersion RabbitMQOpsRequestType = "UpdateVersion" + // RabbitMQOpsRequestTypeHorizontalScaling is a RabbitMQOpsRequestType of type HorizontalScaling. + RabbitMQOpsRequestTypeHorizontalScaling RabbitMQOpsRequestType = "HorizontalScaling" // RabbitMQOpsRequestTypeVerticalScaling is a RabbitMQOpsRequestType of type VerticalScaling. RabbitMQOpsRequestTypeVerticalScaling RabbitMQOpsRequestType = "VerticalScaling" // RabbitMQOpsRequestTypeVolumeExpansion is a RabbitMQOpsRequestType of type VolumeExpansion. RabbitMQOpsRequestTypeVolumeExpansion RabbitMQOpsRequestType = "VolumeExpansion" // RabbitMQOpsRequestTypeRestart is a RabbitMQOpsRequestType of type Restart. RabbitMQOpsRequestTypeRestart RabbitMQOpsRequestType = "Restart" + // RabbitMQOpsRequestTypeReconfigure is a RabbitMQOpsRequestType of type Reconfigure. + RabbitMQOpsRequestTypeReconfigure RabbitMQOpsRequestType = "Reconfigure" + // RabbitMQOpsRequestTypeReconfigureTLS is a RabbitMQOpsRequestType of type ReconfigureTLS. + RabbitMQOpsRequestTypeReconfigureTLS RabbitMQOpsRequestType = "ReconfigureTLS" ) var ErrInvalidRabbitMQOpsRequestType = fmt.Errorf("not a valid RabbitMQOpsRequestType, try [%s]", strings.Join(_RabbitMQOpsRequestTypeNames, ", ")) var _RabbitMQOpsRequestTypeNames = []string{ + string(RabbitMQOpsRequestTypeUpdateVersion), + string(RabbitMQOpsRequestTypeHorizontalScaling), string(RabbitMQOpsRequestTypeVerticalScaling), string(RabbitMQOpsRequestTypeVolumeExpansion), string(RabbitMQOpsRequestTypeRestart), + string(RabbitMQOpsRequestTypeReconfigure), + string(RabbitMQOpsRequestTypeReconfigureTLS), } // RabbitMQOpsRequestTypeNames returns a list of possible string values of RabbitMQOpsRequestType. @@ -38,9 +50,13 @@ func RabbitMQOpsRequestTypeNames() []string { // RabbitMQOpsRequestTypeValues returns a list of the values for RabbitMQOpsRequestType func RabbitMQOpsRequestTypeValues() []RabbitMQOpsRequestType { return []RabbitMQOpsRequestType{ + RabbitMQOpsRequestTypeUpdateVersion, + RabbitMQOpsRequestTypeHorizontalScaling, RabbitMQOpsRequestTypeVerticalScaling, RabbitMQOpsRequestTypeVolumeExpansion, RabbitMQOpsRequestTypeRestart, + RabbitMQOpsRequestTypeReconfigure, + RabbitMQOpsRequestTypeReconfigureTLS, } } @@ -57,9 +73,13 @@ func (x RabbitMQOpsRequestType) IsValid() bool { } var _RabbitMQOpsRequestTypeValue = map[string]RabbitMQOpsRequestType{ - "VerticalScaling": RabbitMQOpsRequestTypeVerticalScaling, - "VolumeExpansion": RabbitMQOpsRequestTypeVolumeExpansion, - "Restart": RabbitMQOpsRequestTypeRestart, + "UpdateVersion": RabbitMQOpsRequestTypeUpdateVersion, + "HorizontalScaling": RabbitMQOpsRequestTypeHorizontalScaling, + "VerticalScaling": RabbitMQOpsRequestTypeVerticalScaling, + "VolumeExpansion": RabbitMQOpsRequestTypeVolumeExpansion, + "Restart": RabbitMQOpsRequestTypeRestart, + "Reconfigure": RabbitMQOpsRequestTypeReconfigure, + "ReconfigureTLS": RabbitMQOpsRequestTypeReconfigureTLS, } // ParseRabbitMQOpsRequestType attempts to convert a string to a RabbitMQOpsRequestType. diff --git a/apis/ops/v1alpha1/zz_generated.deepcopy.go b/apis/ops/v1alpha1/zz_generated.deepcopy.go index 364e61ec2d..20e4b58bd8 100644 --- a/apis/ops/v1alpha1/zz_generated.deepcopy.go +++ b/apis/ops/v1alpha1/zz_generated.deepcopy.go @@ -3522,6 +3522,27 @@ func (in *ProxySQLVerticalScalingSpec) DeepCopy() *ProxySQLVerticalScalingSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RabbitMQHorizontalScalingSpec) DeepCopyInto(out *RabbitMQHorizontalScalingSpec) { + *out = *in + if in.Node != nil { + in, out := &in.Node, &out.Node + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RabbitMQHorizontalScalingSpec. +func (in *RabbitMQHorizontalScalingSpec) DeepCopy() *RabbitMQHorizontalScalingSpec { + if in == nil { + return nil + } + out := new(RabbitMQHorizontalScalingSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RabbitMQOpsRequest) DeepCopyInto(out *RabbitMQOpsRequest) { *out = *in @@ -3587,6 +3608,11 @@ func (in *RabbitMQOpsRequestList) DeepCopyObject() runtime.Object { func (in *RabbitMQOpsRequestSpec) DeepCopyInto(out *RabbitMQOpsRequestSpec) { *out = *in out.DatabaseRef = in.DatabaseRef + if in.HorizontalScaling != nil { + in, out := &in.HorizontalScaling, &out.HorizontalScaling + *out = new(RabbitMQHorizontalScalingSpec) + (*in).DeepCopyInto(*out) + } if in.VerticalScaling != nil { in, out := &in.VerticalScaling, &out.VerticalScaling *out = new(RabbitMQVerticalScalingSpec) diff --git a/crds/ops.kubedb.com_rabbitmqopsrequests.yaml b/crds/ops.kubedb.com_rabbitmqopsrequests.yaml index ec23242097..d0cd914593 100644 --- a/crds/ops.kubedb.com_rabbitmqopsrequests.yaml +++ b/crds/ops.kubedb.com_rabbitmqopsrequests.yaml @@ -54,15 +54,25 @@ spec: type: string type: object x-kubernetes-map-type: atomic + horizontalScaling: + properties: + node: + format: int32 + type: integer + type: object restart: type: object timeout: type: string type: enum: + - UpdateVersion + - HorizontalScaling - VerticalScaling - VolumeExpansion - Restart + - Reconfigure + - ReconfigureTLS type: string verticalScaling: properties: From e6a19d77811c016072cddfd8a0daa381c959c84b Mon Sep 17 00:00:00 2001 From: raihankhan Date: Wed, 29 May 2024 20:54:07 +0600 Subject: [PATCH 2/3] Add update version, reconfiguration ops Signed-off-by: raihankhan --- apis/ops/v1alpha1/openapi_generated.go | 86 ++++++++++++- apis/ops/v1alpha1/rabbitmq_ops_types.go | 35 ++++++ apis/ops/v1alpha1/zz_generated.deepcopy.go | 59 +++++++++ crds/ops.kubedb.com_rabbitmqopsrequests.yaml | 125 +++++++++++++++++++ 4 files changed, 304 insertions(+), 1 deletion(-) diff --git a/apis/ops/v1alpha1/openapi_generated.go b/apis/ops/v1alpha1/openapi_generated.go index 6396e6d360..ff0b9b4d86 100644 --- a/apis/ops/v1alpha1/openapi_generated.go +++ b/apis/ops/v1alpha1/openapi_generated.go @@ -576,11 +576,13 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/ops/v1alpha1.ProxySQLReplicaReadinessCriteria": schema_apimachinery_apis_ops_v1alpha1_ProxySQLReplicaReadinessCriteria(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.ProxySQLUpdateVersionSpec": schema_apimachinery_apis_ops_v1alpha1_ProxySQLUpdateVersionSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.ProxySQLVerticalScalingSpec": schema_apimachinery_apis_ops_v1alpha1_ProxySQLVerticalScalingSpec(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQCustomConfigurationSpec": schema_apimachinery_apis_ops_v1alpha1_RabbitMQCustomConfigurationSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQHorizontalScalingSpec": schema_apimachinery_apis_ops_v1alpha1_RabbitMQHorizontalScalingSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQOpsRequest": schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequest(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQOpsRequestList": schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequestList(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQOpsRequestSpec": schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequestSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQReplicaReadinessCriteria": schema_apimachinery_apis_ops_v1alpha1_RabbitMQReplicaReadinessCriteria(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQUpdateVersionSpec": schema_apimachinery_apis_ops_v1alpha1_RabbitMQUpdateVersionSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQVerticalScalingSpec": schema_apimachinery_apis_ops_v1alpha1_RabbitMQVerticalScalingSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQVolumeExpansionSpec": schema_apimachinery_apis_ops_v1alpha1_RabbitMQVolumeExpansionSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.RedisCustomConfigurationSpec": schema_apimachinery_apis_ops_v1alpha1_RedisCustomConfigurationSpec(ref), @@ -27495,6 +27497,50 @@ func schema_apimachinery_apis_ops_v1alpha1_ProxySQLVerticalScalingSpec(ref commo } } +func schema_apimachinery_apis_ops_v1alpha1_RabbitMQCustomConfigurationSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RabbitMQCustomConfigurationSpec is the spec for Reconfiguring the rabbitmq Settings", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "configSecret": { + SchemaProps: spec.SchemaProps{ + Description: "ConfigSecret is an optional field to provide custom configuration file for database.", + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + "applyConfig": { + SchemaProps: spec.SchemaProps{ + Description: "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:\n\tapplyConfig:\n\t\tfile-name.properties: |\n\t\t\tkey=value\n\t\tserver.properties: |\n\t\t\tlog.retention.ms=10000", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "removeCustomConfig": { + SchemaProps: spec.SchemaProps{ + Description: "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.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference"}, + } +} + func schema_apimachinery_apis_ops_v1alpha1_RabbitMQHorizontalScalingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -27632,6 +27678,12 @@ func schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequestSpec(ref common.Ref Format: "", }, }, + "updateVersion": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for upgrading rabbitmq", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQUpdateVersionSpec"), + }, + }, "horizontalScaling": { SchemaProps: spec.SchemaProps{ Description: "Specifies information necessary for horizontal scaling", @@ -27650,6 +27702,18 @@ func schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequestSpec(ref common.Ref Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQVolumeExpansionSpec"), }, }, + "configuration": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for custom configuration of rabbitmq", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQCustomConfigurationSpec"), + }, + }, + "tls": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for configuring TLS", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.TLSSpec"), + }, + }, "restart": { SchemaProps: spec.SchemaProps{ Description: "Specifies information necessary for restarting database", @@ -27674,7 +27738,7 @@ func schema_apimachinery_apis_ops_v1alpha1_RabbitMQOpsRequestSpec(ref common.Ref }, }, Dependencies: []string{ - "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQHorizontalScalingSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQVerticalScalingSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQVolumeExpansionSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RestartSpec"}, + "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQCustomConfigurationSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQHorizontalScalingSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQUpdateVersionSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQVerticalScalingSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RabbitMQVolumeExpansionSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RestartSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.TLSSpec"}, } } @@ -27689,6 +27753,26 @@ func schema_apimachinery_apis_ops_v1alpha1_RabbitMQReplicaReadinessCriteria(ref } } +func schema_apimachinery_apis_ops_v1alpha1_RabbitMQUpdateVersionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RabbitMQUpdateVersionSpec contains the update version information of a rabbitmq cluster", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "targetVersion": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the target version name from catalog", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_apimachinery_apis_ops_v1alpha1_RabbitMQVerticalScalingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/ops/v1alpha1/rabbitmq_ops_types.go b/apis/ops/v1alpha1/rabbitmq_ops_types.go index ea47e365cd..24d9657098 100644 --- a/apis/ops/v1alpha1/rabbitmq_ops_types.go +++ b/apis/ops/v1alpha1/rabbitmq_ops_types.go @@ -55,12 +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. @@ -74,6 +80,12 @@ type RabbitMQOpsRequestSpec struct { // 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{} @@ -97,6 +109,29 @@ 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: + // file-name.properties: | + // key=value + // server.properties: | + // log.retention.ms=10000 + // +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 diff --git a/apis/ops/v1alpha1/zz_generated.deepcopy.go b/apis/ops/v1alpha1/zz_generated.deepcopy.go index 20e4b58bd8..6e2027b661 100644 --- a/apis/ops/v1alpha1/zz_generated.deepcopy.go +++ b/apis/ops/v1alpha1/zz_generated.deepcopy.go @@ -3522,6 +3522,34 @@ func (in *ProxySQLVerticalScalingSpec) DeepCopy() *ProxySQLVerticalScalingSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RabbitMQCustomConfigurationSpec) DeepCopyInto(out *RabbitMQCustomConfigurationSpec) { + *out = *in + if in.ConfigSecret != nil { + in, out := &in.ConfigSecret, &out.ConfigSecret + *out = new(v1.LocalObjectReference) + **out = **in + } + if in.ApplyConfig != nil { + in, out := &in.ApplyConfig, &out.ApplyConfig + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RabbitMQCustomConfigurationSpec. +func (in *RabbitMQCustomConfigurationSpec) DeepCopy() *RabbitMQCustomConfigurationSpec { + if in == nil { + return nil + } + out := new(RabbitMQCustomConfigurationSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RabbitMQHorizontalScalingSpec) DeepCopyInto(out *RabbitMQHorizontalScalingSpec) { *out = *in @@ -3608,6 +3636,11 @@ func (in *RabbitMQOpsRequestList) DeepCopyObject() runtime.Object { func (in *RabbitMQOpsRequestSpec) DeepCopyInto(out *RabbitMQOpsRequestSpec) { *out = *in out.DatabaseRef = in.DatabaseRef + if in.UpdateVersion != nil { + in, out := &in.UpdateVersion, &out.UpdateVersion + *out = new(RabbitMQUpdateVersionSpec) + **out = **in + } if in.HorizontalScaling != nil { in, out := &in.HorizontalScaling, &out.HorizontalScaling *out = new(RabbitMQHorizontalScalingSpec) @@ -3623,6 +3656,16 @@ func (in *RabbitMQOpsRequestSpec) DeepCopyInto(out *RabbitMQOpsRequestSpec) { *out = new(RabbitMQVolumeExpansionSpec) (*in).DeepCopyInto(*out) } + if in.Configuration != nil { + in, out := &in.Configuration, &out.Configuration + *out = new(RabbitMQCustomConfigurationSpec) + (*in).DeepCopyInto(*out) + } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(TLSSpec) + (*in).DeepCopyInto(*out) + } if in.Restart != nil { in, out := &in.Restart, &out.Restart *out = new(RestartSpec) @@ -3662,6 +3705,22 @@ func (in *RabbitMQReplicaReadinessCriteria) DeepCopy() *RabbitMQReplicaReadiness return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RabbitMQUpdateVersionSpec) DeepCopyInto(out *RabbitMQUpdateVersionSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RabbitMQUpdateVersionSpec. +func (in *RabbitMQUpdateVersionSpec) DeepCopy() *RabbitMQUpdateVersionSpec { + if in == nil { + return nil + } + out := new(RabbitMQUpdateVersionSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RabbitMQVerticalScalingSpec) DeepCopyInto(out *RabbitMQVerticalScalingSpec) { *out = *in diff --git a/crds/ops.kubedb.com_rabbitmqopsrequests.yaml b/crds/ops.kubedb.com_rabbitmqopsrequests.yaml index d0cd914593..6cc780d328 100644 --- a/crds/ops.kubedb.com_rabbitmqopsrequests.yaml +++ b/crds/ops.kubedb.com_rabbitmqopsrequests.yaml @@ -48,6 +48,21 @@ spec: - IfReady - Always type: string + configuration: + properties: + applyConfig: + additionalProperties: + type: string + type: object + configSecret: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + removeCustomConfig: + type: boolean + type: object databaseRef: properties: name: @@ -64,6 +79,111 @@ spec: type: object timeout: type: string + tls: + properties: + certificates: + items: + properties: + alias: + type: string + dnsNames: + items: + type: string + type: array + duration: + type: string + emailAddresses: + items: + type: string + type: array + ipAddresses: + items: + type: string + type: array + issuerRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + privateKey: + properties: + encoding: + enum: + - PKCS1 + - PKCS8 + type: string + type: object + renewBefore: + type: string + secretName: + type: string + subject: + properties: + countries: + items: + type: string + type: array + localities: + items: + type: string + type: array + organizationalUnits: + items: + type: string + type: array + organizations: + items: + type: string + type: array + postalCodes: + items: + type: string + type: array + provinces: + items: + type: string + type: array + serialNumber: + type: string + streetAddresses: + items: + type: string + type: array + type: object + uris: + items: + type: string + type: array + required: + - alias + type: object + type: array + issuerRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + remove: + type: boolean + rotateCertificates: + type: boolean + type: object type: enum: - UpdateVersion @@ -74,6 +194,11 @@ spec: - Reconfigure - ReconfigureTLS type: string + updateVersion: + properties: + targetVersion: + type: string + type: object verticalScaling: properties: node: From 6160005defe2c946b9a66e2838330f71c99940f7 Mon Sep 17 00:00:00 2001 From: raihankhan Date: Fri, 31 May 2024 10:42:44 +0600 Subject: [PATCH 3/3] Remove comments Signed-off-by: raihankhan --- apis/ops/fuzzer/fuzzer.go | 3 +++ apis/ops/v1alpha1/openapi_generated.go | 2 +- apis/ops/v1alpha1/rabbitmq_ops_types.go | 4 +--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apis/ops/fuzzer/fuzzer.go b/apis/ops/fuzzer/fuzzer.go index dac1e2f31a..99db3710da 100644 --- a/apis/ops/fuzzer/fuzzer.go +++ b/apis/ops/fuzzer/fuzzer.go @@ -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 + }, } } diff --git a/apis/ops/v1alpha1/openapi_generated.go b/apis/ops/v1alpha1/openapi_generated.go index ff0b9b4d86..fe6b3f9d5a 100644 --- a/apis/ops/v1alpha1/openapi_generated.go +++ b/apis/ops/v1alpha1/openapi_generated.go @@ -27512,7 +27512,7 @@ func schema_apimachinery_apis_ops_v1alpha1_RabbitMQCustomConfigurationSpec(ref c }, "applyConfig": { SchemaProps: spec.SchemaProps{ - Description: "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:\n\tapplyConfig:\n\t\tfile-name.properties: |\n\t\t\tkey=value\n\t\tserver.properties: |\n\t\t\tlog.retention.ms=10000", + Description: "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:\n\tapplyConfig:\n\t\trabbitmq.conf: |\n\t\t\tkey=value", Type: []string{"object"}, AdditionalProperties: &spec.SchemaOrBool{ Allows: true, diff --git a/apis/ops/v1alpha1/rabbitmq_ops_types.go b/apis/ops/v1alpha1/rabbitmq_ops_types.go index 24d9657098..053b9ec255 100644 --- a/apis/ops/v1alpha1/rabbitmq_ops_types.go +++ b/apis/ops/v1alpha1/rabbitmq_ops_types.go @@ -120,10 +120,8 @@ type RabbitMQCustomConfigurationSpec struct { // following naming convention: {db-name}-user-config . // Expected input format: // applyConfig: - // file-name.properties: | + // rabbitmq.conf: | // key=value - // server.properties: | - // log.retention.ms=10000 // +optional ApplyConfig map[string]string `json:"applyConfig,omitempty"` // If set to "true", the user provided configuration will be removed.