Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support mounting extra volumes for restoration pods #9026

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions apis/dataprotection/v1alpha1/restore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ type RestoreSpec struct {
// +optional
Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name"`

// Specifies a list of extra volumes to be mounted in the container for restore.
// These volumes are used to supply sensitive information (e.g. encryption keys)
// that support data recovery. This field is immutable once the resource is created.
//
// +kubebuilder:pruning:PreserveUnknownFields
// +listType=map
// +listMapKey=name
// +kubebuilder:validation:MaxItems=16
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update extraVolumes"
// +optional
ExtraVolumes []ExtraVolume `json:"extraVolumes,omitempty"`

// Specifies the required resources of restore job's container.
//
// +optional
Expand Down Expand Up @@ -132,6 +144,25 @@ type IncludeResource struct {
LabelSelector metav1.LabelSelector `json:"labelSelector,omitempty"`
}

type ExtraVolume struct {
// Name of the extra volume.
//
// +kubebuilder:validation:MaxLength=32
// +kubebuilder:validation:Pattern:=`^[a-z]([a-z0-9\-]*[a-z0-9])?$`
// +kubebuilder:validation:Required
Name string `json:"name"`

// VolumeSource defines the source of the volume.
//
// +kubebuilder:pruning:PreserveUnknownFields
VolumeSource corev1.VolumeSource `json:"volumeSource"`

// VolumeMount defines how the volume should be mounted in the container.
//
// +kubebuilder:pruning:PreserveUnknownFields
VolumeMount corev1.VolumeMount `json:"volumeMount"`
}

type PrepareDataConfig struct {

// Specifies the restore policy, which is required when the pod selection strategy for the source target is 'All'.
Expand Down
31 changes: 31 additions & 0 deletions apis/operations/v1alpha1/opsrequest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,25 @@ type Backup struct {
Parameters []dpv1alpha1.ParameterPair `json:"parameters,omitempty"`
}

type ExtraVolume struct {
// Name of the extra volume.
//
// +kubebuilder:validation:MaxLength=32
// +kubebuilder:validation:Pattern:=`^[a-z]([a-z0-9\-]*[a-z0-9])?$`
// +kubebuilder:validation:Required
Name string `json:"name"`

// VolumeSource defines the source of the volume.
//
// +kubebuilder:pruning:PreserveUnknownFields
VolumeSource corev1.VolumeSource `json:"volumeSource"`

// VolumeMount defines how the volume should be mounted in the container.
//
// +kubebuilder:pruning:PreserveUnknownFields
VolumeMount corev1.VolumeMount `json:"volumeMount"`
}

type Restore struct {
// Specifies the name of the Backup custom resource.
//
Expand All @@ -881,6 +900,18 @@ type Restore struct {
// +optional
Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name"`

// Specifies a list of extra volumes to be mounted in the container.
// These volumes are used to supply sensitive information (e.g. encryption keys)
// that support data recovery. This field is immutable once the resource is created.
//
// +kubebuilder:pruning:PreserveUnknownFields
// +listType=map
// +listMapKey=name
// +kubebuilder:validation:MaxItems=16
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="forbidden to update extraVolumes"
// +optional
ExtraVolumes []ExtraVolume `json:"extraVolumes,omitempty"`

// Specifies the policy for restoring volume claims of a Component's Pods.
// It determines whether the volume claims should be restored sequentially (one by one) or in parallel (all at once).
// Support values:
Expand Down
Loading