A kubectl plugin for working with OpenShift API for Data Protection (OADP) resources, including NonAdminBackup operations.
This project provides a
kubectlplugin CLI that extends OADP functionality, allowing users to work with both regular Velero resources and NonAdminBackup resources through a unified interface.
- Regular OADP operations: Standard Velero backup, restore, and version commands
- NonAdmin operations: Create and manage NonAdminBackup resources for namespace-scoped backup operations
- Automatic namespace detection: NonAdminBackup automatically uses your current kubectl context namespace
- Kubectl plugin integration: Works seamlessly as a kubectl plugin
oadp
├── backup (Velero backups)
├── restore (Velero restores)
├── version
└── nonadmin
└── backup
└── create
Use the Makefile for easy build and installation:
# Build and install the kubectl plugin
make install-
Build the CLI:
make build
-
Install as kubectl plugin:
sudo mv kubectl-oadp /usr/local/bin/
-
Verify installation:
kubectl oadp --help
# Build and test locally
make build
./kubectl-oadp --help
# Run tests
make test
# Check status
make status
# View all available commands
make help# Create a non-admin backup of the current namespace
kubectl oadp nonadmin backup create my-backup
# Create backup with specific resource types
kubectl oadp nonadmin backup create my-backup --include-resources deployments,services
# Create backup excluding certain resources
kubectl oadp nonadmin backup create my-backup --exclude-resources secrets
# View backup YAML without creating it
kubectl oadp nonadmin backup create my-backup --snapshot-volumes=false -o yaml
# Wait for backup completion
kubectl oadp nonadmin backup create my-backup --wait# Work with regular Velero backups
kubectl oadp backup --help
# Work with restores
kubectl oadp restore --help
# Check version
kubectl oadp version- Namespace-scoped: Automatically backs up the namespace where the NonAdminBackup resource is created
- Simplified workflow: No need to specify
--include-namespaces- it uses your current kubectl context - Permission-aware: Works within the permissions of the current user/service account
- Integration with OADP: Leverages the underlying Velero infrastructure managed by OADP operator
This project includes comprehensive CLI integration tests organized by functionality.
# Run all tests
make test
# Standard Go pattern (also works)
go test ./...📖 For detailed test documentation, see tests/README.md
This CLI is built using:
- Cobra for CLI framework
- Velero client libraries for core functionality
- OADP NonAdmin APIs for NonAdminBackup operations