Skip to content

Commit 577cf9a

Browse files
refactoring and cleanup
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
1 parent 6607df3 commit 577cf9a

11 files changed

Lines changed: 40 additions & 149 deletions

File tree

api/v1/perconaservermysqlbackup_types.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"strings"
2323

2424
"github.com/percona/percona-server-mysql-operator/pkg/config"
25-
corev1 "k8s.io/api/core/v1"
2625
"k8s.io/apimachinery/pkg/api/meta"
2726
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2827

@@ -78,17 +77,16 @@ const (
7877

7978
// PerconaServerMySQLBackupStatus defines the observed state of PerconaServerMySQLBackup
8079
type PerconaServerMySQLBackupStatus struct {
81-
Type BackupType `json:"type,omitempty"`
82-
State BackupState `json:"state,omitempty"`
83-
StateDesc string `json:"stateDescription,omitempty"`
84-
Destination BackupDestination `json:"destination,omitempty"`
85-
Storage *BackupStorageSpec `json:"storage,omitempty"`
86-
CompletedAt *metav1.Time `json:"completed,omitempty"`
87-
Image string `json:"image,omitempty"`
88-
BackupSource string `json:"backupSource,omitempty"`
89-
Compressed bool `json:"compressed,omitempty"`
90-
Conditions []metav1.Condition `json:"conditions,omitempty"`
91-
EncryptionKeySecret *corev1.SecretKeySelector `json:"encryptionKeySecret,omitempty"`
80+
Type BackupType `json:"type,omitempty"`
81+
State BackupState `json:"state,omitempty"`
82+
StateDesc string `json:"stateDescription,omitempty"`
83+
Destination BackupDestination `json:"destination,omitempty"`
84+
Storage *BackupStorageSpec `json:"storage,omitempty"`
85+
CompletedAt *metav1.Time `json:"completed,omitempty"`
86+
Image string `json:"image,omitempty"`
87+
BackupSource string `json:"backupSource,omitempty"`
88+
Compressed bool `json:"compressed,omitempty"`
89+
Conditions []metav1.Condition `json:"conditions,omitempty"`
9290
}
9391

9492
const (

api/v1/zz_generated.deepcopy.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/ps.percona.com_perconaservermysqlbackups.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,6 @@ spec:
219219
type: array
220220
destination:
221221
type: string
222-
encryptionKeySecret:
223-
properties:
224-
key:
225-
type: string
226-
name:
227-
default: ""
228-
type: string
229-
optional:
230-
type: boolean
231-
required:
232-
- key
233-
type: object
234-
x-kubernetes-map-type: atomic
235222
image:
236223
type: string
237224
state:

config/crd/bases/ps.percona.com_perconaservermysqlrestores.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,6 @@ spec:
8484
type: array
8585
destination:
8686
type: string
87-
encryptionKeySecret:
88-
properties:
89-
key:
90-
type: string
91-
name:
92-
default: ""
93-
type: string
94-
optional:
95-
type: boolean
96-
required:
97-
- key
98-
type: object
99-
x-kubernetes-map-type: atomic
10087
image:
10188
type: string
10289
state:

deploy/backup/restore.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ spec:
4141
# backupSource:
4242
# compressed: false
4343
# destination: s3://S3-BACKUP-BUCKET-NAME-HERE/backup-path
44-
# encryptionKeySecret: null
4544
# storage:
4645
# affinity:
4746
# nodeAffinity:

deploy/bundle.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,6 @@ spec:
223223
type: array
224224
destination:
225225
type: string
226-
encryptionKeySecret:
227-
properties:
228-
key:
229-
type: string
230-
name:
231-
default: ""
232-
type: string
233-
optional:
234-
type: boolean
235-
required:
236-
- key
237-
type: object
238-
x-kubernetes-map-type: atomic
239226
image:
240227
type: string
241228
state:
@@ -1334,19 +1321,6 @@ spec:
13341321
type: array
13351322
destination:
13361323
type: string
1337-
encryptionKeySecret:
1338-
properties:
1339-
key:
1340-
type: string
1341-
name:
1342-
default: ""
1343-
type: string
1344-
optional:
1345-
type: boolean
1346-
required:
1347-
- key
1348-
type: object
1349-
x-kubernetes-map-type: atomic
13501324
image:
13511325
type: string
13521326
state:

deploy/crd.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,6 @@ spec:
223223
type: array
224224
destination:
225225
type: string
226-
encryptionKeySecret:
227-
properties:
228-
key:
229-
type: string
230-
name:
231-
default: ""
232-
type: string
233-
optional:
234-
type: boolean
235-
required:
236-
- key
237-
type: object
238-
x-kubernetes-map-type: atomic
239226
image:
240227
type: string
241228
state:
@@ -1334,19 +1321,6 @@ spec:
13341321
type: array
13351322
destination:
13361323
type: string
1337-
encryptionKeySecret:
1338-
properties:
1339-
key:
1340-
type: string
1341-
name:
1342-
default: ""
1343-
type: string
1344-
optional:
1345-
type: boolean
1346-
required:
1347-
- key
1348-
type: object
1349-
x-kubernetes-map-type: atomic
13501324
image:
13511325
type: string
13521326
state:

deploy/cw-bundle.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,6 @@ spec:
223223
type: array
224224
destination:
225225
type: string
226-
encryptionKeySecret:
227-
properties:
228-
key:
229-
type: string
230-
name:
231-
default: ""
232-
type: string
233-
optional:
234-
type: boolean
235-
required:
236-
- key
237-
type: object
238-
x-kubernetes-map-type: atomic
239226
image:
240227
type: string
241228
state:
@@ -1334,19 +1321,6 @@ spec:
13341321
type: array
13351322
destination:
13361323
type: string
1337-
encryptionKeySecret:
1338-
properties:
1339-
key:
1340-
type: string
1341-
name:
1342-
default: ""
1343-
type: string
1344-
optional:
1345-
type: boolean
1346-
required:
1347-
- key
1348-
type: object
1349-
x-kubernetes-map-type: atomic
13501324
image:
13511325
type: string
13521326
state:

pkg/controller/psbackup/controller.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,18 +347,17 @@ func (r *PerconaServerMySQLBackupReconciler) prepareStatus(
347347
return errors.Wrap(err, "get backup destination")
348348
}
349349

350-
status.EncryptionKeySecret = cluster.Spec.Backup.EncryptionKeySecret
351-
if storage.EncryptionKeySecret != nil {
352-
status.EncryptionKeySecret = storage.EncryptionKeySecret
353-
}
354-
355350
status.Destination = destination
356351
status.Image = cluster.Spec.Backup.Image
357352
status.Storage = storage
358353
status.BackupSource = backupSource
359354
status.Type = cr.Spec.Type
360355
status.Compressed = cr.IsCompressed(storage, cluster.Spec.MySQL.Configuration)
361356

357+
if status.Storage.EncryptionKeySecret == nil {
358+
status.Storage.EncryptionKeySecret = cluster.Spec.Backup.EncryptionKeySecret
359+
}
360+
362361
return nil
363362
}
364363

pkg/controller/psrestore/restorer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func (s *restorerOptions) job(ctx context.Context) (*batchv1.Job, error) {
209209
}
210210
}
211211

212-
job := xtrabackup.RestoreJob(s.cluster, destination, s.cr, bcpStorage, s.initImage, pvcName, s.bcp.Status.EncryptionKeySecret)
212+
job := xtrabackup.RestoreJob(s.cluster, destination, s.cr, bcpStorage, s.initImage, pvcName)
213213
if err := controllerutil.SetControllerReference(s.cr, job, s.scheme); err != nil {
214214
return nil, errors.Wrapf(err, "set controller reference to Job %s/%s", job.Namespace, job.Name)
215215
}

0 commit comments

Comments
 (0)