@@ -30,6 +30,7 @@ import (
30
30
const ConditionReconciled = "Reconciled"
31
31
const ReconciledReasonComplete = "Complete"
32
32
const ReconciledReasonError = "Error"
33
+ const ReconcileReasonWarning = "Warning"
33
34
const ReconcileCompleteMessage = "Reconcile complete"
34
35
35
36
const OadpOperatorLabel = "openshift.io/oadp"
@@ -115,13 +116,13 @@ type PodConfig struct {
115
116
// labels to add to pods
116
117
// +optional
117
118
Labels map [string ]string `json:"labels,omitempty"`
118
- // nodeSelector defines the nodeSelector to be supplied to Restic podSpec
119
+ // nodeSelector defines the nodeSelector to be supplied to NodeAgent podSpec
119
120
// +optional
120
121
NodeSelector map [string ]string `json:"nodeSelector,omitempty"`
121
- // tolerations defines the list of tolerations to be applied to Restic daemonset
122
+ // tolerations defines the list of tolerations to be applied to NodeAgent daemonset
122
123
// +optional
123
124
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
124
- // resourceAllocations defines the CPU and Memory resource allocations for the restic Pod
125
+ // resourceAllocations defines the CPU and Memory resource allocations for the NodeAgent Pod
125
126
// +optional
126
127
// +nullable
127
128
ResourceAllocations corev1.ResourceRequirements `json:"resourceAllocations,omitempty"`
@@ -130,26 +131,53 @@ type PodConfig struct {
130
131
Env []corev1.EnvVar `json:"env,omitempty"`
131
132
}
132
133
133
- // ResticConfig is the configuration for restic server
134
- type ResticConfig struct {
134
+ type NodeAgentCommonFields struct {
135
135
// enable defines a boolean pointer whether we want the daemonset to
136
136
// exist or not
137
137
// +optional
138
138
Enable * bool `json:"enable,omitempty"`
139
- // 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
140
140
// +optional
141
141
SupplementalGroups []int64 `json:"supplementalGroups,omitempty"`
142
- // timeout defines the Restic timeout, default value is 1h
142
+ // timeout defines the NodeAgent timeout, default value is 1h
143
143
// +optional
144
144
Timeout string `json:"timeout,omitempty"`
145
145
// Pod specific configuration
146
146
PodConfig * PodConfig `json:"podConfig,omitempty"`
147
147
}
148
148
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
+
149
168
// ApplicationConfig defines the configuration for the Data Protection Application
150
169
type ApplicationConfig struct {
151
170
Velero * VeleroConfig `json:"velero,omitempty"`
171
+ // (deprecation warning) ResticConfig is the configuration for restic server.
172
+ // Restic is for backwards compatibility and is replaced by the nodeAgentConfig
173
+ // Restic will be removed with the OADP 1.4
174
+ // +kubebuilder:deprecatedversion:warning=1.3
175
+ // +optional
152
176
Restic * ResticConfig `json:"restic,omitempty"`
177
+
178
+ // NodeAgent is needed to allow selection between kopia or restic
179
+ // +optional
180
+ NodeAgent * NodeAgentConfig `json:"nodeAgentConfig,omitempty"`
153
181
}
154
182
155
183
type CloudStorageLocation struct {
@@ -269,7 +297,7 @@ type VolumeOptions struct {
269
297
// the data mover cache volume
270
298
//+optional
271
299
CacheStorageClassName string `json:"cacheStorageClassName,omitempty"`
272
- // cacheCapacity determines the size of the restic metadata cache volume
300
+ // cacheCapacity determines the size of the nodeAgent metadata cache volume
273
301
//+optional
274
302
CacheCapacity string `json:"cacheCapacity,omitempty"`
275
303
// cacheAccessMode is the access mode to be used to provision the cache volume
@@ -388,11 +416,15 @@ func (dpa *DataProtectionApplication) AutoCorrect() {
388
416
if dpa .Spec .Configuration .Velero .Args != nil {
389
417
// if args is not nil, we take care of some fields that will be overridden from dpa if not specified in args
390
418
// 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
419
+ fsBackupTimeout := "1h"
420
+ if dpa .Spec .Configuration != nil {
421
+ if dpa .Spec .Configuration .NodeAgent != nil && len (dpa .Spec .Configuration .NodeAgent .Timeout ) > 0 {
422
+ fsBackupTimeout = dpa .Spec .Configuration .NodeAgent .Timeout
423
+ } else if dpa .Spec .Configuration .Restic != nil && len (dpa .Spec .Configuration .Restic .Timeout ) > 0 {
424
+ fsBackupTimeout = dpa .Spec .Configuration .Restic .Timeout
425
+ }
394
426
}
395
- if pvOperationTimeout , err := time .ParseDuration (resticTimeout ); err == nil && dpa .Spec .Configuration .Velero .Args .PodVolumeOperationTimeout == nil {
427
+ if pvOperationTimeout , err := time .ParseDuration (fsBackupTimeout ); err == nil && dpa .Spec .Configuration .Velero .Args .PodVolumeOperationTimeout == nil {
396
428
dpa .Spec .Configuration .Velero .Args .PodVolumeOperationTimeout = & pvOperationTimeout
397
429
}
398
430
}
0 commit comments