Skip to content

Commit 8e03567

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

15 files changed

+767
-216
lines changed

api/v1alpha1/oadp_types.go

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
const ConditionReconciled = "Reconciled"
3131
const ReconciledReasonComplete = "Complete"
3232
const ReconciledReasonError = "Error"
33+
const ReconcileReasonWarning = "Warning"
3334
const ReconcileCompleteMessage = "Reconcile complete"
3435

3536
const OadpOperatorLabel = "openshift.io/oadp"
@@ -115,13 +116,13 @@ type PodConfig struct {
115116
// labels to add to pods
116117
// +optional
117118
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
119120
// +optional
120121
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
122123
// +optional
123124
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
125126
// +optional
126127
// +nullable
127128
ResourceAllocations corev1.ResourceRequirements `json:"resourceAllocations,omitempty"`
@@ -130,26 +131,53 @@ type PodConfig struct {
130131
Env []corev1.EnvVar `json:"env,omitempty"`
131132
}
132133

133-
// ResticConfig is the configuration for restic server
134-
type ResticConfig struct {
134+
type NodeAgentCommonFields struct {
135135
// enable defines a boolean pointer whether we want the daemonset to
136136
// exist or not
137137
// +optional
138138
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
140140
// +optional
141141
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
143143
// +optional
144144
Timeout string `json:"timeout,omitempty"`
145145
// Pod specific configuration
146146
PodConfig *PodConfig `json:"podConfig,omitempty"`
147147
}
148148

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+
// +required
157+
// +kubebuilder:validation:Enum=restic;kopia
158+
UploaderType string `json:"uploaderType,omitempty"`
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+
149168
// ApplicationConfig defines the configuration for the Data Protection Application
150169
type ApplicationConfig struct {
151170
Velero *VeleroConfig `json:"velero,omitempty"`
171+
// (deprecation warning) ResticConfig is the configuration for restic server.
172+
// Restic is for backwards compatibility and will be replaced by nodeagentconfig
173+
// with the OADP 1.4+
174+
// +kubebuilder:deprecatedversion:warning=1.4
175+
// +optional
152176
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"`
153181
}
154182

155183
type CloudStorageLocation struct {
@@ -269,7 +297,7 @@ type VolumeOptions struct {
269297
// the data mover cache volume
270298
//+optional
271299
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
273301
//+optional
274302
CacheCapacity string `json:"cacheCapacity,omitempty"`
275303
// cacheAccessMode is the access mode to be used to provision the cache volume
@@ -388,11 +416,15 @@ func (dpa *DataProtectionApplication) AutoCorrect() {
388416
if dpa.Spec.Configuration.Velero.Args != nil {
389417
// if args is not nil, we take care of some fields that will be overridden from dpa if not specified in args
390418
// 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+
}
394426
}
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 {
396428
dpa.Spec.Configuration.Velero.Args.PodVolumeOperationTimeout = &pvOperationTimeout
397429
}
398430
}

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.

build/Dockerfile.bundle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
77
LABEL operators.operatorframework.io.bundle.package.v1=oadp-operator
88
LABEL operators.operatorframework.io.bundle.channels.v1=stable
99
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
10-
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.23.0
10+
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.28.1
1111
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
1212
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
1313

bundle.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
77
LABEL operators.operatorframework.io.bundle.package.v1=oadp-operator
88
LABEL operators.operatorframework.io.bundle.channels.v1=stable
99
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
10-
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.23.0
10+
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.28.1
1111
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
1212
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
1313

bundle/manifests/oadp-operator.clusterserviceversion.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,15 @@ metadata:
151151
categories: OpenShift Optional
152152
certified: "false"
153153
containerImage: quay.io/konveyor/oadp-operator:latest
154-
createdAt: "2020-09-08T12:21:00Z"
154+
createdAt: "2023-08-01T11:36:38Z"
155155
description: OADP (OpenShift API for Data Protection) operator sets up and installs
156156
Data Protection Applications on the OpenShift platform.
157157
olm.skipRange: '>=0.0.0 <99.0.0'
158158
operatorframework.io/suggested-namespace: openshift-adp
159159
operators.openshift.io/infrastructure-features: '["Disconnected"]'
160160
operators.openshift.io/valid-subscription: '["OpenShift Container Platform", "OpenShift
161161
Platform Plus"]'
162-
operators.operatorframework.io/builder: operator-sdk-v1.23.0
162+
operators.operatorframework.io/builder: operator-sdk-v1.28.1
163163
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
164164
repository: https://github.com/openshift/oadp-operator
165165
support: Red Hat

0 commit comments

Comments
 (0)