Skip to content

Conversation

@jmealo
Copy link

@jmealo jmealo commented Dec 11, 2025

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 validation
  • internal/runners/cr_patcher_test.go: Unit tests including JSONPath validation
  • docs/operator-aware-resizing.md: Complete documentation with security model, configuration, monitoring, troubleshooting, and supported operators
  • examples/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 operators
  • examples/README.md: Complete testing guide with step-by-step procedures and verified timelines

Testing:
All examples tested and verified on live clusters on Azure AKS:

  • CloudNativePG: Data, WAL, and tablespace volumes working end-to-end
  • RabbitMQ: Persistence volumes with no reconciliation conflicts
  • Kyverno policy: Automatic annotation with dynamic label extraction
  • Unit tests: JSONPath validation and security enforcement

Key features:

  • Solves reconciliation conflicts with operator-managed PVCs
  • Automatic PVC role detection via operator labels (cnpg.io/pvcRole)
  • Dynamic tablespace name extraction for JSONPath filters
  • Both manual (kubectl) and automated (Kyverno) workflows
  • Production-ready configurations with namespace selectors
  • Defense-in-depth security (RBAC + code-enforced path validation)

Implements: #346

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 validation
- internal/runners/cr_patcher_test.go: Unit tests including JSONPath validation
- docs/operator-aware-resizing.md: Complete documentation with security model,
  configuration, monitoring, troubleshooting, and supported operators
- examples/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 operators
- examples/README.md: Complete testing guide with step-by-step procedures
  and verified timelines

**Testing:**
All examples tested and verified on live clusters:
- CloudNativePG: Data, WAL, and tablespace volumes working end-to-end
- RabbitMQ: Persistence volumes with no reconciliation conflicts
- Kyverno policy: Automatic annotation with dynamic label extraction
- Unit tests: JSONPath validation and security enforcement

**Key features:**
- Solves reconciliation conflicts with operator-managed PVCs
- Automatic PVC role detection via operator labels (cnpg.io/pvcRole)
- Dynamic tablespace name extraction for JSONPath filters
- Both manual (kubectl) and automated (Kyverno) workflows
- Production-ready configurations with namespace selectors
- Defense-in-depth security (RBAC + code-enforced path validation)

Related to: topolvm#346

Signed-off-by: Jeff Mealo <[email protected]>
@jmealo jmealo requested a review from a team as a code owner December 11, 2025 20:17
@jmealo
Copy link
Author

jmealo commented Jan 9, 2026

@llamerada-jp Happy New Year! Hello, wanted to follow up on this. I've been using this in my clusters and it's been working well for me with CNPG on Azure AKS.

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.

1 participant