diff --git a/Makefile b/Makefile index d74bb9aa24b..1167e301e2f 100644 --- a/Makefile +++ b/Makefile @@ -331,7 +331,6 @@ nullables: nullable-crds-bundle: DPA_SPEC_CONFIG_PROP = .spec.versions.0.schema.openAPIV3Schema.properties.spec.properties.configuration.properties nullable-crds-bundle: PROP_RESOURCE_ALLOC = properties.podConfig.properties.resourceAllocations nullable-crds-bundle: VELERO_RESOURCE_ALLOC = $(DPA_SPEC_CONFIG_PROP).velero.$(PROP_RESOURCE_ALLOC) -nullable-crds-bundle: RESTIC_RESOURCE_ALLOC = $(DPA_SPEC_CONFIG_PROP).restic.$(PROP_RESOURCE_ALLOC) nullable-crds-bundle: DPA_CRD_YAML ?= bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml nullable-crds-bundle: yq # Velero CRD @@ -345,17 +344,6 @@ nullable-crds-bundle: yq @mv $(DPA_CRD_YAML).yqresult $(DPA_CRD_YAML) @$(YQ) '$(VELERO_RESOURCE_ALLOC).properties.requests.additionalProperties.nullable = true' $(DPA_CRD_YAML) > $(DPA_CRD_YAML).yqresult @mv $(DPA_CRD_YAML).yqresult $(DPA_CRD_YAML) -# Restic CRD - @$(YQ) '$(RESTIC_RESOURCE_ALLOC).nullable = true' $(DPA_CRD_YAML) > $(DPA_CRD_YAML).yqresult - @mv $(DPA_CRD_YAML).yqresult $(DPA_CRD_YAML) - @$(YQ) '$(RESTIC_RESOURCE_ALLOC).properties.limits.nullable = true' $(DPA_CRD_YAML) > $(DPA_CRD_YAML).yqresult - @mv $(DPA_CRD_YAML).yqresult $(DPA_CRD_YAML) - @$(YQ) '$(RESTIC_RESOURCE_ALLOC).properties.limits.additionalProperties.nullable = true' $(DPA_CRD_YAML) > $(DPA_CRD_YAML).yqresult - @mv $(DPA_CRD_YAML).yqresult $(DPA_CRD_YAML) - @$(YQ) '$(RESTIC_RESOURCE_ALLOC).properties.requests.nullable = true' $(DPA_CRD_YAML) > $(DPA_CRD_YAML).yqresult - @mv $(DPA_CRD_YAML).yqresult $(DPA_CRD_YAML) - @$(YQ) '$(RESTIC_RESOURCE_ALLOC).properties.requests.additionalProperties.nullable = true' $(DPA_CRD_YAML) > $(DPA_CRD_YAML).yqresult - @mv $(DPA_CRD_YAML).yqresult $(DPA_CRD_YAML) .PHONY: nullable-crds-config nullable-crds-config: DPA_CRD_YAML ?= config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml diff --git a/api/v1alpha1/oadp_types.go b/api/v1alpha1/oadp_types.go index 19e404183b7..53e9cb7f14f 100644 --- a/api/v1alpha1/oadp_types.go +++ b/api/v1alpha1/oadp_types.go @@ -122,7 +122,8 @@ type PodConfig struct { Env []corev1.EnvVar `json:"env,omitempty"` } -type NodeAgentCommonFields struct { +// NodeAgentConfig is the configuration for node server +type NodeAgentConfig struct { // enable defines a boolean pointer whether we want the daemonset to // exist or not // +optional @@ -135,13 +136,6 @@ type NodeAgentCommonFields struct { Timeout string `json:"timeout,omitempty"` // Pod specific configuration PodConfig *PodConfig `json:"podConfig,omitempty"` -} - -// NodeAgentConfig is the configuration for node server -type NodeAgentConfig struct { - // Embedding NodeAgentCommonFields - // +optional - NodeAgentCommonFields `json:",inline"` // The type of uploader to transfer the data of pod volumes, the supported values are 'restic' or 'kopia' // +kubebuilder:validation:Enum=restic;kopia @@ -149,22 +143,9 @@ type NodeAgentConfig struct { UploaderType string `json:"uploaderType"` } -// ResticConfig is the configuration for restic server -type ResticConfig struct { - // Embedding NodeAgentCommonFields - // +optional - NodeAgentCommonFields `json:",inline"` -} - // ApplicationConfig defines the configuration for the Data Protection Application type ApplicationConfig struct { Velero *VeleroConfig `json:"velero,omitempty"` - // (deprecation warning) ResticConfig is the configuration for restic DaemonSet. - // restic is for backwards compatibility and is replaced by the nodeAgent - // restic will be removed with the OADP 1.4 - // +kubebuilder:deprecatedversion:warning=1.3 - // +optional - Restic *ResticConfig `json:"restic,omitempty"` // NodeAgent is needed to allow selection between kopia or restic // +optional @@ -426,8 +407,6 @@ func (dpa *DataProtectionApplication) AutoCorrect() { if dpa.Spec.Configuration != nil { if dpa.Spec.Configuration.NodeAgent != nil && len(dpa.Spec.Configuration.NodeAgent.Timeout) > 0 { fsBackupTimeout = dpa.Spec.Configuration.NodeAgent.Timeout - } else if dpa.Spec.Configuration.Restic != nil && len(dpa.Spec.Configuration.Restic.Timeout) > 0 { - fsBackupTimeout = dpa.Spec.Configuration.Restic.Timeout } } if pvOperationTimeout, err := time.ParseDuration(fsBackupTimeout); err == nil && dpa.Spec.Configuration.Velero.Args.PodVolumeOperationTimeout == nil { diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index fdd08474bbb..143ca62bcd4 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -37,11 +37,6 @@ func (in *ApplicationConfig) DeepCopyInto(out *ApplicationConfig) { *out = new(VeleroConfig) (*in).DeepCopyInto(*out) } - if in.Restic != nil { - in, out := &in.Restic, &out.Restic - *out = new(ResticConfig) - (*in).DeepCopyInto(*out) - } if in.NodeAgent != nil { in, out := &in.NodeAgent, &out.NodeAgent *out = new(NodeAgentConfig) @@ -456,7 +451,7 @@ func (in *Features) DeepCopy() *Features { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeAgentCommonFields) DeepCopyInto(out *NodeAgentCommonFields) { +func (in *NodeAgentConfig) DeepCopyInto(out *NodeAgentConfig) { *out = *in if in.Enable != nil { in, out := &in.Enable, &out.Enable @@ -475,22 +470,6 @@ func (in *NodeAgentCommonFields) DeepCopyInto(out *NodeAgentCommonFields) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAgentCommonFields. -func (in *NodeAgentCommonFields) DeepCopy() *NodeAgentCommonFields { - if in == nil { - return nil - } - out := new(NodeAgentCommonFields) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeAgentConfig) DeepCopyInto(out *NodeAgentConfig) { - *out = *in - in.NodeAgentCommonFields.DeepCopyInto(&out.NodeAgentCommonFields) -} - // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAgentConfig. func (in *NodeAgentConfig) DeepCopy() *NodeAgentConfig { if in == nil { @@ -545,22 +524,6 @@ func (in *PodConfig) DeepCopy() *PodConfig { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResticConfig) DeepCopyInto(out *ResticConfig) { - *out = *in - in.NodeAgentCommonFields.DeepCopyInto(&out.NodeAgentCommonFields) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResticConfig. -func (in *ResticConfig) DeepCopy() *ResticConfig { - if in == nil { - return nil - } - out := new(ResticConfig) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RetainPolicy) DeepCopyInto(out *RetainPolicy) { *out = *in diff --git a/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml b/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml index 89d8bbceda3..f916ff1a747 100644 --- a/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml +++ b/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml @@ -321,166 +321,6 @@ spec: required: - uploaderType type: object - restic: - description: (deprecation warning) ResticConfig is the configuration for restic DaemonSet. restic is for backwards compatibility and is replaced by the nodeAgent restic will be removed with the OADP 1.4 - properties: - enable: - description: enable defines a boolean pointer whether we want the daemonset to exist or not - type: boolean - podConfig: - description: Pod specific configuration - properties: - env: - description: env defines the list of environment variables to be supplied to podSpec - items: - description: EnvVar represents an environment variable present in a Container. - properties: - name: - description: Name of the environment variable. Must be a C_IDENTIFIER. - type: string - value: - 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 "".' - type: string - valueFrom: - description: Source for the environment variable's value. Cannot be used if value is not empty. - properties: - configMapKeyRef: - description: Selects a key of a ConfigMap. - properties: - key: - description: The key to select. - type: string - name: - 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?' - type: string - optional: - description: Specify whether the ConfigMap or its key must be defined - type: boolean - required: - - key - type: object - fieldRef: - description: 'Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['''']`, `metadata.annotations['''']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.' - properties: - apiVersion: - description: Version of the schema the FieldPath is written in terms of, defaults to "v1". - type: string - fieldPath: - description: Path of the field to select in the specified API version. - type: string - required: - - fieldPath - type: object - resourceFieldRef: - 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.' - properties: - containerName: - description: 'Container name: required for volumes, optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format of the exposed resources, defaults to "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - secretKeyRef: - description: Selects a key of a secret in the pod's namespace - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - 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?' - type: string - optional: - description: Specify whether the Secret or its key must be defined - type: boolean - required: - - key - type: object - type: object - required: - - name - type: object - type: array - labels: - additionalProperties: - type: string - description: labels to add to pods - type: object - nodeSelector: - additionalProperties: - type: string - description: nodeSelector defines the nodeSelector to be supplied to podSpec - type: object - resourceAllocations: - description: resourceAllocations defines the CPU and Memory resource allocations for the Pod - nullable: true - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - nullable: true - description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' - type: object - nullable: true - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - nullable: true - 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/' - type: object - nullable: true - type: object - tolerations: - description: tolerations defines the list of tolerations to be applied to daemonset - items: - description: The pod this Toleration is attached to tolerates any taint that matches the triple using the matching operator . - properties: - effect: - description: Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. - type: string - key: - 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. - type: string - operator: - 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. - type: string - tolerationSeconds: - 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. - format: int64 - type: integer - value: - 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. - type: string - type: object - type: array - type: object - supplementalGroups: - description: supplementalGroups defines the linux groups to be applied to the NodeAgent Pod - items: - format: int64 - type: integer - type: array - timeout: - description: timeout defines the NodeAgent timeout, default value is 1h - type: string - type: object velero: properties: args: diff --git a/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml b/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml index 89d8bbceda3..f916ff1a747 100644 --- a/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml +++ b/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml @@ -321,166 +321,6 @@ spec: required: - uploaderType type: object - restic: - description: (deprecation warning) ResticConfig is the configuration for restic DaemonSet. restic is for backwards compatibility and is replaced by the nodeAgent restic will be removed with the OADP 1.4 - properties: - enable: - description: enable defines a boolean pointer whether we want the daemonset to exist or not - type: boolean - podConfig: - description: Pod specific configuration - properties: - env: - description: env defines the list of environment variables to be supplied to podSpec - items: - description: EnvVar represents an environment variable present in a Container. - properties: - name: - description: Name of the environment variable. Must be a C_IDENTIFIER. - type: string - value: - 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 "".' - type: string - valueFrom: - description: Source for the environment variable's value. Cannot be used if value is not empty. - properties: - configMapKeyRef: - description: Selects a key of a ConfigMap. - properties: - key: - description: The key to select. - type: string - name: - 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?' - type: string - optional: - description: Specify whether the ConfigMap or its key must be defined - type: boolean - required: - - key - type: object - fieldRef: - description: 'Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['''']`, `metadata.annotations['''']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.' - properties: - apiVersion: - description: Version of the schema the FieldPath is written in terms of, defaults to "v1". - type: string - fieldPath: - description: Path of the field to select in the specified API version. - type: string - required: - - fieldPath - type: object - resourceFieldRef: - 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.' - properties: - containerName: - description: 'Container name: required for volumes, optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format of the exposed resources, defaults to "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - secretKeyRef: - description: Selects a key of a secret in the pod's namespace - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - 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?' - type: string - optional: - description: Specify whether the Secret or its key must be defined - type: boolean - required: - - key - type: object - type: object - required: - - name - type: object - type: array - labels: - additionalProperties: - type: string - description: labels to add to pods - type: object - nodeSelector: - additionalProperties: - type: string - description: nodeSelector defines the nodeSelector to be supplied to podSpec - type: object - resourceAllocations: - description: resourceAllocations defines the CPU and Memory resource allocations for the Pod - nullable: true - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - nullable: true - description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' - type: object - nullable: true - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - nullable: true - 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/' - type: object - nullable: true - type: object - tolerations: - description: tolerations defines the list of tolerations to be applied to daemonset - items: - description: The pod this Toleration is attached to tolerates any taint that matches the triple using the matching operator . - properties: - effect: - description: Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. - type: string - key: - 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. - type: string - operator: - 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. - type: string - tolerationSeconds: - 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. - format: int64 - type: integer - value: - 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. - type: string - type: object - type: array - type: object - supplementalGroups: - description: supplementalGroups defines the linux groups to be applied to the NodeAgent Pod - items: - format: int64 - type: integer - type: array - timeout: - description: timeout defines the NodeAgent timeout, default value is 1h - type: string - type: object velero: properties: args: diff --git a/controllers/nodeagent.go b/controllers/nodeagent.go index f74b14753f4..8ff945b15cc 100644 --- a/controllers/nodeagent.go +++ b/controllers/nodeagent.go @@ -91,16 +91,7 @@ func (r *DPAReconciler) ReconcileNodeAgentDaemonset(log logr.Logger) (bool, erro ObjectMeta: getNodeAgentObjectMeta(r), } - if dpa.Spec.Configuration.Restic != nil { - // V(-1) corresponds to the warn level - var deprecationMsg string = "(Deprecation Warning) Use nodeAgent instead of restic, which is deprecated and will be removed with the OADP 1.4" - log.V(-1).Info(deprecationMsg) - r.EventRecorder.Event(&dpa, corev1.EventTypeWarning, "DeprecationResticConfig", deprecationMsg) - } - - if dpa.Spec.Configuration.Restic != nil && dpa.Spec.Configuration.Restic.Enable != nil && *dpa.Spec.Configuration.Restic.Enable { - deleteDaemonSet = false - } else if dpa.Spec.Configuration.NodeAgent != nil && dpa.Spec.Configuration.NodeAgent.Enable != nil && *dpa.Spec.Configuration.NodeAgent.Enable { + if dpa.Spec.Configuration.NodeAgent != nil && dpa.Spec.Configuration.NodeAgent.Enable != nil && *dpa.Spec.Configuration.NodeAgent.Enable { deleteDaemonSet = false } @@ -207,9 +198,7 @@ func (r *DPAReconciler) buildNodeAgentDaemonset(dpa *oadpv1alpha1.DataProtection // get resource requirements for nodeAgent ds // ignoring err here as it is checked in validator.go - if dpa.Spec.Configuration.Restic != nil { - nodeAgentResourceReqs, _ = getResticResourceReqs(dpa) - } else if dpa.Spec.Configuration.NodeAgent != nil { + if dpa.Spec.Configuration.NodeAgent != nil { nodeAgentResourceReqs, _ = getNodeAgentResourceReqs(dpa) } else { return nil, fmt.Errorf("NodeAgent or Restic configuration cannot be nil") @@ -238,24 +227,14 @@ func (r *DPAReconciler) buildNodeAgentDaemonset(dpa *oadpv1alpha1.DataProtection } func (r *DPAReconciler) customizeNodeAgentDaemonset(dpa *oadpv1alpha1.DataProtectionApplication, ds *appsv1.DaemonSet) (*appsv1.DaemonSet, error) { - if dpa.Spec.Configuration == nil || (dpa.Spec.Configuration.Restic == nil && dpa.Spec.Configuration.NodeAgent == nil) { - // if restic and nodeAgent are not configured, therefore not enabled, return early. + if dpa.Spec.Configuration == nil || dpa.Spec.Configuration.NodeAgent == nil { + // if nodeAgent is not configured, therefore not enabled, return early. return nil, nil } - var useResticConf bool = true - - if dpa.Spec.Configuration.NodeAgent != nil { - useResticConf = false - } - // add custom pod labels var err error - if useResticConf { - if dpa.Spec.Configuration.Restic.PodConfig != nil && dpa.Spec.Configuration.Restic.PodConfig.Labels != nil { - ds.Spec.Template.Labels, err = common.AppendUniqueKeyTOfTMaps(ds.Spec.Template.Labels, dpa.Spec.Configuration.Restic.PodConfig.Labels) - } - } else if dpa.Spec.Configuration.NodeAgent.PodConfig != nil && dpa.Spec.Configuration.NodeAgent.PodConfig.Labels != nil { + if dpa.Spec.Configuration.NodeAgent.PodConfig != nil && dpa.Spec.Configuration.NodeAgent.PodConfig.Labels != nil { ds.Spec.Template.Labels, err = common.AppendUniqueKeyTOfTMaps(ds.Spec.Template.Labels, dpa.Spec.Configuration.NodeAgent.PodConfig.Labels) } if err != nil { @@ -269,16 +248,9 @@ func (r *DPAReconciler) customizeNodeAgentDaemonset(dpa *oadpv1alpha1.DataProtec } // customize template specs - if useResticConf { - ds.Spec.Template.Spec.SecurityContext = &corev1.PodSecurityContext{ - RunAsUser: pointer.Int64(0), - SupplementalGroups: dpa.Spec.Configuration.Restic.SupplementalGroups, - } - } else { - ds.Spec.Template.Spec.SecurityContext = &corev1.PodSecurityContext{ - RunAsUser: pointer.Int64(0), - SupplementalGroups: dpa.Spec.Configuration.NodeAgent.SupplementalGroups, - } + ds.Spec.Template.Spec.SecurityContext = &corev1.PodSecurityContext{ + RunAsUser: pointer.Int64(0), + SupplementalGroups: dpa.Spec.Configuration.NodeAgent.SupplementalGroups, } // append certs volume @@ -298,12 +270,7 @@ func (r *DPAReconciler) customizeNodeAgentDaemonset(dpa *oadpv1alpha1.DataProtec } // Update with any pod config values - if useResticConf { - if dpa.Spec.Configuration.Restic.PodConfig != nil { - ds.Spec.Template.Spec.Tolerations = dpa.Spec.Configuration.Restic.PodConfig.Tolerations - ds.Spec.Template.Spec.NodeSelector = dpa.Spec.Configuration.Restic.PodConfig.NodeSelector - } - } else if dpa.Spec.Configuration.NodeAgent.PodConfig != nil { + if dpa.Spec.Configuration.NodeAgent.PodConfig != nil { ds.Spec.Template.Spec.Tolerations = dpa.Spec.Configuration.NodeAgent.PodConfig.Tolerations ds.Spec.Template.Spec.NodeSelector = dpa.Spec.Configuration.NodeAgent.PodConfig.NodeSelector } @@ -324,11 +291,7 @@ func (r *DPAReconciler) customizeNodeAgentDaemonset(dpa *oadpv1alpha1.DataProtec MountPath: "/etc/ssl/certs", }) // append PodConfig envs to nodeAgent container - if useResticConf { - if dpa.Spec.Configuration.Restic.PodConfig != nil && dpa.Spec.Configuration.Restic.PodConfig.Env != nil { - nodeAgentContainer.Env = common.AppendUniqueEnvVars(nodeAgentContainer.Env, dpa.Spec.Configuration.Restic.PodConfig.Env) - } - } else if dpa.Spec.Configuration.NodeAgent.PodConfig != nil && dpa.Spec.Configuration.NodeAgent.PodConfig.Env != nil { + if dpa.Spec.Configuration.NodeAgent.PodConfig != nil && dpa.Spec.Configuration.NodeAgent.PodConfig.Env != nil { nodeAgentContainer.Env = common.AppendUniqueEnvVars(nodeAgentContainer.Env, dpa.Spec.Configuration.NodeAgent.PodConfig.Env) } diff --git a/controllers/nodeagent_test.go b/controllers/nodeagent_test.go index 3759367607e..ceb35090d92 100644 --- a/controllers/nodeagent_test.go +++ b/controllers/nodeagent_test.go @@ -88,9 +88,7 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - }, + PodConfig: &oadpv1alpha1.PodConfig{}, UploaderType: "", }, }, @@ -127,8 +125,7 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{}, - UploaderType: "", + UploaderType: "", }, Velero: &oadpv1alpha1.VeleroConfig{ PodConfig: &oadpv1alpha1.PodConfig{}, @@ -274,13 +271,11 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - Env: []corev1.EnvVar{ - { - Name: "TEST_ENV", - Value: "TEST_VALUE", - }, + PodConfig: &oadpv1alpha1.PodConfig{ + Env: []corev1.EnvVar{ + { + Name: "TEST_ENV", + Value: "TEST_VALUE", }, }, }, @@ -434,11 +429,9 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - Labels: map[string]string{ - "nodeAgentLabel": "this is a label", - }, + PodConfig: &oadpv1alpha1.PodConfig{ + Labels: map[string]string{ + "nodeAgentLabel": "this is a label", }, }, UploaderType: "", @@ -592,11 +585,9 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - Labels: map[string]string{ - "name": "not-node-agent", // this label is already defined by https://github.com/openshift/velero/blob/8b2f7dbdb510434b9c05180bae7a3fb2a8081e2f/pkg/install/daemonset.go#L71 - }, + PodConfig: &oadpv1alpha1.PodConfig{ + Labels: map[string]string{ + "name": "not-node-agent", // this label is already defined by https://github.com/openshift/velero/blob/8b2f7dbdb510434b9c05180bae7a3fb2a8081e2f/pkg/install/daemonset.go#L71 }, }, UploaderType: "", @@ -624,11 +615,9 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - NodeSelector: map[string]string{ - "foo": "bar", - }, + PodConfig: &oadpv1alpha1.PodConfig{ + NodeSelector: map[string]string{ + "foo": "bar", }, }, UploaderType: "", @@ -798,20 +787,18 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - NodeSelector: map[string]string{ - "foo": "bar", - }, - ResourceAllocations: corev1.ResourceRequirements{ - Limits: corev1.ResourceList{ - corev1.ResourceCPU: resource.MustParse("2"), - corev1.ResourceMemory: resource.MustParse("128Mi"), - }, - Requests: corev1.ResourceList{ - corev1.ResourceCPU: resource.MustParse("1"), - corev1.ResourceMemory: resource.MustParse("256Mi"), - }, + PodConfig: &oadpv1alpha1.PodConfig{ + NodeSelector: map[string]string{ + "foo": "bar", + }, + ResourceAllocations: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("2"), + corev1.ResourceMemory: resource.MustParse("128Mi"), + }, + Requests: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("1"), + corev1.ResourceMemory: resource.MustParse("256Mi"), }, }, }, @@ -986,15 +973,13 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - NodeSelector: map[string]string{ - "foo": "bar", - }, - ResourceAllocations: corev1.ResourceRequirements{ - Limits: corev1.ResourceList{ - corev1.ResourceCPU: resource.MustParse("2"), - }, + PodConfig: &oadpv1alpha1.PodConfig{ + NodeSelector: map[string]string{ + "foo": "bar", + }, + ResourceAllocations: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("2"), }, }, }, @@ -1168,15 +1153,13 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - NodeSelector: map[string]string{ - "foo": "bar", - }, - ResourceAllocations: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceCPU: resource.MustParse("2"), - }, + PodConfig: &oadpv1alpha1.PodConfig{ + NodeSelector: map[string]string{ + "foo": "bar", + }, + ResourceAllocations: corev1.ResourceRequirements{ + Requests: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("2"), }, }, }, @@ -1347,15 +1330,13 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - NodeSelector: map[string]string{ - "foo": "bar", - }, - ResourceAllocations: corev1.ResourceRequirements{ - Limits: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("256Mi"), - }, + PodConfig: &oadpv1alpha1.PodConfig{ + NodeSelector: map[string]string{ + "foo": "bar", + }, + ResourceAllocations: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceMemory: resource.MustParse("256Mi"), }, }, }, @@ -1529,15 +1510,13 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - NodeSelector: map[string]string{ - "foo": "bar", - }, - ResourceAllocations: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceMemory: resource.MustParse("256Mi"), - }, + PodConfig: &oadpv1alpha1.PodConfig{ + NodeSelector: map[string]string{ + "foo": "bar", + }, + ResourceAllocations: corev1.ResourceRequirements{ + Requests: corev1.ResourceList{ + corev1.ResourceMemory: resource.MustParse("256Mi"), }, }, }, @@ -1708,15 +1687,13 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - Tolerations: []v1.Toleration{ - { - Key: "key1", - Operator: "Equal", - Value: "value1", - Effect: "NoSchedule", - }, + PodConfig: &oadpv1alpha1.PodConfig{ + Tolerations: []v1.Toleration{ + { + Key: "key1", + Operator: "Equal", + Value: "value1", + Effect: "NoSchedule", }, }, }, @@ -1891,9 +1868,7 @@ func TestDPAReconciler_buildNodeAgentDaemonset(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ NodeAgent: &oadpv1alpha1.NodeAgentConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - }, + PodConfig: &oadpv1alpha1.PodConfig{}, UploaderType: "", }, Velero: &oadpv1alpha1.VeleroConfig{ diff --git a/controllers/validator.go b/controllers/validator.go index 3ca0a6331f2..faa3f1808a8 100644 --- a/controllers/validator.go +++ b/controllers/validator.go @@ -23,10 +23,6 @@ func (r *DPAReconciler) ValidateDataProtectionCR(log logr.Logger) (bool, error) return false, errors.New("DPA CR Velero configuration cannot be nil") } - if dpa.Spec.Configuration.Restic != nil && dpa.Spec.Configuration.NodeAgent != nil { - return false, errors.New("DPA CR cannot have restic (deprecated in OADP 1.3) as well as nodeAgent options at the same time") - } - if dpa.Spec.Configuration.Velero.NoDefaultBackupLocation { if len(dpa.Spec.BackupLocations) != 0 { return false, errors.New("DPA CR Velero configuration cannot have backup locations if noDefaultBackupLocation is set") @@ -100,9 +96,6 @@ func (r *DPAReconciler) ValidateDataProtectionCR(log logr.Logger) (bool, error) return false, err } - if _, err := getResticResourceReqs(&dpa); err != nil { - return false, err - } if validBsl, err := r.ValidateBackupStorageLocations(dpa); !validBsl || err != nil { return validBsl, err } diff --git a/controllers/validator_test.go b/controllers/validator_test.go index d5f6c0b7e41..e8497c02188 100644 --- a/controllers/validator_test.go +++ b/controllers/validator_test.go @@ -331,16 +331,15 @@ func TestDPAReconciler_ValidateDataProtectionCR(t *testing.T) { }, }, }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - ResourceAllocations: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceCPU: resource.MustParse("2"), - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{ + ResourceAllocations: corev1.ResourceRequirements{ + Requests: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("2"), }, }, }, + UploaderType: "restic", }, }, BackupImages: pointer.Bool(false), diff --git a/controllers/velero.go b/controllers/velero.go index ca5e18430cf..71b4a041a58 100644 --- a/controllers/velero.go +++ b/controllers/velero.go @@ -438,9 +438,6 @@ func (r *DPAReconciler) customizeVeleroContainer(dpa *oadpv1alpha1.DataProtectio } func getFsBackupTimeout(dpa *oadpv1alpha1.DataProtectionApplication) string { - if dpa.Spec.Configuration.Restic != nil && len(dpa.Spec.Configuration.Restic.Timeout) > 0 { - return dpa.Spec.Configuration.Restic.Timeout - } if dpa.Spec.Configuration.NodeAgent != nil && len(dpa.Spec.Configuration.NodeAgent.Timeout) > 0 { return dpa.Spec.Configuration.NodeAgent.Timeout } @@ -556,62 +553,6 @@ func (r *DPAReconciler) getVeleroResourceReqs(dpa *oadpv1alpha1.DataProtectionAp return ResourcesReqs, nil } -// Get Restic Resource Requirements -func getResticResourceReqs(dpa *oadpv1alpha1.DataProtectionApplication) (corev1.ResourceRequirements, error) { - - // Set default values - ResourcesReqs := corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceCPU: resource.MustParse("500m"), - corev1.ResourceMemory: resource.MustParse("128Mi"), - }, - } - - if dpa != nil && dpa.Spec.Configuration != nil && dpa.Spec.Configuration.Restic != nil && dpa.Spec.Configuration.Restic.PodConfig != nil { - // Set custom limits and requests values if defined on Restic Spec - if dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Requests.Cpu() != nil && dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Requests.Cpu().Value() != 0 { - parsedQuantity, err := resource.ParseQuantity(dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Requests.Cpu().String()) - ResourcesReqs.Requests[corev1.ResourceCPU] = parsedQuantity - if err != nil { - return ResourcesReqs, err - } - } - - if dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Requests.Memory() != nil && dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Requests.Memory().Value() != 0 { - parsedQuantity, err := resource.ParseQuantity(dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Requests.Memory().String()) - ResourcesReqs.Requests[corev1.ResourceMemory] = parsedQuantity - if err != nil { - return ResourcesReqs, err - } - } - - if dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Limits.Cpu() != nil && dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Limits.Cpu().Value() != 0 { - if ResourcesReqs.Limits == nil { - ResourcesReqs.Limits = corev1.ResourceList{} - } - parsedQuantity, err := resource.ParseQuantity(dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Limits.Cpu().String()) - ResourcesReqs.Limits[corev1.ResourceCPU] = parsedQuantity - if err != nil { - return ResourcesReqs, err - } - } - - if dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Limits.Memory() != nil && dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Limits.Memory().Value() != 0 { - if ResourcesReqs.Limits == nil { - ResourcesReqs.Limits = corev1.ResourceList{} - } - parsedQuantiy, err := resource.ParseQuantity(dpa.Spec.Configuration.Restic.PodConfig.ResourceAllocations.Limits.Memory().String()) - ResourcesReqs.Limits[corev1.ResourceMemory] = parsedQuantiy - if err != nil { - return ResourcesReqs, err - } - } - - } - - return ResourcesReqs, nil -} - // Get NodeAgent Resource Requirements // Separate function to getResticResourceReqs, so once Restic config is removed in OADP 1.4+ // It will be easier to delete obsolete getResticResourceReqs diff --git a/tests/e2e/dpa_deployment_suite_test.go b/tests/e2e/dpa_deployment_suite_test.go index db7e8b31fe4..3a571d2a8c4 100644 --- a/tests/e2e/dpa_deployment_suite_test.go +++ b/tests/e2e/dpa_deployment_suite_test.go @@ -137,11 +137,7 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { Eventually(VerifyVeleroResourceLimits(kubernetesClientForSuiteRun, namespace, dpa.Spec.Configuration.Velero.PodConfig.ResourceAllocations.Limits), timeoutMultiplier*time.Minute*3, time.Second*5).Should(BeTrue()) } - //restic installation with new and deprecated options - if dpa.Spec.Configuration.Restic != nil && *dpa.Spec.Configuration.Restic.Enable { - log.Printf("Waiting for restic pods to be running") - Eventually(AreNodeAgentPodsRunning(kubernetesClientForSuiteRun, namespace), timeoutMultiplier*time.Minute*4, time.Second*5).Should(BeTrue()) - } else if dpa.Spec.Configuration.NodeAgent != nil && *dpa.Spec.Configuration.NodeAgent.Enable { + if dpa.Spec.Configuration.NodeAgent != nil && *dpa.Spec.Configuration.NodeAgent.Enable { log.Printf("Waiting for NodeAgent pods to be running") Eventually(AreNodeAgentPodsRunning(kubernetesClientForSuiteRun, namespace), timeoutMultiplier*time.Minute*4, time.Second*5).Should(BeTrue()) } else { @@ -167,13 +163,6 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { } } - log.Printf("Waiting for restic daemonSet to have nodeSelector") - if dpa.Spec.Configuration.Restic != nil && dpa.Spec.Configuration.Restic.PodConfig != nil { - for key, value := range dpa.Spec.Configuration.Restic.PodConfig.NodeSelector { - log.Printf("Waiting for restic daemonSet to get node selector") - Eventually(NodeAgentDaemonSetHasNodeSelector(kubernetesClientForSuiteRun, namespace, key, value), timeoutMultiplier*time.Minute*6, time.Second*5).Should(BeTrue()) - } - } log.Printf("Waiting for nodeAgent daemonSet to have nodeSelector") if dpa.Spec.Configuration.NodeAgent != nil && dpa.Spec.Configuration.NodeAgent.PodConfig != nil { for key, value := range dpa.Spec.Configuration.NodeAgent.PodConfig.NodeSelector { @@ -206,11 +195,10 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { DefaultPlugins: Dpa.Spec.Configuration.Velero.DefaultPlugins, PodConfig: &oadpv1alpha1.PodConfig{}, }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - Enable: pointer.Bool(true), - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{}, + Enable: pointer.Bool(true), + UploaderType: "restic", }, }, BackupLocations: []oadpv1alpha1.BackupLocation{ @@ -242,11 +230,10 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { DefaultPlugins: Dpa.Spec.Configuration.Velero.DefaultPlugins, PodConfig: &oadpv1alpha1.PodConfig{}, }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - Enable: pointer.Bool(true), - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{}, + Enable: pointer.Bool(true), + UploaderType: "restic", }, }, BackupLocations: []oadpv1alpha1.BackupLocation{ @@ -285,11 +272,10 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { }, }, }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - Enable: pointer.Bool(false), - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{}, + Enable: pointer.Bool(false), + UploaderType: "restic", }, }, BackupImages: pointer.Bool(false), @@ -334,11 +320,10 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { oadpv1alpha1.DefaultPluginCSI, }, Dpa.Spec.Configuration.Velero.DefaultPlugins...), }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - Enable: pointer.Bool(false), - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{}, + Enable: pointer.Bool(false), + UploaderType: "restic", }, }, BackupImages: pointer.Bool(false), @@ -382,11 +367,10 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { }(), }, }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - Enable: pointer.Bool(false), - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{}, + Enable: pointer.Bool(false), + UploaderType: "restic", }, }, BackupImages: pointer.Bool(false), @@ -418,11 +402,10 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { PodConfig: &oadpv1alpha1.PodConfig{}, DefaultPlugins: Dpa.Spec.Configuration.Velero.DefaultPlugins, }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - Enable: pointer.Bool(true), - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{}, + Enable: pointer.Bool(true), + UploaderType: "restic", }, }, SnapshotLocations: Dpa.Spec.SnapshotLocations, @@ -454,11 +437,10 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { PodConfig: &oadpv1alpha1.PodConfig{}, DefaultPlugins: Dpa.Spec.Configuration.Velero.DefaultPlugins, }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - Enable: pointer.Bool(false), - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{}, + Enable: pointer.Bool(false), + UploaderType: "restic", }, }, BackupLocations: []oadpv1alpha1.BackupLocation{ @@ -491,11 +473,10 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { oadpv1alpha1.DefaultPluginCSI, }, Dpa.Spec.Configuration.Velero.DefaultPlugins...), }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - Enable: pointer.Bool(false), - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{}, + Enable: pointer.Bool(false), + UploaderType: "restic", }, }, BackupLocations: []oadpv1alpha1.BackupLocation{ @@ -542,15 +523,14 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { PodConfig: &oadpv1alpha1.PodConfig{}, DefaultPlugins: Dpa.Spec.Configuration.Velero.DefaultPlugins, }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - NodeSelector: map[string]string{ - "foo": "bar", - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{ + NodeSelector: map[string]string{ + "foo": "bar", }, - Enable: pointer.Bool(true), }, + Enable: pointer.Bool(true), + UploaderType: "restic", }, }, }, @@ -581,20 +561,19 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { PodConfig: &oadpv1alpha1.PodConfig{}, DefaultPlugins: Dpa.Spec.Configuration.Velero.DefaultPlugins, }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{ - Tolerations: []corev1.Toleration{ - { - Key: "node.kubernetes.io/unreachable", - Operator: "Exists", - Effect: "NoExecute", - TolerationSeconds: func(i int64) *int64 { return &i }(6000), - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{ + Tolerations: []corev1.Toleration{ + { + Key: "node.kubernetes.io/unreachable", + Operator: "Exists", + Effect: "NoExecute", + TolerationSeconds: func(i int64) *int64 { return &i }(6000), }, }, - Enable: pointer.Bool(true), }, + Enable: pointer.Bool(true), + UploaderType: "restic", }, }, }, @@ -610,11 +589,10 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() { NoDefaultBackupLocation: true, DefaultPlugins: Dpa.Spec.Configuration.Velero.DefaultPlugins, }, - Restic: &oadpv1alpha1.ResticConfig{ - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - Enable: pointer.Bool(true), - }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + PodConfig: &oadpv1alpha1.PodConfig{}, + Enable: pointer.Bool(true), + UploaderType: "restic", }, }, BackupImages: pointer.Bool(false), diff --git a/tests/e2e/lib/dpa_helpers.go b/tests/e2e/lib/dpa_helpers.go index 855dfb93941..f20aa65d3d5 100755 --- a/tests/e2e/lib/dpa_helpers.go +++ b/tests/e2e/lib/dpa_helpers.go @@ -74,9 +74,7 @@ func (v *DpaCustomResource) Build(backupRestoreType BackupRestoreType) error { }, NodeAgent: &oadpv1alpha1.NodeAgentConfig{ UploaderType: "kopia", - NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{ - PodConfig: &oadpv1alpha1.PodConfig{}, - }, + PodConfig: &oadpv1alpha1.PodConfig{}, }, }, SnapshotLocations: v.CustomResource.Spec.SnapshotLocations,