Skip to content

Commit 9c00af6

Browse files
committed
Adds kopia/restic uploader type
Implements: #1101 Signed-off-by: Michal Pryc <[email protected]>
1 parent 4148c32 commit 9c00af6

31 files changed

+1043
-347
lines changed

api/v1alpha1/oadp_types.go

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ type PodConfig struct {
118118
// nodeSelector defines the nodeSelector to be supplied to podSpec
119119
// +optional
120120
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
121-
// tolerations defines the list of tolerations to be applied
121+
// tolerations defines the list of tolerations to be applied to daemonset
122122
// +optional
123123
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
124124
// resourceAllocations defines the CPU and Memory resource allocations for the Pod
@@ -130,26 +130,53 @@ type PodConfig struct {
130130
Env []corev1.EnvVar `json:"env,omitempty"`
131131
}
132132

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

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

155182
type CloudStorageLocation struct {
@@ -388,11 +415,15 @@ func (dpa *DataProtectionApplication) AutoCorrect() {
388415
if dpa.Spec.Configuration.Velero.Args != nil {
389416
// if args is not nil, we take care of some fields that will be overridden from dpa if not specified in args
390417
// Enable user to specify --fs-backup-timeout duration (OADP default 1h0m0s)
391-
resticTimeout := "1h"
392-
if dpa.Spec.Configuration != nil && dpa.Spec.Configuration.Restic != nil && len(dpa.Spec.Configuration.Restic.Timeout) > 0 {
393-
resticTimeout = dpa.Spec.Configuration.Restic.Timeout
418+
fsBackupTimeout := "1h"
419+
if dpa.Spec.Configuration != nil {
420+
if dpa.Spec.Configuration.NodeAgent != nil && len(dpa.Spec.Configuration.NodeAgent.Timeout) > 0 {
421+
fsBackupTimeout = dpa.Spec.Configuration.NodeAgent.Timeout
422+
} else if dpa.Spec.Configuration.Restic != nil && len(dpa.Spec.Configuration.Restic.Timeout) > 0 {
423+
fsBackupTimeout = dpa.Spec.Configuration.Restic.Timeout
424+
}
394425
}
395-
if pvOperationTimeout, err := time.ParseDuration(resticTimeout); err == nil && dpa.Spec.Configuration.Velero.Args.PodVolumeOperationTimeout == nil {
426+
if pvOperationTimeout, err := time.ParseDuration(fsBackupTimeout); err == nil && dpa.Spec.Configuration.Velero.Args.PodVolumeOperationTimeout == nil {
396427
dpa.Spec.Configuration.Velero.Args.PodVolumeOperationTimeout = &pvOperationTimeout
397428
}
398429
}

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 52 additions & 15 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: 3 additions & 2 deletions
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)