Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
8c2aa9d
fix binlog server deployment
egegunes Mar 19, 2026
1496ff3
remove embedded fields
egegunes Mar 19, 2026
925659c
add exec search functions
egegunes Mar 19, 2026
634a30d
add pitr pkg
egegunes Mar 19, 2026
6e76ed0
run pitr job
egegunes Mar 19, 2026
b0795ec
pass binlog list to pitr job
egegunes Mar 19, 2026
aeb61df
add pitr entrypoint
egegunes Mar 19, 2026
2930942
clean up binlog server if cluster is paused
egegunes Mar 19, 2026
35558b4
implement pitr cli
egegunes Mar 19, 2026
de34a01
fix s3 uri
egegunes Mar 19, 2026
8b38964
fix pitr job
egegunes Mar 19, 2026
0712c3a
fix apply phase
egegunes Mar 19, 2026
eb3219c
allow protocol in endpoint url
egegunes Mar 20, 2026
2e9433d
don't run reset
egegunes Mar 20, 2026
cd39d9e
fix admin connections
egegunes Mar 20, 2026
031f250
update manifests
egegunes Mar 22, 2026
b7d0b94
add binlog server to cr
egegunes Mar 22, 2026
0a6773c
add e2e test and fix status starting state
gkech Mar 23, 2026
7cc8a91
fix test issues
egegunes Mar 23, 2026
e5d30c0
fix one more issue
egegunes Mar 23, 2026
7bd1bcf
fix type=date
egegunes Mar 24, 2026
30aa87c
strip the leading bucket_name to get the object key
gkech Mar 24, 2026
f97ad4e
fix e2e test
gkech Mar 24, 2026
29df4dc
add back PITR_GTID
gkech Mar 24, 2026
78338f7
update e2e tests list and ordering
gkech Mar 24, 2026
a001e39
fixes and unit test fixes
gkech Mar 24, 2026
43ceaf7
fix linter
gkech Mar 24, 2026
b15ce3c
add IMAGE_BINLOG_SERVER
egegunes Mar 25, 2026
abbb0ef
Merge branch 'main' into K8SPS-642
egegunes Mar 25, 2026
4c2315e
update e2e test to assert date pitr
gkech Mar 26, 2026
9658e72
add connection of pbs to primary service + unit test
gkech Mar 26, 2026
692053c
add sans cert for primary service
gkech Mar 26, 2026
9e01898
default s3:// when endpoint url is not configured
gkech Mar 26, 2026
d806f3d
remove not used input from JobName
gkech Mar 26, 2026
fea7a94
encode aws creds and set ps status to init when binlog is not ready
gkech Mar 27, 2026
17f6aff
make generate manifests main
gkech Mar 27, 2026
a2a2c8a
commit /api
gkech Mar 27, 2026
f4349db
add /config changes
gkech Mar 27, 2026
b17dd59
objectKeyFromURI handle for s3 case
gkech Mar 27, 2026
0544e22
e2e test for failover and switchover
gkech Mar 27, 2026
351dbba
e2e test fixes
gkech Mar 27, 2026
d075fe6
add cr options comments for pirt
gkech Mar 27, 2026
a4c1e46
fix assert for date
gkech Mar 31, 2026
7761dba
use start and stop datetime for date pitr restore
gkech Mar 31, 2026
32b7646
set error when binlogs cannot be collected and gtid next to automatic…
gkech Mar 31, 2026
54bd542
fixes on datetime gitd
gkech Mar 31, 2026
0e313a2
Merge branch 'main' into K8SPS-642
hors Apr 1, 2026
37f2332
fixes on fields and crd
gkech Apr 1, 2026
e97a5c1
handle validation rules for size and image, fix for binlog but affect…
gkech Apr 1, 2026
3b86683
add unit tests for pitr restore job and related functions
gkech Apr 2, 2026
4d844a1
unit test sts of bls
gkech Apr 2, 2026
9a03722
unit test for gtid and date search
gkech Apr 2, 2026
9d7ae2e
Apply suggestions from code review
gkech Apr 2, 2026
68d3859
rename pitr-minio to gr-pitr-minio
gkech Apr 2, 2026
ccebfc4
add configurable options for binlog server + unit test and default va…
gkech Apr 2, 2026
11f6e16
fix linter
gkech Apr 2, 2026
3b1d879
Merge branch 'main' into K8SPS-642
gkech Apr 2, 2026
204fc59
small background fix
gkech Apr 2, 2026
ed25bc0
Merge branch 'main' into K8SPS-642
hors Apr 2, 2026
2b3d10d
Apply suggestions from code review
gkech Apr 2, 2026
6a3973b
print GTID_EXECUTED before and after recovery
egegunes Apr 3, 2026
e04e0af
Merge branch 'main' into K8SPS-642
gkech Apr 3, 2026
3e2bff9
small refactor on main to be testable
gkech Apr 3, 2026
d9b7806
Update cmd/pitr/main_test.go
gkech Apr 3, 2026
7584be2
Update cmd/pitr/main_test.go
gkech Apr 3, 2026
8b3ace8
add guard for bool pointer
gkech Apr 3, 2026
42ca350
fix linting tests
gkech Apr 3, 2026
ffc3da6
handle disabled ssl mode
gkech Apr 6, 2026
e95c033
handle defaults
gkech Apr 6, 2026
24387dd
run manifests
gkech Apr 7, 2026
18d1a7b
fixes on validations
gkech Apr 7, 2026
a7c2052
run manifests
gkech Apr 7, 2026
88562d7
fix unit test for required server id
gkech Apr 7, 2026
7bab67a
Merge branch 'main' into K8SPS-642
gkech Apr 7, 2026
9b7561c
fix unit test for defaults
gkech Apr 8, 2026
cc4625e
sleep-forever
egegunes Apr 9, 2026
eb74763
use SQL_AFTER_GTIDS
egegunes Apr 9, 2026
f780ffd
implement pipe based recovery
egegunes Apr 10, 2026
df264a3
fix e2e test
egegunes Apr 10, 2026
9c06f7a
fix timeout
egegunes Apr 12, 2026
eb9951f
fix tls-cert-manager
egegunes Apr 13, 2026
4fd8584
address copilot comments
egegunes Apr 13, 2026
b642ed1
fix upgrade tests
egegunes Apr 13, 2026
ecb632a
use new image for PBS
egegunes Apr 13, 2026
b7997fc
fix
egegunes Apr 13, 2026
2a10e7b
check for pitr enabled before restore
egegunes Apr 14, 2026
c59fb23
remove unused code
egegunes Apr 14, 2026
11d251d
fix default value
egegunes Apr 14, 2026
bcf6607
use MYSQL_PWD env var
egegunes Apr 14, 2026
32d7307
improve parseEndpointUrl
egegunes Apr 14, 2026
0fddd84
apply binlogs on the fly
egegunes Apr 14, 2026
aaf2e86
log Close and Wait errors
egegunes Apr 14, 2026
4d42333
add async test
egegunes Apr 14, 2026
86ee68b
use mysql log format for pitr
egegunes Apr 15, 2026
180f8da
use --force to apply binlogs
egegunes Apr 15, 2026
6bccf91
Merge branch 'main' into K8SPS-642
egegunes Apr 15, 2026
1631578
fix async test
egegunes Apr 15, 2026
4d8b484
Merge branch 'main' into K8SPS-642
egegunes Apr 15, 2026
8b1acff
fix pausing cluster with one pod
egegunes Apr 15, 2026
62adfcd
remove unused code
egegunes Apr 15, 2026
3c79b9a
fix gr-tls-cert-manager
egegunes Apr 15, 2026
6f4795a
remove more unused code
egegunes Apr 15, 2026
c77b10f
fix linter
egegunes Apr 15, 2026
d86fe9f
fix pitr tests
egegunes Apr 15, 2026
5734227
assert sleep-forever
egegunes Apr 15, 2026
6f6ee9f
add defaults to CRD
egegunes Apr 15, 2026
001e66b
make force optional
egegunes Apr 15, 2026
6d717fe
add more validations
egegunes Apr 15, 2026
ab77448
Merge branch 'main' into K8SPS-642
hors Apr 15, 2026
14fd413
revert validation
egegunes Apr 16, 2026
d09f043
use force after failover
egegunes Apr 16, 2026
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
88 changes: 78 additions & 10 deletions api/v1/perconaservermysql_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ func (t ClusterType) isValid() bool {
return false
}

// +kubebuilder:validation:XValidation:rule="has(self.image) && self.image != ''",message="mysql.image is required"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[gofmt] reported by reviewdog 🐶

Suggested change
// +kubebuilder:validation:XValidation:rule="has(self.image) && self.image != ''",message="mysql.image is required"
// +kubebuilder:validation:XValidation:rule="has(self.image) && self.image != ",message="mysql.image is required"

// +kubebuilder:validation:XValidation:rule="has(self.size) && self.size > 0",message="mysql.size must be greater than 0"
type MySQLSpec struct {
// +kubebuilder:validation:Enum=group-replication;async
// +kubebuilder:default=group-replication
Expand Down Expand Up @@ -176,6 +178,8 @@ type SidecarPVC struct {
Spec corev1.PersistentVolumeClaimSpec `json:"spec"`
}

// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != '')",message="orchestrator.image is required when orchestrator is enabled"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[gofmt] reported by reviewdog 🐶

Suggested change
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != '')",message="orchestrator.image is required when orchestrator is enabled"
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != )",message="orchestrator.image is required when orchestrator is enabled"

// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.size) && self.size > 0)",message="orchestrator.size must be greater than 0 when orchestrator is enabled"
type OrchestratorSpec struct {
Enabled bool `json:"enabled,omitempty"`
Expose ServiceExpose `json:"expose,omitempty"`
Expand All @@ -184,7 +188,7 @@ type OrchestratorSpec struct {
}

type ContainerSpec struct {
Image string `json:"image"`
Image string `json:"image,omitempty"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
Expand All @@ -200,7 +204,6 @@ type ContainerSpec struct {
}

type PodSpec struct {
// +kubebuilder:validation:Required
Size int32 `json:"size,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Expand Down Expand Up @@ -286,9 +289,10 @@ func (s *PodSpec) GetInitSpec(cr *PerconaServerMySQL) InitContainerSpec {
return *s.InitContainer
}

// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != '')",message="pmm.image is required when pmm is enabled"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[gofmt] reported by reviewdog 🐶

Suggested change
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != '')",message="pmm.image is required when pmm is enabled"
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != )",message="pmm.image is required when pmm is enabled"

type PMMSpec struct {
Enabled bool `json:"enabled,omitempty"`
Image string `json:"image"`
Image string `json:"image,omitempty"`
MySQLParams string `json:"mysqlParams,omitempty"`
ServerHost string `json:"serverHost,omitempty"`
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
Expand Down Expand Up @@ -513,6 +517,10 @@ func (b *BackupStorageAzureSpec) ContainerAndPrefix() (string, string) {
return container, prefix
}

// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || has(self.binlogServer)",message="binlogServer is required when pitr is enabled"
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || !has(self.binlogServer) || (has(self.binlogServer.image) && self.binlogServer.image != '')",message="binlogServer.image is required when pitr is enabled"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[gofmt] reported by reviewdog 🐶

Suggested change
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || !has(self.binlogServer) || (has(self.binlogServer.image) && self.binlogServer.image != '')",message="binlogServer.image is required when pitr is enabled"
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || !has(self.binlogServer) || (has(self.binlogServer.image) && self.binlogServer.image != )",message="binlogServer.image is required when pitr is enabled"

// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || !has(self.binlogServer) || (has(self.binlogServer.size) && self.binlogServer.size > 0)",message="binlogServer.size is required when pitr is enabled"
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || !has(self.binlogServer) || (has(self.binlogServer.serverId) && self.binlogServer.serverId > 0)",message="binlogServer.serverId is required when pitr is enabled"
type PiTRSpec struct {
Enabled bool `json:"enabled,omitempty"`

Expand All @@ -523,19 +531,39 @@ type BinlogServerStorageSpec struct {
S3 *BackupStorageS3Spec `json:"s3,omitempty"`
}

// +kubebuilder:validation:XValidation:rule="!has(self.size) || self.size <= 1",message="binlogServer size cannot be more than 1"
type BinlogServerSpec struct {
Storage BinlogServerStorageSpec `json:"storage"`
Storage BinlogServerStorageSpec `json:"storage,omitempty"`

// The number of seconds the MySQL client library will wait to establish a connection with a remote host
ConnectTimeout int32 `json:"connectTimeout"`
// +kubebuilder:default=30
ConnectTimeout int32 `json:"connectTimeout,omitempty"`
// The number of seconds the MySQL client library will wait to read data from a remote server.
ReadTimeout int32 `json:"readTimeout"`
// +kubebuilder:default=30
ReadTimeout int32 `json:"readTimeout,omitempty"`
// The number of seconds the MySQL client library will wait to write data to a remote server.
WriteTimeout int32 `json:"writeTimeout"`
// +kubebuilder:default=30
WriteTimeout int32 `json:"writeTimeout,omitempty"`
// Specifies the server ID that the utility will be using when connecting to a remote MySQL server
ServerID int32 `json:"serverId"`
ServerID int32 `json:"serverId,omitempty"`
// The number of seconds the utility will spend in disconnected mode between reconnection attempts.
IdleTime int32 `json:"idleTime"`
// +kubebuilder:default=30
IdleTime int32 `json:"idleTime,omitempty"`
// SSLMode specifies the SSL mode for the connection to MySQL.
// +kubebuilder:default="verify_identity"
SSLMode string `json:"sslMode,omitempty"`
// VerifyChecksum enables checksum verification during replication.
// +kubebuilder:default=true
VerifyChecksum *bool `json:"verifyChecksum,omitempty"`
// RewriteFileSize specifies the maximum binlog file size for rewrite.
// +kubebuilder:default="128M"
RewriteFileSize string `json:"rewriteFileSize,omitempty"`
// CheckpointSize specifies the storage checkpoint size.
// +kubebuilder:default="16M"
CheckpointSize string `json:"checkpointSize,omitempty"`
// CheckpointInterval specifies the storage checkpoint interval.
// +kubebuilder:default="30s"
CheckpointInterval string `json:"checkpointInterval,omitempty"`

PodSpec `json:",inline"`
}
Expand All @@ -545,6 +573,8 @@ type ProxySpec struct {
HAProxy *HAProxySpec `json:"haproxy,omitempty"`
}

// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != '')",message="router.image is required when router is enabled"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[gofmt] reported by reviewdog 🐶

Suggested change
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != '')",message="router.image is required when router is enabled"
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != )",message="router.image is required when router is enabled"

// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.size) && self.size > 0)",message="router.size must be greater than 0 when router is enabled"
type MySQLRouterSpec struct {
Enabled bool `json:"enabled,omitempty"`

Expand All @@ -555,10 +585,13 @@ type MySQLRouterSpec struct {
PodSpec `json:",inline"`
}

// +kubebuilder:validation:XValidation:rule="has(self.image) && self.image != ''",message="toolkit.image is required"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[gofmt] reported by reviewdog 🐶

Suggested change
// +kubebuilder:validation:XValidation:rule="has(self.image) && self.image != ''",message="toolkit.image is required"
// +kubebuilder:validation:XValidation:rule="has(self.image) && self.image != ",message="toolkit.image is required"

type ToolkitSpec struct {
ContainerSpec `json:",inline"`
}

// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != '')",message="haproxy.image is required when haproxy is enabled"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[gofmt] reported by reviewdog 🐶

Suggested change
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != '')",message="haproxy.image is required when haproxy is enabled"
// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.image) && self.image != )",message="haproxy.image is required when haproxy is enabled"

// +kubebuilder:validation:XValidation:rule="!(has(self.enabled) && self.enabled) || (has(self.size) && self.size > 0)",message="haproxy.size must be greater than 0 when haproxy is enabled"
type HAProxySpec struct {
Enabled bool `json:"enabled,omitempty"`

Expand Down Expand Up @@ -645,6 +678,7 @@ type PerconaServerMySQLStatus struct { // INSERT ADDITIONAL STATUS FIELD - defin
Orchestrator StatefulAppStatus `json:"orchestrator,omitempty"`
HAProxy StatefulAppStatus `json:"haproxy,omitempty"`
Router StatefulAppStatus `json:"router,omitempty"`
BinlogServer StatefulAppStatus `json:"binlogServer,omitempty"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but for future, let's try to add these as conditions

State StatefulAppState `json:"state,omitempty"`
BackupVersion string `json:"backupVersion,omitempty"`
PMMVersion string `json:"pmmVersion,omitempty"`
Expand Down Expand Up @@ -1014,11 +1048,46 @@ func (cr *PerconaServerMySQL) CheckNSetDefaults(_ context.Context, serverVersion
cr.Spec.Backup.PiTR.BinlogServer = new(BinlogServerSpec)
}

if cr.Spec.Backup.PiTR.BinlogServer != nil {
bls := cr.Spec.Backup.PiTR.BinlogServer
if bls.SSLMode == "" {
bls.SSLMode = "verify_identity"
}
if bls.VerifyChecksum == nil {
t := true
bls.VerifyChecksum = &t
}
if bls.RewriteFileSize == "" {
bls.RewriteFileSize = "128M"
}
if bls.CheckpointSize == "" {
bls.CheckpointSize = "16M"
}
if bls.CheckpointInterval == "" {
bls.CheckpointInterval = "30s"
}
if bls.ConnectTimeout == 0 {
bls.ConnectTimeout = 30
}
if bls.ReadTimeout == 0 {
bls.ReadTimeout = 30
}
if bls.WriteTimeout == 0 {
bls.WriteTimeout = 30
}
if bls.IdleTime == 0 {
bls.IdleTime = 30
}
Comment on lines +1053 to +1080
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets set defaults on CRD also

}

if cr.Spec.Pause {
cr.Spec.MySQL.Size = 0
cr.Spec.Orchestrator.Size = 0
cr.Spec.Proxy.Router.Size = 0
cr.Spec.Proxy.HAProxy.Size = 0
if cr.Spec.Backup.PiTR.BinlogServer != nil {
cr.Spec.Backup.PiTR.BinlogServer.Size = 0
}
}

if cr.Spec.SecretsName == "" {
Expand Down Expand Up @@ -1290,7 +1359,6 @@ const (
UpgradeStrategyDisabled = "disabled"
UpgradeStrategyNever = "never"
UpgradeStrategyRecommended = "recommended"
UpgradeStrategyLatest = "latest"
)

func (s *BackupStorageSpec) Equals(other *BackupStorageSpec) bool {
Expand Down
63 changes: 63 additions & 0 deletions api/v1/perconaservermysql_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,69 @@ func TestCheckNSetDefaults(t *testing.T) {
err := cr.CheckNSetDefaults(t.Context(), nil)
assert.NoError(t, err)
})
t.Run("binlog server defaults are set when binlogServer is configured", func(t *testing.T) {
cr := new(PerconaServerMySQL)
cr.Spec.MySQL.VolumeSpec = &VolumeSpec{
PersistentVolumeClaim: &corev1.PersistentVolumeClaimSpec{
Resources: corev1.VolumeResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceStorage: resource.MustParse("1G"),
},
},
},
}
cr.Spec.Backup = &BackupSpec{
PiTR: PiTRSpec{
BinlogServer: &BinlogServerSpec{},
},
}

err := cr.CheckNSetDefaults(t.Context(), nil)
assert.NoError(t, err)

bls := cr.Spec.Backup.PiTR.BinlogServer
assert.Equal(t, "verify_identity", bls.SSLMode)
assert.NotNil(t, bls.VerifyChecksum)
assert.True(t, *bls.VerifyChecksum)
assert.Equal(t, "128M", bls.RewriteFileSize)
assert.Equal(t, "16M", bls.CheckpointSize)
assert.Equal(t, "30s", bls.CheckpointInterval)
})
t.Run("binlog server explicit values are not overridden by defaults", func(t *testing.T) {
cr := new(PerconaServerMySQL)
cr.Spec.MySQL.VolumeSpec = &VolumeSpec{
PersistentVolumeClaim: &corev1.PersistentVolumeClaimSpec{
Resources: corev1.VolumeResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceStorage: resource.MustParse("1G"),
},
},
},
}
f := false
cr.Spec.Backup = &BackupSpec{
PiTR: PiTRSpec{
BinlogServer: &BinlogServerSpec{
SSLMode: "required",
VerifyChecksum: &f,
RewriteFileSize: "256M",
CheckpointSize: "4M",
CheckpointInterval: "60s",
},
},
}

err := cr.CheckNSetDefaults(t.Context(), nil)
assert.NoError(t, err)

bls := cr.Spec.Backup.PiTR.BinlogServer
assert.Equal(t, "required", bls.SSLMode)
assert.NotNil(t, bls.VerifyChecksum)
assert.False(t, *bls.VerifyChecksum)
assert.Equal(t, "256M", bls.RewriteFileSize)
assert.Equal(t, "4M", bls.CheckpointSize)
assert.Equal(t, "60s", bls.CheckpointInterval)
})
}

func TestCanBackup(t *testing.T) {
Expand Down
16 changes: 16 additions & 0 deletions api/v1/perconaservermysqlrestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,24 @@ type PerconaServerMySQLRestoreSpec struct {
BackupName string `json:"backupName,omitempty"`
BackupSource *PerconaServerMySQLBackupStatus `json:"backupSource,omitempty"`
ContainerOptions *BackupContainerOptions `json:"containerOptions,omitempty"`
PITR *RestorePITRSpec `json:"pitr,omitempty"`
}

type RestorePITRSpec struct {
// +kubebuilder:validation:Enum=gtid;date
Type PITRType `json:"type"`
Copy link
Copy Markdown
Contributor

@nmarukovich nmarukovich Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add validation here? If user set type date, we need to have correct date? (the same for gtid)
(not critical)

Date string `json:"date,omitempty"`
GTID string `json:"gtid,omitempty"`
Force bool `json:"force,omitempty"`
}
Comment thread
egegunes marked this conversation as resolved.

type PITRType string

const (
PITRGtid PITRType = "gtid"
PITRDate PITRType = "date"
)

type RestoreState string

const (
Expand Down
26 changes: 26 additions & 0 deletions api/v1/zz_generated.deepcopy.go

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

7 changes: 7 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ RUN GOOS=$GOOS GOARCH=$TARGETARCH CGO_ENABLED=$CGO_ENABLED GO_LDFLAGS=$GO_LDFLAG
-o build/_output/bin/mysql-state-monitor \
cmd/mysql-state-monitor/main.go \
&& cp -r build/_output/bin/mysql-state-monitor /usr/local/bin/mysql-state-monitor
RUN GOOS=$GOOS GOARCH=$TARGETARCH CGO_ENABLED=$CGO_ENABLED GO_LDFLAGS=$GO_LDFLAGS \
go build -ldflags "-w -s -X main.GitCommit=$GIT_COMMIT -X main.GitBranch=$GIT_BRANCH -X main.BuildTime=$BUILD_TIME" \
Comment thread
egegunes marked this conversation as resolved.
-o build/_output/bin/pitr \
./cmd/pitr/ \
&& cp -r build/_output/bin/pitr /usr/local/bin/pitr

FROM redhat/ubi9-minimal AS ubi9
RUN microdnf -y update && microdnf clean all
Expand Down Expand Up @@ -91,5 +96,7 @@ COPY build/haproxy.cfg /opt/percona-server-mysql-operator/haproxy.cfg
COPY build/haproxy-global.cfg /opt/percona-server-mysql-operator/haproxy-global.cfg
COPY build/pmm-prerun.sh /opt/percona-server-mysql-operator/pmm-prerun.sh
COPY build/binlog-server-entrypoint.sh /opt/percona-server-mysql-operator/binlog-server-entrypoint.sh
COPY --from=go_builder /usr/local/bin/pitr /opt/percona-server-mysql-operator/pitr
COPY build/run-pitr-restore.sh /opt/percona-server-mysql-operator/run-pitr-restore.sh

USER 2
2 changes: 2 additions & 0 deletions build/ps-init-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "${OPERATORDIR}/haproxy-global.cf
install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "${OPERATORDIR}/pmm-prerun.sh" "${BINDIR}/pmm-prerun.sh"

install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "${OPERATORDIR}/binlog-server-entrypoint.sh" "${BINDIR}/binlog-server-entrypoint.sh"
install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "${OPERATORDIR}/pitr" "${BINDIR}/pitr"
install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "${OPERATORDIR}/run-pitr-restore.sh" "${BINDIR}/run-pitr-restore.sh"
Loading
Loading