Skip to content

Commit 693caf6

Browse files
Add VM file restore feature integration
This commit integrates the VM file restore feature into OADP operator, following the same pattern as the non-admin controller integration. Features: - Enable/disable VM file restore via DPA.Spec.VMFileRestore.Enable - Automatic deployment of oadp-vm-file-restore-controller when enabled - Support for custom resource limits via DPA configuration - Image override support for all 4 required images: * VM file restore controller * File access container * SSH sidecar * FileBrowser sidecar Changes: - API: Added VMFileRestore struct to DataProtectionApplication spec - API: Added 4 image key constants for unsupportedOverrides - Controller: Created vmfilerestore_controller.go with reconciliation logic - Validation: Added VM file restore validation requiring kubevirt and openshift plugins - CRDs: Added VirtualMachineBackupsDiscovery and VirtualMachineFileRestore - RBAC: Added ClusterRole, binding, and ServiceAccount for controller - Bundle: Updated CSV with new CRDs, environment variables, and related images - Documentation: Created comprehensive user guide at docs/config/vm_file_restore.md - Tests: Added 33 unit test scenarios with full coverage Prerequisites: - KubeVirt must be installed in the cluster - kubevirt-velero-plugin must be configured in defaultPlugins (required) - openshift-velero-plugin must be configured in defaultPlugins (required) Implements: migtools/oadp-vm-file-restore#10 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 513180a commit 693caf6

22 files changed

+4008
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Documentation in this repository are considered unofficial and for development p
9797
5. [Use NooBaa as a Backup Storage Location](docs/config/noobaa/install_oadp_noobaa.md)
9898
6. [Use Velero --features flag](docs/config/features_flag.md)
9999
7. [Use Custom Plugin Images for Velero ](docs/config/custom_plugin_images.md)
100+
8. [Enable VM File Restore](docs/config/vm_file_restore.md)
100101
5. Examples
101102
1. [Sample Apps used in OADP CI](https://github.com/openshift/oadp-operator/tree/oadp-dev/tests/e2e/sample-applications)
102103
2. [Stateless App Backup/Restore](docs/examples/stateless.md)

api/v1alpha1/dataprotectionapplication_types.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ const GCPPluginImageKey UnsupportedImageKey = "gcpPluginImageFqin"
7373
const KubeVirtPluginImageKey UnsupportedImageKey = "kubevirtPluginImageFqin"
7474
const HypershiftPluginImageKey UnsupportedImageKey = "hypershiftPluginImageFqin"
7575
const NonAdminControllerImageKey UnsupportedImageKey = "nonAdminControllerImageFqin"
76+
const VMFileRestoreControllerImageKey UnsupportedImageKey = "vmFileRestoreControllerImageFqin"
77+
const VMFileRestoreAccessImageKey UnsupportedImageKey = "vmFileRestoreAccessImageFqin"
78+
const VMFileRestoreSSHImageKey UnsupportedImageKey = "vmFileRestoreSSHImageFqin"
79+
const VMFileRestoreBrowserImageKey UnsupportedImageKey = "vmFileRestoreBrowserImageFqin"
7680
const OperatorTypeKey UnsupportedImageKey = "operator-type"
7781

7882
const OperatorTypeMTC = "mtc"
@@ -728,6 +732,18 @@ type NonAdmin struct {
728732
BackupSyncPeriod *metav1.Duration `json:"backupSyncPeriod,omitempty"`
729733
}
730734

735+
// VMFileRestore defines VM file restore feature configuration
736+
type VMFileRestore struct {
737+
// Enable flag to deploy VM file restore controller
738+
// By default is disabled
739+
// +optional
740+
Enable *bool `json:"enable,omitempty"`
741+
742+
// Resource requirements for the VM file restore controller
743+
// +optional
744+
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
745+
}
746+
731747
// DataMover defines the various config for DPA data mover
732748
type DataMover struct {
733749
// enable flag is used to specify whether you want to deploy the volume snapshot mover controller
@@ -840,6 +856,10 @@ type DataProtectionApplicationSpec struct {
840856
// - kubevirtPluginImageFqin
841857
// - hypershiftPluginImageFqin
842858
// - nonAdminControllerImageFqin
859+
// - vmFileRestoreControllerImageFqin
860+
// - vmFileRestoreAccessImageFqin
861+
// - vmFileRestoreSSHImageFqin
862+
// - vmFileRestoreBrowserImageFqin
843863
// - operator-type
844864
// - tech-preview-ack
845865
// +optional
@@ -873,6 +893,9 @@ type DataProtectionApplicationSpec struct {
873893
// nonAdmin defines the configuration for the DPA to enable backup and restore operations for non-admin users
874894
// +optional
875895
NonAdmin *NonAdmin `json:"nonAdmin,omitempty"`
896+
// vmFileRestore defines the configuration for the DPA to enable VM file restore feature
897+
// +optional
898+
VMFileRestore *VMFileRestore `json:"vmFileRestore,omitempty"`
876899
// The format for log output. Valid values are text, json. (default text)
877900
// +kubebuilder:validation:Enum=text;json
878901
// +kubebuilder:default=text

api/v1alpha1/zz_generated.deepcopy.go

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

bundle/manifests/oadp-operator.clusterserviceversion.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,12 @@ spec:
688688
displayName: Plugins
689689
path: plugins
690690
version: v1
691+
- kind: VirtualMachineBackupsDiscovery
692+
name: virtualmachinebackupsdiscoveries.oadp.openshift.io
693+
version: v1alpha1
694+
- kind: VirtualMachineFileRestore
695+
name: virtualmachinefilerestores.oadp.openshift.io
696+
version: v1alpha1
691697
- description: VolumeSnapshotLocation is a location where Velero stores volume
692698
snapshots.
693699
displayName: VolumeSnapshotLocation
@@ -1135,6 +1141,14 @@ spec:
11351141
value: registry.redhat.io/oadp/oadp-mustgather-rhel8:v1.2
11361142
- name: RELATED_IMAGE_NON_ADMIN_CONTROLLER
11371143
value: quay.io/konveyor/oadp-non-admin:latest
1144+
- name: RELATED_IMAGE_VM_FILE_RESTORE_CONTROLLER
1145+
value: quay.io/konveyor/oadp-vm-file-restore:latest
1146+
- name: RELATED_IMAGE_VM_FILE_RESTORE_ACCESS
1147+
value: quay.io/konveyor/oadp-vmfr-access:latest
1148+
- name: RELATED_IMAGE_VM_FILE_RESTORE_SSH
1149+
value: quay.io/konveyor/oadp-vmfr-access-sshd:latest
1150+
- name: RELATED_IMAGE_VM_FILE_RESTORE_BROWSER
1151+
value: quay.io/konveyor/oadp-vmfr-access-filebrowser:latest
11381152
image: quay.io/konveyor/oadp-operator:latest
11391153
imagePullPolicy: Always
11401154
livenessProbe:
@@ -1297,4 +1311,12 @@ spec:
12971311
name: mustgather
12981312
- image: quay.io/konveyor/oadp-non-admin:latest
12991313
name: non-admin-controller
1314+
- image: quay.io/konveyor/oadp-vm-file-restore:latest
1315+
name: vm-file-restore-controller
1316+
- image: quay.io/konveyor/oadp-vmfr-access:latest
1317+
name: vm-file-restore-access
1318+
- image: quay.io/konveyor/oadp-vmfr-access-sshd:latest
1319+
name: vm-file-restore-ssh
1320+
- image: quay.io/konveyor/oadp-vmfr-access-filebrowser:latest
1321+
name: vm-file-restore-browser
13001322
version: 99.0.0

bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2669,9 +2669,81 @@ spec:
26692669
- kubevirtPluginImageFqin
26702670
- hypershiftPluginImageFqin
26712671
- nonAdminControllerImageFqin
2672+
- vmFileRestoreControllerImageFqin
2673+
- vmFileRestoreAccessImageFqin
2674+
- vmFileRestoreSSHImageFqin
2675+
- vmFileRestoreBrowserImageFqin
26722676
- operator-type
26732677
- tech-preview-ack
26742678
type: object
2679+
vmFileRestore:
2680+
description: vmFileRestore defines the configuration for the DPA to enable VM file restore feature
2681+
properties:
2682+
enable:
2683+
description: |-
2684+
Enable flag to deploy VM file restore controller
2685+
By default is disabled
2686+
type: boolean
2687+
resources:
2688+
description: Resource requirements for the VM file restore controller
2689+
properties:
2690+
claims:
2691+
description: |-
2692+
Claims lists the names of resources, defined in spec.resourceClaims,
2693+
that are used by this container.
2694+
2695+
This is an alpha field and requires enabling the
2696+
DynamicResourceAllocation feature gate.
2697+
2698+
This field is immutable. It can only be set for containers.
2699+
items:
2700+
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
2701+
properties:
2702+
name:
2703+
description: |-
2704+
Name must match the name of one entry in pod.spec.resourceClaims of
2705+
the Pod where this field is used. It makes that resource available
2706+
inside a container.
2707+
type: string
2708+
request:
2709+
description: |-
2710+
Request is the name chosen for a request in the referenced claim.
2711+
If empty, everything from the claim is made available, otherwise
2712+
only the result of this request.
2713+
type: string
2714+
required:
2715+
- name
2716+
type: object
2717+
type: array
2718+
x-kubernetes-list-map-keys:
2719+
- name
2720+
x-kubernetes-list-type: map
2721+
limits:
2722+
additionalProperties:
2723+
anyOf:
2724+
- type: integer
2725+
- type: string
2726+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
2727+
x-kubernetes-int-or-string: true
2728+
description: |-
2729+
Limits describes the maximum amount of compute resources allowed.
2730+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
2731+
type: object
2732+
requests:
2733+
additionalProperties:
2734+
anyOf:
2735+
- type: integer
2736+
- type: string
2737+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
2738+
x-kubernetes-int-or-string: true
2739+
description: |-
2740+
Requests describes the minimum amount of compute resources required.
2741+
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
2742+
otherwise to an implementation-defined value. Requests cannot exceed Limits.
2743+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
2744+
type: object
2745+
type: object
2746+
type: object
26752747
required:
26762748
- configuration
26772749
type: object

0 commit comments

Comments
 (0)