Skip to content

[oadp-1.6] OADP-8056: create Secret from inline CACert and use CACertRef for BSL cert rotation - #2464

Merged
openshift-merge-bot[bot] merged 9 commits into
openshift:oadp-1.6from
openshift-cherrypick-robot:cherry-pick-2454-to-oadp-1.6
Sep 24, 2026
Merged

openshift-merge-bot[bot] merged 9 commits into
openshift:oadp-1.6from
openshift-cherrypick-robot:cherry-pick-2454-to-oadp-1.6

Conversation

@openshift-cherrypick-robot

Copy link
Copy Markdown
Contributor

This is an automated cherry-pick of #2454

/assign kaovilai

kaovilai and others added 9 commits September 22, 2026 01:55
… rotation

Velero upstream added CACertRef (Secret-based CA cert reference) to
replace inline CACert, so a BSL's CA bundle can be rotated by updating
the Secret instead of requiring the BSL object itself to change.

OADP's CloudStorage-backed BSL paths only accepted inline CACert bytes
on the DPA. When provided, create/own a Secret containing those bytes
and set CACertRef on the resulting Velero BSL instead, giving users
cert rotation support without needing to know about CACertRef. An
explicit CACertRef in the DPA is passed through unchanged so users can
manage their own Secret.

Also updates processCACertForBSLs (the separate AWS_CA_BUNDLE
ConfigMap aggregation for the Velero deployment) to resolve CACertRef
in addition to inline CACert, since BSLs built through the paths above
no longer carry inline CACert bytes.

Fixes OADP-8056

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
…ret test

golangci-lint (revive) flagged TestDPAReconciler_reconcileCACertSecret's
local `scheme` variable for shadowing the imported k8s.io/client-go
kubernetes/scheme package, failing ci/prow/unit-test on PR openshift#2454.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
…CertRef resolution errors

Addresses CodeRabbit findings on this PR:

- reconcileCACertSecret now refuses to create, update, or delete a
  Secret at the generated name unless it already carries OADP's own
  label (i.e. OADP created it), instead of blindly overwriting or
  deleting whatever Secret happens to occupy that name.
- Switching a BSL from inline CACert to an explicit CACertRef now
  cleans up the Secret OADP previously generated for it, instead of
  leaving it orphaned.
- resolveCACertBytes (used by processCACertForBSLs' AWS_CA_BUNDLE
  aggregation) now returns an error instead of silently returning nil
  bytes when a required (non-optional) CACertRef can't be resolved, so
  a broken reference surfaces as a reconcile error rather than a BSL
  silently missing its CA cert. Errors for DPA-spec'd BSLs propagate
  and fail reconciliation; errors for extra BSLs found in-cluster but
  not in the DPA spec are logged and skipped instead, since one
  unrelated BSL's broken CACertRef shouldn't block the DPA's own
  ConfigMap update.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
…nsumers

CodeRabbit flagged that when a DPA both sets inline CACert and CACertRef
(the CRD doesn't reject the combination), reconcileCACertSecret prefers
CACertRef for the Velero BSL's ObjectStorage, but resolveCACertBytes
preferred inline CACert for the separate AWS_CA_BUNDLE ConfigMap
aggregation -- the two consumers of the same DPA fields could end up
trusting different CA material.

resolveCACertBytes now prefers CACertRef when set, matching
reconcileCACertSecret's own precedence, falling back to inline CACert
only when CACertRef is nil.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
Matches Velero upstream's own deprecation of BackupStorageLocation's
inline CACert field in favor of CACertRef (velero-io/velero#9141), so
the CRD schema description now steers users toward CACertRef for new
configs, since it supports cert rotation via a Secret update instead
of requiring the BSL/DPA to change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
…BSL coverage

- lib.DpaCustomResource gains BSLCacertRef, wired into
  BackupStorageLocationSpec() alongside the existing BSLCacert, so e2e
  tests can build a Velero-typed BSL with either.
- cacert_suite_test.go: the minio-backed BSL scenario (Available +
  AWS_CA_BUNDLE + real backup/delete over the custom-CA TLS
  connection) now runs twice via a shared helper -- once with the
  legacy inline CACert (kept for backward-compat coverage) and once,
  as the new default, with CACertRef pointing at a user-managed
  Secret. The "no CACert" negative case is unchanged.
- New cacert_cloudstorage_suite_test.go covers OADP-8056 itself: for a
  CloudStorage-backed BackupLocation with inline caCert, OADP must
  create an owned Secret and set caCertRef on the resulting Velero BSL
  instead of copying the CA bytes inline, and must delete that Secret
  again once the inline CACert is removed. Uses the suite's existing
  real cloud bucket/credentials; only asserts reconciliation and the
  resulting BSL/Secret state, since pointing an unrelated test CA at
  the real bucket's TLS endpoint isn't expected to succeed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
The CRD requires spec.configuration.nodeAgent.uploaderType (enum
restic/kopia); the hand-built spec in buildCloudStorageDpaSpec omitted it
and the API server rejected the DPA with a 422.

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
DPA validation requires a non-empty prefix on CloudStorage-backed
BackupLocations when backupImages is enabled (default); without it the
DPA never reaches Reconciled=True and the suite times out.

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
Verified live against a real cluster (PR#2454 installed via
install-oadp-from-pr): ReconcileBackupStorageLocations requires at
least one default BSL, so the single CloudStorage-backed BackupLocation
in this suite must set Default: true, or DPA reconcile fails with
"no default backupstoragelocations configured" and the test times out
waiting for IsReconciledTrue().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot

openshift-ci-robot commented Sep 22, 2026 •

Copy link
Copy Markdown

@openshift-cherrypick-robot: Ignoring requests to cherry-pick non-bug issues: OADP-8056

Details

In response to this:

This is an automated cherry-pick of #2454

/assign kaovilai

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.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 179379ef-0e6d-486c-b1e4-0dd2be8fff88

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 23, 2026

@shubham-pampattiwar shubham-pampattiwar left a comment

Copy link
Copy Markdown
Member

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 Sep 23, 2026
@openshift-ci

openshift-ci Bot commented Sep 23, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: openshift-cherrypick-robot, shubham-pampattiwar, sseago

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [shubham-pampattiwar,sseago]

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

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 8b60331 and 2 for PR HEAD 78bced9 in total

@kaovilai

Copy link
Copy Markdown
Member

level=error msg=failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: infrastructure is not ready: client rate limiter Wait returned an error: rate: Wait(n=1) would exceed context deadline
/retest

@openshift-ci

openshift-ci Bot commented Sep 24, 2026

Copy link
Copy Markdown

@openshift-cherrypick-robot: all tests passed!

Full PR test history. Your PR dashboard.

Details

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-merge-bot
openshift-merge-bot Bot merged commit 3af0f05 into openshift:oadp-1.6 Sep 24, 2026
28 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. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants