Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OADP-5158: Do not allow restic config use in OADP 1.5+; Deprecate restic for file system backups #1235

Conversation

mateusoliveira43
Copy link
Contributor

@mateusoliveira43 mateusoliveira43 commented Nov 22, 2023

Description

This PR removes logic of using old restic field (it should use nodeAgent field instead) from 1.5+ code. But it does not remove old restic field from DPA (which should only be removed when DPA version is updated), for a safe upgrade and better user experience for the users.

Also, log a Deprecation Warning when using restic in NodeAgent config.

How to test

OADP 1.5

run make deploy-olm and test that

  • DPA is Reconciled false if old restic field (spec.configuration.restic) is present
  • OADP manager pod has 1 warning log and OADP namespace has 1 warning event if DPA spec.configuration.nodeAgent.uploaderType is set to restic

Simulate a upgrade

Simulate a upgrade from OADP 1.4 to 1.5 (this PR branch), by

  • running make catalog-test-upgrade
  • installing OADP 1.4
  • creating a DPA with old restic field (wait until it is reconciled true)
  • and update to OADP 1.5

More info

Update should finish successfully and DPA should:

  • be reconciled false, with the error message that restic field is not allowed
  • restic fields should be still in DPA

@mateusoliveira43 mateusoliveira43 force-pushed the fix/remove-restic-config-master branch from 1587d2c to 7f9b1e9 Compare November 30, 2023 16:22
@mateusoliveira43

This comment was marked as outdated.

mpryc

This comment was marked as outdated.

@mateusoliveira43

This comment was marked as outdated.

@mateusoliveira43

This comment was marked as outdated.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 6, 2023
@mateusoliveira43

This comment was marked as outdated.

@mpryc

This comment was marked as outdated.

@shawn-hurley

This comment was marked as outdated.

@kaovilai

This comment was marked as outdated.

@kaovilai

This comment was marked as outdated.

@mateusoliveira43

This comment was marked as outdated.

@shawn-hurley

This comment was marked as outdated.

@mateusoliveira43 mateusoliveira43 changed the title fix: Remove restic config from master branch fix: Do not allow restic config use for master branch (OADP 1.4) Jan 4, 2024
@shawn-hurley

This comment was marked as outdated.

@kaovilai

This comment was marked as outdated.

@mateusoliveira43 mateusoliveira43 changed the title fix: Do not allow restic config use for master branch (OADP 1.4) fix: Do not allow restic config use in OADP 1.4+ Jan 16, 2024
@mateusoliveira43

This comment was marked as outdated.

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 20, 2024
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 10, 2024
@openshift-bot

This comment was marked as outdated.

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 10, 2024
@mateusoliveira43

This comment was marked as outdated.

@openshift-ci openshift-ci bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 10, 2024
@openshift-bot

This comment was marked as outdated.

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 18, 2024
@mateusoliveira43 mateusoliveira43 changed the title fix: Do not allow restic config use in OADP 1.5+ OADP-5158: Do not allow restic config use in OADP 1.5+ Jan 2, 2025
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 2, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 2, 2025

@mateusoliveira43: This pull request references OADP-5158 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.19.0" version, but no target version was set.

In response to this:

Description

This PR removes logic of using old restic field (it should use nodeAgent field instead) from 1.5+ code. But it does not remove old restic field from DPA (which should only be removed when DPA version is updated), for a safe upgrade and better user experience for the users.

Also, log a Deprecation Warning when using restic in NodeAgent config.

How to test

Simulate a upgrade from OADP 1.4 to 1.5 (this PR branch), by

  • running make catalog-test-upgrade
  • installing OADP 1.4
  • creating a DPA with old restic field (wait until it is reconciled true)
  • and update to OADP 1.5

More info

Update should finish successfully and DPA should:

  • be reconciled false, with the error message that restic field is not allowed
  • restic fields should be still in DPA

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@mateusoliveira43

This comment was marked as resolved.

@openshift-ci openshift-ci bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 2, 2025
@mateusoliveira43 mateusoliveira43 changed the title OADP-5158: Do not allow restic config use in OADP 1.5+ OADP-5158: Do not allow restic config use in OADP 1.5+; Deprecate restic for file system backups Jan 2, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 2, 2025

@mateusoliveira43: This pull request references OADP-5158 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.19.0" version, but no target version was set.

In response to this:

Description

This PR removes logic of using old restic field (it should use nodeAgent field instead) from 1.5+ code. But it does not remove old restic field from DPA (which should only be removed when DPA version is updated), for a safe upgrade and better user experience for the users.

Also, log a Deprecation Warning when using restic in NodeAgent config.

How to test

OADP 1.5

run make deploy-olm and test that

  • DPA is Reconciled false if old restic field (spec.configuration.restic) is present
  • OADP manager pod has 1 warning log and OADP namespace has 1 warning event if DPA spec.configuration.nodeAgent.uploaderType is set to restic

Simulate a upgrade

Simulate a upgrade from OADP 1.4 to 1.5 (this PR branch), by

  • running make catalog-test-upgrade
  • installing OADP 1.4
  • creating a DPA with old restic field (wait until it is reconciled true)
  • and update to OADP 1.5

More info

Update should finish successfully and DPA should:

  • be reconciled false, with the error message that restic field is not allowed
  • restic fields should be still in DPA

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@mateusoliveira43 mateusoliveira43 marked this pull request as ready for review January 3, 2025 13:42
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 3, 2025
@openshift-ci openshift-ci bot requested a review from weshayutin January 3, 2025 13:42
@mateusoliveira43 mateusoliveira43 force-pushed the fix/remove-restic-config-master branch from 6c5473d to cbd019d Compare January 21, 2025 12:27
// restic is for backwards compatibility and is replaced by the nodeAgent
// restic will be removed in the future
// +kubebuilder:deprecatedversion:warning=1.3
// (do not use warning) restic field is for backwards compatibility and

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/field/spec at both places

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sold on this. Changing to spec would not pass sense that restic is an CR instead of part of DPA spec?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 I like field. alternatively spec field.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or better yet..

Suggested change
// (do not use warning) restic field is for backwards compatibility and
// (do not use warning) restic config is for backwards compatibility and

// check for VSM/Volsync DataMover (OADP 1.2 or below) syntax
if r.dpa.Spec.Features != nil && r.dpa.Spec.Features.DataMover != nil {
return false, errors.New("Delete vsm from spec.configuration.velero.defaultPlugins and dataMover object from spec.features. Use Velero Built-in Data Mover instead")
}

// check for ResticConfig (OADP 1.4 or below) syntax
if r.dpa.Spec.Configuration.Restic != nil {
return false, errors.New("Delete restic object from spec.configuration, use spec.configuration.nodeAgent instead")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/object/spec

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sold on this. Changing to spec would not pass sense that restic is an CR instead of part of DPA spec?

@@ -16,6 +17,8 @@ import (
"github.com/openshift/oadp-operator/pkg/credentials"
)

var wasRestic bool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we explicitly set this as false ? (I think default is false but still)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do, it would fail https://revive.run/r#var-declaration linter that was recently merged https://github.com/vmware-tanzu/velero/pull/8636/files#diff-9917ddc9f1c3304218f7269265b746d997c5c0615478177b5fceecd33ef47cb5
specifically because we are declaring "zeroLiteral"

var zeroLiteral = map[string]bool{
	"false": true, // bool
	// runes
	`'\x00'`: true,
	`'\000'`: true,
	// strings
	`""`: true,
	"``": true,
	// numerics
	"0":   true,
	"0.":  true,
	"0.0": true,
	"0i":  true,
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im ok with it either way.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 3, 2025
Signed-off-by: Mateus Oliveira <[email protected]>
@mateusoliveira43 mateusoliveira43 force-pushed the fix/remove-restic-config-master branch from cbd019d to 1839dbc Compare March 6, 2025 18:43
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 6, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 6, 2025

@mateusoliveira43: This pull request references OADP-5158 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.19.0" version, but no target version was set.

In response to this:

Description

This PR removes logic of using old restic field (it should use nodeAgent field instead) from 1.5+ code. But it does not remove old restic field from DPA (which should only be removed when DPA version is updated), for a safe upgrade and better user experience for the users.

Also, log a Deprecation Warning when using restic in NodeAgent config.

How to test

OADP 1.5

run make deploy-olm and test that

  • DPA is Reconciled false if old restic field (spec.configuration.restic) is present
  • OADP manager pod has 1 warning log and OADP namespace has 1 warning event if DPA spec.configuration.nodeAgent.uploaderType is set to restic

Simulate a upgrade

Simulate a upgrade from OADP 1.4 to 1.5 (this PR branch), by

  • running make catalog-test-upgrade
  • installing OADP 1.4
  • creating a DPA with old restic field (wait until it is reconciled true)
  • and update to OADP 1.5

More info

Update should finish successfully and DPA should:

  • be reconciled false, with the error message that restic field is not allowed
  • restic fields should be still in DPA

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Signed-off-by: Mateus Oliveira <[email protected]>
@weshayutin
Copy link
Contributor

toying around adding and removing the config.restic.enabled true/false and clearing the whole thing.
LGTM. I think we can save upgrade testing for QE

status:
  conditions:
    - lastTransitionTime: '2025-03-06T21:21:17Z'
      message: 'Delete restic object from spec.configuration, use spec.configuration.nodeAgent instead'
      reason: Error
      status: 'False'
      type: Reconciled

Copy link
Contributor

@weshayutin weshayutin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/LGTM

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 6, 2025
Copy link

openshift-ci bot commented Mar 6, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mateusoliveira43, weshayutin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

openshift-ci bot commented Mar 7, 2025

@mateusoliveira43: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/4.12-operator-e2e-aws 1587d2c link true /test 4.12-operator-e2e-aws
ci/prow/4.12-operator-unit-test 1587d2c link true /test 4.12-operator-unit-test
ci/prow/4.14-operator-e2e-azure 1587d2c link true /test 4.14-operator-e2e-azure
ci/prow/4.12-operator-e2e-azure 1587d2c link true /test 4.12-operator-e2e-azure
ci/prow/4.12-e2e-test-azure 8299442 link true /test 4.12-e2e-test-azure
ci/prow/4.15-e2e-test-aws cbd019d link true /test 4.15-e2e-test-aws
ci/prow/4.17-e2e-test-aws cbd019d link true /test 4.17-e2e-test-aws

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD da7cbd2 and 2 for PR HEAD 18b3018 in total

@openshift-merge-bot openshift-merge-bot bot merged commit 9ce4670 into openshift:master Mar 7, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants