diff --git a/config/crds/mysql_v1alpha1_mysqlbackup.yaml b/config/crds/mysql_v1alpha1_mysqlbackup.yaml index 66d3b5fbb..4f8132c5b 100644 --- a/config/crds/mysql_v1alpha1_mysqlbackup.yaml +++ b/config/crds/mysql_v1alpha1_mysqlbackup.yaml @@ -36,11 +36,7 @@ spec: backupURL: description: BackupURL represents the URL to the backup location, this can be partially specifyied. Default is used the one specified in - the cluster. Is the same as backupURI. - type: string - backupUri: - description: Specify an URI where to put the backup. This is deprecated - and will be removed in future releases. Use BackupURL instead. + the cluster. type: string clusterName: description: ClustterName represents the cluster for which to take backup @@ -54,10 +50,6 @@ spec: type: object status: properties: - backupUri: - description: BackupURI represent the fully uri to the backup location - This field is deprecated and will be removed in future releases. - type: string completed: description: Complete marks the backup in final state type: boolean diff --git a/config/crds/mysql_v1alpha1_mysqlcluster.yaml b/config/crds/mysql_v1alpha1_mysqlcluster.yaml index 685baec19..a5f23da3a 100644 --- a/config/crds/mysql_v1alpha1_mysqlcluster.yaml +++ b/config/crds/mysql_v1alpha1_mysqlcluster.yaml @@ -49,10 +49,6 @@ spec: description: Represents an URL to the location where to put backups. This field is the same as backupUri. type: string - backupUri: - description: 'Represents the location where to put backups. DEPRECATED: - use BackupURL instead. This field will be dropped in next versions.' - type: string image: description: To specify the image that will be used for mysql server container. If this is specified then the mysqlVersion is ignored. diff --git a/pkg/apis/mysql/v1alpha1/mysqlbackup_types.go b/pkg/apis/mysql/v1alpha1/mysqlbackup_types.go index ab9b1b885..47a69a2a0 100644 --- a/pkg/apis/mysql/v1alpha1/mysqlbackup_types.go +++ b/pkg/apis/mysql/v1alpha1/mysqlbackup_types.go @@ -30,14 +30,8 @@ type MysqlBackupSpec struct { // ClustterName represents the cluster for which to take backup ClusterName string `json:"clusterName"` - // Specify an URI where to put the backup. This is deprecated and will be - // removed in future releases. Use BackupURL instead. - // +optional - BackupURI string `json:"backupUri,omitempty"` - // BackupURL represents the URL to the backup location, this can be // partially specifyied. Default is used the one specified in the cluster. - // Is the same as backupURI. // +optional BackupURL string `json:"backupURL,omitempty"` @@ -93,11 +87,6 @@ const ( type MysqlBackupStatus struct { // Complete marks the backup in final state Completed bool `json:"completed,omitempty"` - - // BackupURI represent the fully uri to the backup location This field is - // deprecated and will be removed in future releases. - BackupURI string `json:"backupUri,omitempty"` - // Conditions represents the backup resource conditions list. Conditions []BackupCondition `json:"conditions,omitempty"` } diff --git a/pkg/apis/mysql/v1alpha1/mysqlcluster_types.go b/pkg/apis/mysql/v1alpha1/mysqlcluster_types.go index 24faf88da..5c9744592 100644 --- a/pkg/apis/mysql/v1alpha1/mysqlcluster_types.go +++ b/pkg/apis/mysql/v1alpha1/mysqlcluster_types.go @@ -70,14 +70,7 @@ type MysqlClusterSpec struct { // +optional BackupSchedule string `json:"backupSchedule,omitempty"` - // Represents the location where to put backups. - // DEPRECATED: use BackupURL instead. This field will be dropped in next - // versions. - // +optional - BackupURI string `json:"backupUri,omitempty"` - // Represents an URL to the location where to put backups. This field is the - // same as backupUri. // +optional BackupURL string `json:"backupURL,omitempty"` diff --git a/pkg/controller/mysqlbackup/internal/syncer/job.go b/pkg/controller/mysqlbackup/internal/syncer/job.go index 0fd72f9c4..2473166bc 100644 --- a/pkg/controller/mysqlbackup/internal/syncer/job.go +++ b/pkg/controller/mysqlbackup/internal/syncer/job.go @@ -70,8 +70,8 @@ func (s *jobSyncer) SyncFn(in runtime.Object) error { } if len(s.backup.GetBackupURL(s.cluster)) == 0 { - log.Info("can't get bucketURI", "cluster", s.cluster, "backup", s.backup) - return fmt.Errorf("can't get bucketURI") + log.Info("can't get backupURL", "cluster", s.cluster, "backup", s.backup) + return fmt.Errorf("can't get backupURL") } // check if job is already created an just update the status diff --git a/pkg/controller/mysqlbackup/mysqlbackup_controller.go b/pkg/controller/mysqlbackup/mysqlbackup_controller.go index d8a67f869..32831da22 100644 --- a/pkg/controller/mysqlbackup/mysqlbackup_controller.go +++ b/pkg/controller/mysqlbackup/mysqlbackup_controller.go @@ -124,13 +124,6 @@ func (r *ReconcileMysqlBackup) Reconcile(request reconcile.Request) (reconcile.R // Set defaults on backup r.scheme.Default(backup.Unwrap()) - // migrate old backups to the new version - // TODO: remove this in version v0.3.0 - if backup.Spec.BackupURL == "" && backup.Spec.BackupURI == "" && backup.Status.Completed && len(backup.Status.BackupURI) > 0 { - backup.Spec.BackupURL = backup.Status.BackupURI - return reconcile.Result{}, r.Update(context.TODO(), backup) - } - // save the backup for later check for diff savedBackup := backup.Unwrap().DeepCopy() diff --git a/pkg/controller/mysqlbackup/mysqlbackup_controller_test.go b/pkg/controller/mysqlbackup/mysqlbackup_controller_test.go index c68b16670..036ce513e 100644 --- a/pkg/controller/mysqlbackup/mysqlbackup_controller_test.go +++ b/pkg/controller/mysqlbackup/mysqlbackup_controller_test.go @@ -288,22 +288,6 @@ var _ = Describe("MysqlBackup controller", func() { AfterEach(func() { Expect(c.Delete(context.TODO(), cluster.Unwrap())).To(Succeed()) }) - - It("should use backupURI as backupURL", func() { - backup.Spec.BackupURL = "" - backup.Spec.BackupURI = "gs://bucket/" - Expect(c.Create(context.TODO(), backup.Unwrap())).To(Succeed()) - defer c.Delete(context.TODO(), backup.Unwrap()) - - // wait for a reconcile request - Eventually(requests, timeout).Should(Receive(Equal(expectedRequest))) - - Eventually(refreshFn(c, backupKey)).Should(PointTo(MatchFields(IgnoreExtras, Fields{ - "Spec": MatchFields(IgnoreExtras, Fields{ - "BackupURL": ContainSubstring(backup.Spec.BackupURI), - }), - }))) - }) }) }) diff --git a/pkg/controller/mysqlcluster/mysqlcluster_controller_test.go b/pkg/controller/mysqlcluster/mysqlcluster_controller_test.go index e66011470..04b4e7f89 100644 --- a/pkg/controller/mysqlcluster/mysqlcluster_controller_test.go +++ b/pkg/controller/mysqlcluster/mysqlcluster_controller_test.go @@ -413,7 +413,7 @@ var _ = Describe("MysqlCluster controller", func() { corev1.ReadWriteOnce, } - cluster.Spec.BackupURI = backupURL + cluster.Spec.BackupURL = backupURL cluster.Spec.VolumeSpec = api.VolumeSpec{ // old PVC field PersistentVolumeClaimSpec: corev1.PersistentVolumeClaimSpec{ diff --git a/pkg/internal/mysqlbackup/defaults.go b/pkg/internal/mysqlbackup/defaults.go index 5195b8398..20bcde58f 100644 --- a/pkg/internal/mysqlbackup/defaults.go +++ b/pkg/internal/mysqlbackup/defaults.go @@ -22,12 +22,6 @@ import ( // SetDefaults sets default for backup func (w *MysqlBackup) SetDefaults(cluster *mysqlcluster.MysqlCluster) { - // the source of truth is BackupURL if this is not set then use what is in - // BackupURI - if len(w.Spec.BackupURL) == 0 { - w.Spec.BackupURL = w.Spec.BackupURI - } - w.Spec.BackupURL = w.GetBackupURL(cluster) if len(w.Spec.BackupSecretName) == 0 { diff --git a/pkg/internal/mysqlbackup/mysqlbackup.go b/pkg/internal/mysqlbackup/mysqlbackup.go index c50d9a33e..a948f593e 100644 --- a/pkg/internal/mysqlbackup/mysqlbackup.go +++ b/pkg/internal/mysqlbackup/mysqlbackup.go @@ -62,10 +62,6 @@ func (b *MysqlBackup) GetBackupURL(cluster *mysqlcluster.MysqlCluster) string { return b.composeBackupURL(b.Spec.BackupURL) } - if len(cluster.Spec.BackupURL) == 0 { - cluster.Spec.BackupURL = cluster.Spec.BackupURI - } - if len(cluster.Spec.BackupURL) == 0 { return "" } diff --git a/pkg/internal/mysqlcluster/mysqlcluster.go b/pkg/internal/mysqlcluster/mysqlcluster.go index 4c862ba7a..46fb4b5f1 100644 --- a/pkg/internal/mysqlcluster/mysqlcluster.go +++ b/pkg/internal/mysqlcluster/mysqlcluster.go @@ -62,10 +62,7 @@ func (c *MysqlCluster) GetLabels() labels.Set { } labels := labels.Set{ - // TODO: remove those labels at major release and update selector labels - "app": "mysql-operator", - "mysql_cluster": c.Name, - + "mysql.presslabs.org/cluster": c.Name, "app.kubernetes.io/name": "mysql", "app.kubernetes.io/instance": instance, "app.kubernetes.io/version": version, @@ -83,8 +80,9 @@ func (c *MysqlCluster) GetLabels() labels.Set { // GetSelectorLabels returns the labels that will be used as selector func (c *MysqlCluster) GetSelectorLabels() labels.Set { return labels.Set{ - "app": "mysql-operator", - "mysql_cluster": c.Name, + "app.kubernetes.io/name": "mysql", + "mysql.presslabs.org/cluster": c.Name, + "app.kubernetes.io/managed-by": "mysql.presslabs.org", } } @@ -169,11 +167,6 @@ func (c *MysqlCluster) GetMysqlImage() string { // UpdateSpec updates the cluster specs that need to be saved func (c *MysqlCluster) UpdateSpec() { - // TODO: when BackupURI is removed clear this - if len(c.Spec.BackupURL) == 0 { - c.Spec.BackupURL = c.Spec.BackupURI - } - // TODO: delete this when when inlined PVC is removed from spec. if c.Spec.VolumeSpec.PersistentVolumeClaim == nil { if c.Spec.VolumeSpec.HostPath == nil && c.Spec.VolumeSpec.EmptyDir == nil {