A kubectl plugin for working with OpenShift API for Data Protection (OADP) resources, including NonAdminBackup operations.
This project provides a
kubectl
plugin 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
Krew is the recommended way to install kubectl plugins.
# Install Krew if you haven't already
kubectl krew install krew
# Install the OADP plugin
kubectl krew install oadp
# Verify installation
kubectl oadp --help
Note: The LICENSE file is automatically extracted during Krew installation and available in the plugin directory.
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
For maintainers creating releases:
# Build release archives for all platforms (includes LICENSE file)
make release
# Generate Krew plugin manifest with SHA256 checksums
make krew-manifest
# Clean up build artifacts
make clean
The release process creates:
- Platform-specific archives (
kubectl-oadp-OS-ARCH.tar.gz
) containing the binary and LICENSE file - SHA256 checksums for each archive
- A Krew plugin manifest file with proper checksums for distribution
# 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
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
This CLI builds on and integrates with:
- Velero (Apache 2.0)
- OADP (Apache 2.0)
- Kubernetes (Apache 2.0)