Skip to content

A working draft of self-service docs for the OADP docs team #234

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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

weshayutin
Copy link
Contributor

@weshayutin weshayutin commented Feb 25, 2025

Why the changes were made

First pass at draft documentation that may or may not exist in the oadp-non-admin git repo in the long term. The purpose of this draft to get a working draft into the hands of the docs team, qe and others ASAP.

How to test the changes made

Just read :)

https://github.com/weshayutin/oadp-non-admin/blob/draft_docs/docs/draft_production_docs/oadp-self-service.md

https://github.com/weshayutin/oadp-non-admin/blob/draft_docs/docs/draft_production_docs/sequenceDiagram.md

Copy link

openshift-ci bot commented Feb 25, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: weshayutin
Once this PR has been reviewed and has the lgtm label, please assign mrnold for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@weshayutin weshayutin changed the title Draft docs A working draft of self-service docs for the OADP docs team Feb 25, 2025
## OADP Self Service Details

OADP self-service introduces a significant change to backup and restore operations in OpenShift. Previously, only cluster administrators could perform these operations.
Now, regular OpenShift users can perform backup and restore operations within their authorized namespaces. This is achieved through custom resources that securely manage these operations while maintaining proper access controls and visibility. The self-service functionality is implemented in a way that ensures users can only operate within their assigned namespaces and permissions, while cluster administrators maintain overall control through templates and policies.

Choose a reason for hiding this comment

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

(Namespace Admin users)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shubham-pampattiwar so a regular user w/ the appropriate rbac could create nabs/nars right? I'm a little hesitant to doc "namespace admin". Yes namespace admin will work, but other combinations would as well iiuc.

Copy link
Member

@shubham-pampattiwar shubham-pampattiwar left a comment

Choose a reason for hiding this comment

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

@weshayutin Please refer the tables and special case notes from #151 (comment)
Thank you !

Copy link
Contributor

Choose a reason for hiding this comment

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

should it be like this?

i.e. When velero backup status updates, NAC sees it and updates NAB status

the way it it can it pass wrong message that velero updates NAB?

sequenceDiagram
    participant User
    participant NAB as NonAdminBackup
    participant NAC as NonAdminController
    participant VB as Velero Backup
    User->>NAB: Creates NonAdminBackup CR
    NAB->>NAC: Detected by controller
    NAC-->>NAB: Validates backup request
    NAC->>VB: Creates Velero Backup CR
    VB-->>NAC: Status updates
    NAC-->>NAB: updates status
    NAB-->>User: View backup status
Loading

Copy link
Member

Choose a reason for hiding this comment

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

+1

| `itemOperationTimeout` | ✅ Yes | | |
| `resourcePolicy` | ✅ Yes | | ⚠️ Non-admin users can specify the config-map that admins created in OADP Operator NS(Admins enforcing this value be a good alternative here), they cannot specify their own configmap as its lifecycle handling is not currently managed by NAC controller |
| `includedNamespaces` | ❌ No | ✅ Yes | ⚠️ Admins cannot enforce this because it does not make sense for a cluster wide non-admin backup setting, we have validations in place such that only the NS admins NS in included in the NAB spec. |
| `excludedNamespaces` | ✅ Yes | ✅ Yes | ⚠️ This spec is restricted for non-admin users and hence not enforceable by admins |
Copy link
Contributor

Choose a reason for hiding this comment

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

| `csiSnapshotTimeout` | ✅ Yes | | |
| `itemOperationTimeout` | ✅ Yes | | |
| `resourcePolicy` | ✅ Yes | | ⚠️ Non-admin users can specify the config-map that admins created in OADP Operator NS(Admins enforcing this value be a good alternative here), they cannot specify their own configmap as its lifecycle handling is not currently managed by NAC controller |
| `includedNamespaces` | ❌ No | ✅ Yes | ⚠️ Admins cannot enforce this because it does not make sense for a cluster wide non-admin backup setting, we have validations in place such that only the NS admins NS in included in the NAB spec. |
Copy link
Contributor

Choose a reason for hiding this comment

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

special case column should be empty here?

| `orLabelSelectors` | ✅ Yes | | |
| `snapshotVolumes` | ✅ Yes | | |
| `storageLocation` | | | ⚠️ Can be empty (implying default BSL usage) or needs to be an existing NABSL |
| `volumeSnapshotLocations` | | | ⚠️ Not supported for non-admin users, default will be used if needed |
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Should have Restricted column Yes?

if nonAdminBackup.Spec.BackupSpec.VolumeSnapshotLocations != nil {

| `labelSelector` | ✅ Yes | | |
| `orLabelSelectors` | ✅ Yes | | |
| `snapshotVolumes` | ✅ Yes | | |
| `storageLocation` | | | ⚠️ Can be empty (implying default BSL usage) or needs to be an existing NABSL |
Copy link
Contributor

Choose a reason for hiding this comment

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


| **NABSL Field** | **Admin Enforceable** | **Restricted** | **special case** |
|----------------------------|-----------------|----------------|-----------------|
| `backupSyncPeriod` | | | ⚠️ Must be set lower than the DPA.backupSyncPeriod and lower than the garbage collection period |
Copy link
Contributor

Choose a reason for hiding this comment

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

Must be set lower than the DPA spec.nonAdmin.backupSyncPeriod

| `includedResources` | ✅ Yes | | |
| `excludedResources` | ✅ Yes | | |
| `orderedResources` | ✅ Yes | | |
| `includeClusterResources` | ✅ Yes | | ⚠️ Non-admin users can only set this spec to false if they want, all other values are restricted, similar rule for admin enforcement regarding this spec value. |
Copy link
Contributor

Choose a reason for hiding this comment

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

should have Restricted column Yes?

if nonAdminBackup.Spec.BackupSpec.IncludeClusterResources != nil && *nonAdminBackup.Spec.BackupSpec.IncludeClusterResources {

| `orderedResources` | ✅ Yes | | |
| `includeClusterResources` | ✅ Yes | | ⚠️ Non-admin users can only set this spec to false if they want, all other values are restricted, similar rule for admin enforcement regarding this spec value. |
| `excludedClusterScopedResources` | ✅ Yes | | |
| `includedClusterScopedResources` | ✅ Yes | | ⚠️ This spec is restricted and non-enforceable, only empty list is acceptable |
Copy link
Contributor

Choose a reason for hiding this comment

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

Should have Restricted column Yes?

if len(nonAdminBackup.Spec.BackupSpec.IncludedClusterScopedResources) > 0 {

Copy link
Member

@kaovilai kaovilai left a comment

Choose a reason for hiding this comment

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

https://github.com/migtools/oadp-non-admin/blob/master/internal/controller/nonadmindownloadrequest_controller.go is missing from this branch.. although no conflict, a rebase would be appreciated

warnings: 0
```
The complete nonAdminRestore resource definition can be found here: [NonAdminRestore CRD](https://github.com/openshift/oadp-operator/blob/master/bundle/manifests/oadp.openshift.io_nonadminrestores.yaml)

Copy link
Member

Choose a reason for hiding this comment

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

Here's doc for NADR

Suggested change
### Troubleshooting with NonAdminDownloadRequest (NADR)
NonAdminDownloadRequest (NADR) provides non-admin users with a way to access detailed information about their backups and restores for troubleshooting purposes. This functionality is equivalent to what cluster administrators can access using the `velero backup describe --details` command.
NADR allows users to securely retrieve various types of information that can help diagnose issues with backup and restore operations. The NADR controller validates the request and creates a secure download URL for users to access the requested information.
#### Using NADR for Backup Troubleshooting
The following example shows how to create a NADR object to retrieve detailed information about a backup:
```yaml
apiVersion: oadp.openshift.io/v1alpha1
kind: NonAdminDownloadRequest
metadata:
name: backup-details
namespace: nacuser1
spec:
target:
kind: BackupResourceList # See other kinds below
name: mybackup-1 # The name of your NAB
```
Once processed, the NADR status will contain a secure URL where you can download the requested information:
```yaml
apiVersion: oadp.openshift.io/v1alpha1
kind: NonAdminDownloadRequest
metadata:
name: backup-details
namespace: nacuser1
spec:
target:
kind: BackupResourceList
name: mybackup-1
status:
phase: Processed
velero:
status:
downloadURL: https://storage-url.example.com/path-to-your-download?signed-token
expiration: "2025-03-23T20:57:35Z"
phase: Processed
```
#### Available Information Types
The NADR resource supports retrieving different kinds of information:
| Target Kind | Description | Equivalent to |
|-------------|-------------|--------------|
| `BackupResourceList` | List of resources included in the backup | `velero backup describe --details` (resource listing) |
| `BackupContents` | Contents of files backed up | Part of backup details |
| `BackupLog` | Logs from the backup operation | `velero backup logs` |
| `BackupVolumeSnapshots` | Information about volume snapshots | `velero backup describe --details` (snapshots section) |
| `BackupItemOperations` | Information about item operations performed during backup | `velero backup describe --details` (operations section) |
| `RestoreLog` | Logs from the restore operation | `velero restore logs` |
| `RestoreResults` | Detailed results of the restore | `velero restore describe --details` |
#### Troubleshooting Example Workflow
1. **Create a backup**
```
oc create -f nab.yaml
```
2. **Check if the backup completed successfully**
```
oc get nonadminbackup mybackup-1 -n nacuser1
```
3. **If issues are detected, create a NADR to get more details**
```
oc create -f nadr-backup-details.yaml
```
4. **Wait for the NADR to be processed and get the download URL**
```
oc get nonadmindownloadrequest backup-details -n nacuser1 -o jsonpath='{.status.velero.status.downloadURL}'
```
5. **Download and analyze the information using the URL**
This workflow provides non-admin users the ability to troubleshoot their backup operations with the same level of detail that cluster administrators can access with the `velero backup describe --details` command.
> **Note:** Backup and restore logs via NonAdminDownloadRequest are not supported for default BSLs. If you need access to logs, ask your cluster administrator to create a NonAdminBackupStorageLocation for your namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants