Skip to content

Commit cbcf6d5

Browse files
committed
Remove clusterctl backup command and Backup function from Client interface
1 parent 6095481 commit cbcf6d5

File tree

11 files changed

+11
-145
lines changed

11 files changed

+11
-145
lines changed

cmd/clusterctl/client/client.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ type Client interface {
5454
// Move moves all the Cluster API objects existing in a namespace (or from all the namespaces if empty) to a target management cluster.
5555
Move(options MoveOptions) error
5656

57-
// Backup saves all the Cluster API objects existing in a namespace (or from all the namespaces if empty) to a target management cluster.
58-
//
59-
// Deprecated: This will be dropped in a future release. Please use Move.
60-
Backup(options BackupOptions) error
61-
6257
// Restore restores all the Cluster API objects existing in a configured directory based on a glob to a target management cluster.
6358
//
6459
// Deprecated: This will be dropped in a future release. Please use Move.

cmd/clusterctl/client/client_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,6 @@ func (f fakeClient) Move(options MoveOptions) error {
108108
return f.internalClient.Move(options)
109109
}
110110

111-
func (f fakeClient) Backup(options BackupOptions) error {
112-
return f.internalClient.Backup(options)
113-
}
114-
115111
func (f fakeClient) Restore(options RestoreOptions) error {
116112
return f.internalClient.Restore(options)
117113
}

cmd/clusterctl/client/cluster/mover.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ type ObjectMover interface {
5353
// FromDirectory reads all the Cluster API objects existing in a configured directory to a target management cluster.
5454
FromDirectory(toCluster Client, directory string) error
5555

56-
// Backup saves all the Cluster API objects existing in a namespace (or from all the namespaces if empty) to a target directory.
57-
//
58-
// Deprecated: This will be dropped in a future release. Please use ToDirectory.
59-
Backup(namespace string, directory string) error
60-
6156
// Restore restores all the Cluster API objects existing in a configured directory to a target management cluster.
6257
//
6358
// Deprecated: This will be dropped in a future release. Please use FromDirectory.
@@ -105,12 +100,6 @@ func (o *objectMover) Move(namespace string, toCluster Client, dryRun bool) erro
105100
return o.move(objectGraph, proxy)
106101
}
107102

108-
func (o *objectMover) Backup(namespace string, directory string) error {
109-
log := logf.Log
110-
log.V(5).Info("Deprecated: This function will be dropped in a future release. Please use ToDirectory instead of Backup.")
111-
return o.ToDirectory(namespace, directory)
112-
}
113-
114103
func (o *objectMover) ToDirectory(namespace string, directory string) error {
115104
log := logf.Log
116105
log.Info("Moving to directory...")

cmd/clusterctl/client/cluster/mover_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ func Test_objectMover_restoreTargetObject(t *testing.T) {
840840
}
841841
}
842842

843-
func Test_objectMover_backup(t *testing.T) {
843+
func Test_objectMover_toDirectory(t *testing.T) {
844844
// NB. we are testing the move and move sequence using the same set of moveTests, but checking the results at different stages of the move process
845845
for _, tt := range backupRestoreTests {
846846
t.Run(tt.name, func(t *testing.T) {

cmd/clusterctl/client/move.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,6 @@ type MoveOptions struct {
4848
DryRun bool
4949
}
5050

51-
// BackupOptions holds options supported by backup.
52-
//
53-
// Deprecated: This will be dropped in a future release. Please use MoveOptions.
54-
type BackupOptions struct {
55-
// FromKubeconfig defines the kubeconfig to use for accessing the source management cluster. If empty,
56-
// default rules for kubeconfig discovery will be used.
57-
FromKubeconfig Kubeconfig
58-
59-
// Namespace where the objects describing the workload cluster exists. If unspecified, the current
60-
// namespace will be used.
61-
Namespace string
62-
63-
// Directory defines the local directory to store the cluster objects
64-
Directory string
65-
}
66-
6751
// RestoreOptions holds options supported by restore.
6852
//
6953
// Deprecated: This will be dropped in a future release. Please use MoveOptions.
@@ -160,17 +144,6 @@ func (c *clusterctlClient) toDirectory(options MoveOptions) error {
160144
return fromCluster.ObjectMover().ToDirectory(options.Namespace, options.ToDirectory)
161145
}
162146

163-
// Backup saves all the Cluster API objects existing in a namespace (or from all the namespaces if empty) to a target directory.
164-
//
165-
// Deprecated: This will be dropped in a future release. Please use ToDirectory.
166-
func (c *clusterctlClient) Backup(options BackupOptions) error {
167-
return c.Move(MoveOptions{
168-
FromKubeconfig: options.FromKubeconfig,
169-
ToDirectory: options.Directory,
170-
Namespace: options.Namespace,
171-
})
172-
}
173-
174147
// Restore restores all the Cluster API objects existing in a configured directory to a target management cluster.
175148
//
176149
// Deprecated: This will be dropped in a future release. Please use FromDirectory.

cmd/clusterctl/client/move_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func Test_clusterctlClient_Move(t *testing.T) {
139139
}
140140
}
141141

142-
func Test_clusterctlClient_Backup(t *testing.T) {
142+
func Test_clusterctlClient_ToDirectory(t *testing.T) {
143143
dir, err := os.MkdirTemp("/tmp", "cluster-api")
144144
if err != nil {
145145
t.Error(err)
@@ -152,7 +152,7 @@ func Test_clusterctlClient_Backup(t *testing.T) {
152152
// These tests are checking the Backup scaffolding
153153
// The internal library handles the backup logic and tests can be found there
154154
type args struct {
155-
options BackupOptions
155+
options MoveOptions
156156
}
157157
tests := []struct {
158158
name string
@@ -166,9 +166,9 @@ func Test_clusterctlClient_Backup(t *testing.T) {
166166
client: fakeClientForMove(), // core v1.0.0 (v1.0.1 available), infra v2.0.0 (v2.0.1 available)
167167
},
168168
args: args{
169-
options: BackupOptions{
169+
options: MoveOptions{
170170
FromKubeconfig: Kubeconfig{Path: "kubeconfig", Context: "mgmt-context"},
171-
Directory: dir,
171+
ToDirectory: dir,
172172
},
173173
},
174174
wantErr: false,
@@ -179,9 +179,9 @@ func Test_clusterctlClient_Backup(t *testing.T) {
179179
client: fakeClientForMove(), // core v1.0.0 (v1.0.1 available), infra v2.0.0 (v2.0.1 available)
180180
},
181181
args: args{
182-
options: BackupOptions{
182+
options: MoveOptions{
183183
FromKubeconfig: Kubeconfig{Path: "kubeconfig", Context: "does-not-exist"},
184-
Directory: dir,
184+
ToDirectory: dir,
185185
},
186186
},
187187
wantErr: true,
@@ -192,7 +192,7 @@ func Test_clusterctlClient_Backup(t *testing.T) {
192192
t.Run(tt.name, func(t *testing.T) {
193193
g := NewWithT(t)
194194

195-
err := tt.fields.client.Backup(tt.args.options)
195+
err := tt.fields.client.Move(tt.args.options)
196196
if tt.wantErr {
197197
g.Expect(err).To(HaveOccurred())
198198
return

cmd/clusterctl/cmd/backup.go

Lines changed: 0 additions & 80 deletions
This file was deleted.

docs/book/src/clusterctl/commands/additional-commands.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# clusterctl backup
2-
3-
**DEPRECATED. Please use `clusterctl move --to-directory` instead.**
4-
5-
Backup Cluster API objects and all dependencies from a management cluster.
6-
71
# clusterctl config repositories
82

93
Display the list of providers and their repository configurations.

docs/book/src/clusterctl/commands/commands.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
|------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
55
| [`clusterctl alpha rollout`](alpha-rollout.md) | Manages the rollout of Cluster API resources. For example: MachineDeployments. |
66
| [`clusterctl alpha topology plan`](alpha-topology-plan.md) | Describes the changes to a cluster topology for a given input. |
7-
| [`clusterctl backup`](additional-commands.md#clusterctl-backup) | Backup Cluster API objects and all their dependencies from a management cluster. **DEPRECATED. Please use `clusterctl move --to-directory` instead.** |
87
| [`clusterctl completion`](completion.md) | Output shell completion code for the specified shell (bash or zsh). |
98
| [`clusterctl config`](additional-commands.md#clusterctl-config-repositories) | Display clusterctl configuration. |
109
| [`clusterctl delete`](delete.md) | Delete one or more providers from the management cluster. |

docs/book/src/clusterctl/commands/move.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ while doing the move operation, and possible race conditions happening while the
5252
remediating etc. has never been investigated nor addressed.
5353

5454
In order to avoid further confusion about this point, `clusterctl backup` and `clusterctl restore` commands have been
55-
deprecated because they were built on top of `clusterctl move` logic and they were sharing he same limitations.
55+
removed because they were built on top of `clusterctl move` logic and they were sharing he same limitations.
5656
User can use `clusterctl move --to-directory` and `clusterctl move --from-directory` instead; this will hopefully
5757
make it clear those operation have the same limitations of the move command.
5858

0 commit comments

Comments
 (0)