Skip to content

Commit 2076da3

Browse files
committed
WIP
Signed-off-by: Michal Pryc <[email protected]>
1 parent 8750214 commit 2076da3

File tree

8 files changed

+419
-8
lines changed

8 files changed

+419
-8
lines changed

api/v1alpha1/oadp_types.go

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,29 @@ type ResticConfig struct {
146146
PodConfig *PodConfig `json:"podConfig,omitempty"`
147147
}
148148

149+
type NodeAgentConfig struct {
150+
// Embedding ResticConfig
151+
// +kubebuilder:validation:Optional
152+
ResticConfig `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:Optional
156+
// +kubebuilder:validation:Enum=restic;kopia
157+
UploaderType string `json:"uploaderType,omitempty"`
158+
}
159+
149160
// ApplicationConfig defines the configuration for the Data Protection Application
150161
type ApplicationConfig struct {
151162
Velero *VeleroConfig `json:"velero,omitempty"`
163+
// (deprecation warning) ResticConfig is the configuration for restic server.
164+
// Restic is for backwards compatibility and will be replaced by nodeagentconfig
165+
// with the OADP 1.4+
166+
// +optional
152167
Restic *ResticConfig `json:"restic,omitempty"`
168+
169+
// NodeAgent is needed to allow selection between kopia or restic
170+
// +kubebuilder:validation:Optional
171+
NodeAgent *NodeAgentConfig `json:"nodeagentconfig,omitempty"`
153172
}
154173

155174
type CloudStorageLocation struct {
@@ -388,11 +407,15 @@ func (dpa *DataProtectionApplication) AutoCorrect() {
388407
if dpa.Spec.Configuration.Velero.Args != nil {
389408
// if args is not nil, we take care of some fields that will be overridden from dpa if not specified in args
390409
// 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
410+
fsBackupTimeout := "1h"
411+
if dpa.Spec.Configuration != nil {
412+
if dpa.Spec.Configuration.NodeAgent != nil && len(dpa.Spec.Configuration.NodeAgent.Timeout) > 0 {
413+
fsBackupTimeout = dpa.Spec.Configuration.NodeAgent.Timeout
414+
} else if dpa.Spec.Configuration.Restic != nil && len(dpa.Spec.Configuration.Restic.Timeout) > 0 {
415+
fsBackupTimeout = dpa.Spec.Configuration.Restic.Timeout
416+
}
394417
}
395-
if pvOperationTimeout, err := time.ParseDuration(resticTimeout); err == nil && dpa.Spec.Configuration.Velero.Args.PodVolumeOperationTimeout == nil {
418+
if pvOperationTimeout, err := time.ParseDuration(fsBackupTimeout); err == nil && dpa.Spec.Configuration.Velero.Args.PodVolumeOperationTimeout == nil {
396419
dpa.Spec.Configuration.Velero.Args.PodVolumeOperationTimeout = &pvOperationTimeout
397420
}
398421
}

api/v1alpha1/zz_generated.deepcopy.go

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

bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml

Lines changed: 181 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,185 @@ spec:
149149
configuration:
150150
description: configuration is used to configure the data protection application's server config
151151
properties:
152+
nodeagentconfig:
153+
description: NodeAgent is needed to allow selection between kopia or restic
154+
properties:
155+
enable:
156+
description: enable defines a boolean pointer whether we want the daemonset to exist or not
157+
type: boolean
158+
podConfig:
159+
description: Pod specific configuration
160+
properties:
161+
env:
162+
description: env defines the list of environment variables to be supplied to podSpec
163+
items:
164+
description: EnvVar represents an environment variable present in a Container.
165+
properties:
166+
name:
167+
description: Name of the environment variable. Must be a C_IDENTIFIER.
168+
type: string
169+
value:
170+
description: 'Variable references $(VAR_NAME) are expanded using the previously defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to "".'
171+
type: string
172+
valueFrom:
173+
description: Source for the environment variable's value. Cannot be used if value is not empty.
174+
properties:
175+
configMapKeyRef:
176+
description: Selects a key of a ConfigMap.
177+
properties:
178+
key:
179+
description: The key to select.
180+
type: string
181+
name:
182+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
183+
type: string
184+
optional:
185+
description: Specify whether the ConfigMap or its key must be defined
186+
type: boolean
187+
required:
188+
- key
189+
type: object
190+
fieldRef:
191+
description: 'Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels[''<KEY>'']`, `metadata.annotations[''<KEY>'']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.'
192+
properties:
193+
apiVersion:
194+
description: Version of the schema the FieldPath is written in terms of, defaults to "v1".
195+
type: string
196+
fieldPath:
197+
description: Path of the field to select in the specified API version.
198+
type: string
199+
required:
200+
- fieldPath
201+
type: object
202+
resourceFieldRef:
203+
description: 'Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.'
204+
properties:
205+
containerName:
206+
description: 'Container name: required for volumes, optional for env vars'
207+
type: string
208+
divisor:
209+
anyOf:
210+
- type: integer
211+
- type: string
212+
description: Specifies the output format of the exposed resources, defaults to "1"
213+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
214+
x-kubernetes-int-or-string: true
215+
resource:
216+
description: 'Required: resource to select'
217+
type: string
218+
required:
219+
- resource
220+
type: object
221+
secretKeyRef:
222+
description: Selects a key of a secret in the pod's namespace
223+
properties:
224+
key:
225+
description: The key of the secret to select from. Must be a valid secret key.
226+
type: string
227+
name:
228+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
229+
type: string
230+
optional:
231+
description: Specify whether the Secret or its key must be defined
232+
type: boolean
233+
required:
234+
- key
235+
type: object
236+
type: object
237+
required:
238+
- name
239+
type: object
240+
type: array
241+
labels:
242+
additionalProperties:
243+
type: string
244+
description: labels to add to pods
245+
type: object
246+
nodeSelector:
247+
additionalProperties:
248+
type: string
249+
description: nodeSelector defines the nodeSelector to be supplied to Restic podSpec
250+
type: object
251+
resourceAllocations:
252+
description: resourceAllocations defines the CPU and Memory resource allocations for the restic Pod
253+
nullable: true
254+
properties:
255+
claims:
256+
description: "Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. \n This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. \n This field is immutable."
257+
items:
258+
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
259+
properties:
260+
name:
261+
description: Name must match the name of one entry in pod.spec.resourceClaims of the Pod where this field is used. It makes that resource available inside a container.
262+
type: string
263+
required:
264+
- name
265+
type: object
266+
type: array
267+
x-kubernetes-list-map-keys:
268+
- name
269+
x-kubernetes-list-type: map
270+
limits:
271+
additionalProperties:
272+
anyOf:
273+
- type: integer
274+
- type: string
275+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
276+
x-kubernetes-int-or-string: true
277+
description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
278+
type: object
279+
requests:
280+
additionalProperties:
281+
anyOf:
282+
- type: integer
283+
- type: string
284+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
285+
x-kubernetes-int-or-string: true
286+
description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
287+
type: object
288+
type: object
289+
tolerations:
290+
description: tolerations defines the list of tolerations to be applied to Restic daemonset
291+
items:
292+
description: The pod this Toleration is attached to tolerates any taint that matches the triple <key,value,effect> using the matching operator <operator>.
293+
properties:
294+
effect:
295+
description: Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
296+
type: string
297+
key:
298+
description: Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.
299+
type: string
300+
operator:
301+
description: Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.
302+
type: string
303+
tolerationSeconds:
304+
description: TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.
305+
format: int64
306+
type: integer
307+
value:
308+
description: Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.
309+
type: string
310+
type: object
311+
type: array
312+
type: object
313+
supplementalGroups:
314+
description: supplementalGroups defines the linux groups to be applied to the Restic Pod
315+
items:
316+
format: int64
317+
type: integer
318+
type: array
319+
timeout:
320+
description: timeout defines the Restic timeout, default value is 1h
321+
type: string
322+
uploaderType:
323+
description: The type of uploader to transfer the data of pod volumes, the supported values are 'restic' or 'kopia'
324+
enum:
325+
- restic
326+
- kopia
327+
type: string
328+
type: object
152329
restic:
153-
description: ResticConfig is the configuration for restic server
330+
description: (deprecation warning) ResticConfig is the configuration for restic server. Restic is for backwards compatibility and will be replaced by nodeagentconfig with the OADP 1.4+
154331
properties:
155332
enable:
156333
description: enable defines a boolean pointer whether we want the daemonset to exist or not
@@ -455,6 +632,9 @@ spec:
455632
description: How long to wait on persistent volumes and namespaces to terminate during a restore before timing out.
456633
format: int64
457634
type: integer
635+
uploader-type:
636+
description: The type of uploader to transfer the data of pod volumes, the supported values are 'restic', 'kopia' (default "restic")
637+
type: string
458638
v:
459639
description: number for the log level verbosity
460640
type: integer

0 commit comments

Comments
 (0)