-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retrieve DataUpload into backup result ConfigMap during volume snapsh…
…ot restore. Fix issue #6117. Add CSI plugin needs builder functions. Signed-off-by: Xun Jiang <jxun@vmware.com>
- Loading branch information
Xun Jiang
committed
Jun 30, 2023
1 parent
a97d01f
commit ec4bb42
Showing
18 changed files
with
1,310 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Retrieve DataUpload into backup result ConfigMap during volume snapshot restore. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add data download controller for data mover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
Copyright The Velero Contributors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package builder | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
velerov2alpha1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" | ||
) | ||
|
||
// DataDownloadBuilder builds DataDownload objects. | ||
type DataDownloadBuilder struct { | ||
object *velerov2alpha1api.DataDownload | ||
} | ||
|
||
// ForDataDownload is the constructor of DataDownloadBuilder | ||
func ForDataDownload(namespace, name string) *DataDownloadBuilder { | ||
return &DataDownloadBuilder{ | ||
object: &velerov2alpha1api.DataDownload{ | ||
TypeMeta: metav1.TypeMeta{ | ||
Kind: "DataDownload", | ||
APIVersion: velerov2alpha1api.SchemeGroupVersion.String(), | ||
}, | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: name, | ||
Namespace: namespace, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
// Result returns the built DataDownload. | ||
func (d *DataDownloadBuilder) Result() *velerov2alpha1api.DataDownload { | ||
return d.object | ||
} | ||
|
||
// BackupStorageLocation sets the DataDownload's backup storage location. | ||
func (d *DataDownloadBuilder) BackupStorageLocation(name string) *DataDownloadBuilder { | ||
d.object.Spec.BackupStorageLocation = name | ||
return d | ||
} | ||
|
||
// Phase sets the DataDownload's phase. | ||
func (d *DataDownloadBuilder) Phase(phase velerov2alpha1api.DataDownloadPhase) *DataDownloadBuilder { | ||
d.object.Status.Phase = phase | ||
return d | ||
} | ||
|
||
// SnapshotID sets the DataDownload's SnapshotID. | ||
func (d *DataDownloadBuilder) SnapshotID(id string) *DataDownloadBuilder { | ||
d.object.Spec.SnapshotID = id | ||
return d | ||
} | ||
|
||
// DataMover sets the DataDownload's DataMover. | ||
func (d *DataDownloadBuilder) DataMover(dataMover string) *DataDownloadBuilder { | ||
d.object.Spec.DataMover = dataMover | ||
return d | ||
} | ||
|
||
// SourceNamespace sets the DataDownload's SourceNamespace. | ||
func (d *DataDownloadBuilder) SourceNamespace(sourceNamespace string) *DataDownloadBuilder { | ||
d.object.Spec.SourceNamespace = sourceNamespace | ||
return d | ||
} | ||
|
||
// TargetVolume sets the DataDownload's TargetVolume. | ||
func (d *DataDownloadBuilder) TargetVolume(targetVolume velerov2alpha1api.TargetVolumeSpec) *DataDownloadBuilder { | ||
d.object.Spec.TargetVolume = targetVolume | ||
return d | ||
} | ||
|
||
// Cancel sets the DataDownload's Cancel. | ||
func (d *DataDownloadBuilder) Cancel(cancel bool) *DataDownloadBuilder { | ||
d.object.Spec.Cancel = cancel | ||
return d | ||
} | ||
|
||
// OperationTimeout sets the DataDownload's OperationTimeout. | ||
func (d *DataDownloadBuilder) OperationTimeout(timeout metav1.Duration) *DataDownloadBuilder { | ||
d.object.Spec.OperationTimeout = timeout | ||
return d | ||
} | ||
|
||
// DataMoverConfig sets the DataDownload's DataMoverConfig. | ||
func (d *DataDownloadBuilder) DataMoverConfig(config *map[string]string) *DataDownloadBuilder { | ||
d.object.Spec.DataMoverConfig = *config | ||
return d | ||
} | ||
|
||
// ObjectMeta applies functional options to the DataDownload's ObjectMeta. | ||
func (b *DataDownloadBuilder) ObjectMeta(opts ...ObjectMetaOpt) *DataDownloadBuilder { | ||
for _, opt := range opts { | ||
opt(b.object) | ||
} | ||
|
||
return b | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.