feat: add operator-aware resizing with examples and automation #348
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add operator-aware resizing feature that enables pvc-autoresizer to work harmoniously with Kubernetes operators by patching Custom Resources instead of directly modifying PVCs. Includes comprehensive examples, automation, and documentation for CloudNativePG and RabbitMQ operators.
Core Feature:
- CR patching: Patch operator CR fields instead of direct PVC modification
- Security: RBAC validation + JSONPath restricted to
/spec/*only- Metrics: CR patch success/failure counters with operator labels
- Events: Kubernetes events for CR operations (
ResizedCR,ResizeCRFailed)New files:
internal/runners/cr_patcher.go: Core CR patching logic with validationinternal/runners/cr_patcher_test.go: Unit tests including JSONPath validationdocs/operator-aware-resizing.md: Complete documentation with security model, configuration, monitoring, troubleshooting, and supported operatorsexamples/kyverno-cnpg-autoresizer.yaml: Production-ready Kyverno policy for automatic CNPG PVC annotation based on role (data, WAL, tablespaces)examples/annotate-pvcs.sh: Tested kubectl commands for CloudNativePG, RabbitMQ, and Strimzi Kafka operatorsexamples/README.md: Complete testing guide with step-by-step procedures and verified timelinesTesting:
All examples tested and verified on live clusters on Azure AKS:
Key features:
cnpg.io/pvcRole)kubectl) and automated (Kyverno) workflowsImplements: #346