@@ -430,6 +430,17 @@ type EncryptionKeySecretSelector struct {
430430 Key string `json:"key,omitempty"`
431431}
432432
433+ const DefaultCABundleKey = "ca.crt"
434+
435+ type CABundleSecretSelector struct {
436+ // +kubebuilder:validation:Required
437+ Name string `json:"name"`
438+
439+ // +kubebuilder:validation:Optional
440+ // +kubebuilder:default:=ca.crt
441+ Key string `json:"key,omitempty"`
442+ }
443+
433444type BackupSpec struct {
434445 Enabled bool `json:"enabled,omitempty"`
435446 SourcePod string `json:"sourcePod,omitempty"`
@@ -590,6 +601,9 @@ type BackupStorageS3Spec struct {
590601 CredentialsSecret string `json:"credentialsSecret"`
591602 Region string `json:"region,omitempty"`
592603 EndpointURL string `json:"endpointUrl,omitempty"`
604+ // CABundle selects a custom CA certificate bundle for TLS connections to the S3 endpoint.
605+ // +optional
606+ CABundle * CABundleSecretSelector `json:"caBundle,omitempty"`
593607}
594608
595609// BucketAndPrefix returns bucket name and backup prefix from Bucket concatenated with Prefix.
@@ -1185,6 +1199,16 @@ func (cr *PerconaServerMySQL) CheckNSetDefaults(_ context.Context, serverVersion
11851199 if cr .Spec .Backup == nil {
11861200 cr .Spec .Backup = new (BackupSpec )
11871201 }
1202+ for _ , storage := range cr .Spec .Backup .Storages {
1203+ if storage != nil && storage .S3 != nil && storage .S3 .CABundle != nil && storage .S3 .CABundle .Key == "" {
1204+ storage .S3 .CABundle .Key = DefaultCABundleKey
1205+ }
1206+ }
1207+ if binlogServer := cr .Spec .Backup .PiTR .BinlogServer ; binlogServer != nil &&
1208+ binlogServer .Storage .S3 != nil && binlogServer .Storage .S3 .CABundle != nil &&
1209+ binlogServer .Storage .S3 .CABundle .Key == "" {
1210+ binlogServer .Storage .S3 .CABundle .Key = DefaultCABundleKey
1211+ }
11881212
11891213 if cr .Spec .Backup .Enabled {
11901214 if len (cr .Spec .Backup .Image ) == 0 {
@@ -1749,6 +1773,9 @@ func (s *BackupStorageSpec) Equals(other *BackupStorageSpec) bool {
17491773}
17501774
17511775func (s * BackupStorageS3Spec ) equals (other * BackupStorageS3Spec ) bool {
1776+ if s == nil || other == nil {
1777+ return s == other
1778+ }
17521779 if s .Bucket != other .Bucket {
17531780 return false
17541781 }
@@ -1761,6 +1788,12 @@ func (s *BackupStorageS3Spec) equals(other *BackupStorageS3Spec) bool {
17611788 if s .EndpointURL != other .EndpointURL {
17621789 return false
17631790 }
1791+ if (s .CABundle == nil ) != (other .CABundle == nil ) {
1792+ return false
1793+ }
1794+ if s .CABundle != nil && * s .CABundle != * other .CABundle {
1795+ return false
1796+ }
17641797 return true
17651798}
17661799
0 commit comments