Skip to content

feat: extend enable/disable/teardown pattern to Workbench, Package Manager, and Chronicle #95

@ian-flores

Description

@ian-flores

Background

PR #93 introduced a non-destructive enable/disable pattern for Connect:

  • spec.connect.enabled: false — suspends Connect (removes Deployment/Service/Ingress, preserves PVC/database/secrets)
  • spec.connect.teardown: true — destructive cleanup, only effective when enabled: false
  • spec.connect.suspended on the Connect CR — internal signal from Site controller to Connect controller

This should become an operator-wide pattern applied to Workbench, Package Manager, and Chronicle.

Work required per product

For each of Workbench, Package Manager, and Chronicle:

API changes (api/core/v1beta1/site_types.go)

  • Add Enabled *bool with // +kubebuilder:default=true to InternalWorkbenchSpec, InternalPackageManagerSpec, InternalChronicleSpec
  • Add Teardown *bool with // +kubebuilder:default=false to same structs

Product CRD changes

  • Add Suspended *bool to WorkbenchSpec, PackageManagerSpec, ChronicleSpec in their respective _types.go files
  • Update zz_generated.deepcopy.go for all new fields
  • Update client-go applyconfiguration boilerplate (via just mgenerate)

Site controller changes (internal/controller/core/)

  • Add three-way branch in reconcileResources (same as Connect):
    • productEnabledreconcileProduct(...)
    • !productEnabled && productTeardowncleanupProduct(...) (destructive)
    • !productEnabled && !productTeardowndisableProduct(...) (non-destructive)
  • Add warning log when teardown: true with enabled: true
  • Skip volume provisioning when product is disabled (pattern in site_controller.go:187,222)

Product controller changes (internal/controller/core/<product>.go)

  • Add early Suspended check at the top of the product's Reconcile/ReconcileProduct function
  • Add suspendDeployedService method that deletes only Ingress, Service, Deployment (not PVC/database/secrets)

Tests (internal/controller/core/site_test.go)

  • TestSite<Product>DisableNeverEnabled — disable with no prior enable is a no-op
  • TestSite<Product>SuspendAfterEnable — three-pass: enable → disable (verify Suspended=true) → re-enable (verify Suspended=nil)
  • TestSite<Product>Teardown — two-pass: enable → teardown (verify CR deleted)

Docs

  • docs/api-reference.md — add .enabled and .teardown rows for each product
  • docs/guides/connect-configuration.md equivalent for each product (if guides exist)
  • docs/guides/product-team-site-management.md — update YAML examples with correct comments

Reference implementation

See PR #93 and internal/controller/core/site_controller_connect.go for the complete Connect implementation to follow.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions