Skip to content

Commit 05cd549

Browse files
authored
Adds kopia/restic uploader type (#1102)
Implements: #1101 Signed-off-by: Michal Pryc <[email protected]>
1 parent 3dbdc4e commit 05cd549

31 files changed

+1045
-348
lines changed

api/v1alpha1/oadp_types.go

+40-9
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ type PodConfig struct {
119119
// nodeSelector defines the nodeSelector to be supplied to podSpec
120120
// +optional
121121
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
122-
// tolerations defines the list of tolerations to be applied
122+
// tolerations defines the list of tolerations to be applied to daemonset
123123
// +optional
124124
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
125125
// resourceAllocations defines the CPU and Memory resource allocations for the Pod
@@ -131,26 +131,53 @@ type PodConfig struct {
131131
Env []corev1.EnvVar `json:"env,omitempty"`
132132
}
133133

134-
// ResticConfig is the configuration for restic server
135-
type ResticConfig struct {
134+
type NodeAgentCommonFields struct {
136135
// enable defines a boolean pointer whether we want the daemonset to
137136
// exist or not
138137
// +optional
139138
Enable *bool `json:"enable,omitempty"`
140-
// supplementalGroups defines the linux groups to be applied to the Restic Pod
139+
// supplementalGroups defines the linux groups to be applied to the NodeAgent Pod
141140
// +optional
142141
SupplementalGroups []int64 `json:"supplementalGroups,omitempty"`
143-
// timeout defines the Restic timeout, default value is 1h
142+
// timeout defines the NodeAgent timeout, default value is 1h
144143
// +optional
145144
Timeout string `json:"timeout,omitempty"`
146145
// Pod specific configuration
147146
PodConfig *PodConfig `json:"podConfig,omitempty"`
148147
}
149148

149+
// NodeAgentConfig is the configuration for node server
150+
type NodeAgentConfig struct {
151+
// Embedding NodeAgentCommonFields
152+
// +optional
153+
NodeAgentCommonFields `json:",inline"`
154+
155+
// The type of uploader to transfer the data of pod volumes, the supported values are 'restic' or 'kopia'
156+
// +kubebuilder:validation:Enum=restic;kopia
157+
// +kubebuilder:validation:Required
158+
UploaderType string `json:"uploaderType"`
159+
}
160+
161+
// ResticConfig is the configuration for restic server
162+
type ResticConfig struct {
163+
// Embedding NodeAgentCommonFields
164+
// +optional
165+
NodeAgentCommonFields `json:",inline"`
166+
}
167+
150168
// ApplicationConfig defines the configuration for the Data Protection Application
151169
type ApplicationConfig struct {
152170
Velero *VeleroConfig `json:"velero,omitempty"`
171+
// (deprecation warning) ResticConfig is the configuration for restic DaemonSet.
172+
// restic is for backwards compatibility and is replaced by the nodeAgent
173+
// restic will be removed with the OADP 1.4
174+
// +kubebuilder:deprecatedversion:warning=1.3
175+
// +optional
153176
Restic *ResticConfig `json:"restic,omitempty"`
177+
178+
// NodeAgent is needed to allow selection between kopia or restic
179+
// +optional
180+
NodeAgent *NodeAgentConfig `json:"nodeAgent,omitempty"`
154181
}
155182

156183
// CloudStorageLocation defines BackupStorageLocation using bucket referenced by CloudStorage CR.
@@ -400,11 +427,15 @@ func (dpa *DataProtectionApplication) AutoCorrect() {
400427
if dpa.Spec.Configuration.Velero.Args != nil {
401428
// if args is not nil, we take care of some fields that will be overridden from dpa if not specified in args
402429
// Enable user to specify --fs-backup-timeout duration (OADP default 1h0m0s)
403-
resticTimeout := "1h"
404-
if dpa.Spec.Configuration != nil && dpa.Spec.Configuration.Restic != nil && len(dpa.Spec.Configuration.Restic.Timeout) > 0 {
405-
resticTimeout = dpa.Spec.Configuration.Restic.Timeout
430+
fsBackupTimeout := "1h"
431+
if dpa.Spec.Configuration != nil {
432+
if dpa.Spec.Configuration.NodeAgent != nil && len(dpa.Spec.Configuration.NodeAgent.Timeout) > 0 {
433+
fsBackupTimeout = dpa.Spec.Configuration.NodeAgent.Timeout
434+
} else if dpa.Spec.Configuration.Restic != nil && len(dpa.Spec.Configuration.Restic.Timeout) > 0 {
435+
fsBackupTimeout = dpa.Spec.Configuration.Restic.Timeout
436+
}
406437
}
407-
if pvOperationTimeout, err := time.ParseDuration(resticTimeout); err == nil && dpa.Spec.Configuration.Velero.Args.PodVolumeOperationTimeout == nil {
438+
if pvOperationTimeout, err := time.ParseDuration(fsBackupTimeout); err == nil && dpa.Spec.Configuration.Velero.Args.PodVolumeOperationTimeout == nil {
408439
dpa.Spec.Configuration.Velero.Args.PodVolumeOperationTimeout = &pvOperationTimeout
409440
}
410441
}

api/v1alpha1/zz_generated.deepcopy.go

+52-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/oadp-operator.clusterserviceversion.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ metadata:
3232
}
3333
],
3434
"configuration": {
35-
"restic": {
36-
"enable": true
35+
"nodeAgent": {
36+
"enable": true,
37+
"uploaderType": "restic"
3738
},
3839
"velero": {
3940
"defaultPlugins": [

0 commit comments

Comments
 (0)