Skip to content

Commit

Permalink
add remote to group replication ops request (#1359)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashraful Haque Tani <[email protected]>
  • Loading branch information
AshrafulHaqueToni authored Dec 12, 2024
1 parent fb7e8dd commit 90dd367
Show file tree
Hide file tree
Showing 7 changed files with 273 additions and 12 deletions.
6 changes: 5 additions & 1 deletion apis/ops/v1alpha1/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,11 @@ const (

// MySQL/MariaDB Constants
const (
TempIniFilesPath = "/tmp/kubedb-custom-ini-files"
TempIniFilesPath = "/tmp/kubedb-custom-ini-files"
StopRemoteReplica = "StopRemoteReplica"
DBPatch = "DBPatch"
StopRemoteReplicaSucceeded = "StopRemoteReplicaSucceeded"
DBPatchSucceeded = "DBPatchSucceeded"
)

// Postgres Constants
Expand Down
23 changes: 21 additions & 2 deletions apis/ops/v1alpha1/mysql_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ limitations under the License.
package v1alpha1

import (
dbapi "kubedb.dev/apimachinery/apis/kubedb/v1"

core "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kmapi "kmodules.xyz/client-go/api/v1"
)

const (
Expand Down Expand Up @@ -69,6 +72,8 @@ type MySQLOpsRequestSpec struct {
TLS *MySQLTLSSpec `json:"tls,omitempty"`
// Specifies information necessary for configuring authSecret of the database
Authentication *AuthSpec `json:"authentication,omitempty"`
// Specifies information transform Remote Replica to GroupReplication
ReplicationModeTransformation *MySQLReplicationModeTransformSpec `json:"replicationModeTransformation,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 @@ -78,8 +83,8 @@ type MySQLOpsRequestSpec struct {
Apply ApplyOption `json:"apply,omitempty"`
}

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

// MySQLReplicaReadinessCriteria is the criteria for checking readiness of a MySQL pod
Expand All @@ -97,6 +102,20 @@ type MySQLHorizontalScalingSpec struct {
Member *int32 `json:"member,omitempty"`
}

type MySQLReplicationModeTransformSpec struct {
// Group Replication can be deployed in either "Single-Primary" or "Multi-Primary" mode
// +kubebuilder:default=Single-Primary
Mode *dbapi.MySQLGroupMode `json:"mode"`

// TLSConfig contains updated tls configurations for client and server.
// +optional
kmapi.TLSConfig `json:",inline,omitempty"`

// Indicates that the database server need to be encrypted connections(ssl)
// +optional
RequireSSL *bool `json:"requireSSL,omitempty"`
}

type MySQLVerticalScalingSpec struct {
MySQL *PodResources `json:"mysql,omitempty"`
Exporter *ContainerResources `json:"exporter,omitempty"`
Expand Down
21 changes: 13 additions & 8 deletions apis/ops/v1alpha1/mysql_ops_types_enum.go

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

58 changes: 57 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.

33 changes: 33 additions & 0 deletions apis/ops/v1alpha1/zz_generated.deepcopy.go

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

112 changes: 112 additions & 0 deletions crds/ops.kubedb.com_mysqlopsrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,117 @@ spec:
format: int32
type: integer
type: object
replicationModeTransformation:
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
mode:
default: Single-Primary
enum:
- Single-Primary
- Multi-Primary
type: string
requireSSL:
type: boolean
required:
- mode
type: object
restart:
type: object
timeout:
Expand Down Expand Up @@ -209,6 +320,7 @@ spec:
- Reconfigure
- ReconfigureTLS
- RotateAuth
- ReplicationModeTransformation
type: string
updateVersion:
properties:
Expand Down
Loading

0 comments on commit 90dd367

Please sign in to comment.