Skip to content

Expose per-backend probe overrides for auto-generated Plone backends #150

Description

@jensens

Problem

PloneVinylCache hardcodes probe parameters for the auto-generated Plone backends in src/vinylcache.ts:

// plone_backend
probe: { url: '/ok', interval: '5s', timeout: '2s', window: 10, threshold: 8 }

// plone_frontend (if present)
probe: { url: '/', interval: '5s', timeout: '2s', window: 10, threshold: 8 }

Real workloads need to tune these. Concrete example from aaf-6 stage: a single slow catalog query during DB warmup can exceed 2 s and — with threshold: 8 / window: 10 and healthy=CHOSEN on the shard director — flip a backend to unhealthy, then the whole shard slice 503s. The timeout has to be raised to 5s during the observation phase.

Users currently work around this by patching the generated VinylCache CR after construction:

const vc = httpcache.node.findAll().find(c => c instanceof ApiObject && c.kind === 'VinylCache');
ApiObject.of(vc!).addJsonPatch(
  JsonPatch.replace('/spec/backends/0/probe', { ... })
);

This is fragile (index-based, breaks if backend order changes) and leaks operator-CRD details into the user's deployment code. We already removed the spec.storage workaround via #148 — same treatment here would fully eliminate JsonPatches for the common tuning cases.

Proposal

Add per-backend probe overrides on PloneVinylCacheOptions:

export interface PloneVinylCacheOptions {
  // ...existing fields...

  /**
   * Override probe parameters for the auto-generated Plone backend.
   * Any field left unset keeps the construct's default.
   * @default - { url: '/ok', interval: '5s', timeout: '2s', window: 10, threshold: 8 }
   */
  readonly ploneBackendProbe?: VinylCacheBackendProbe;

  /**
   * Override probe parameters for the auto-generated Plone frontend (Volto variant only).
   * Any field left unset keeps the construct's default.
   * @default - { url: '/', interval: '5s', timeout: '2s', window: 10, threshold: 8 }
   */
  readonly ploneFrontendProbe?: VinylCacheBackendProbe;
}

Merge semantics: field-by-field override — user-supplied field wins, unset fields fall back to the construct's default. Same shape as VinylCacheBackendProbe already used on extraBackends[].probe.

Example consumer code (after)

new PloneVinylCache(chart, 'cache', {
  plone,
  ploneBackendProbe: { timeout: '5s' },
});

No ApiObject.findAll(), no JsonPatch, no index fragility.

Test plan

  • New tests: override only timeout, override all fields, override frontend probe only. Assert that spec.backends[N].probe in the synthesized manifest reflects the merge.
  • Existing default tests must remain unchanged.

Out of scope

  • A fully generic "override any field on any auto-generated backend" API. Keep this focused on probe, which is the concrete workaround case we've hit.
  • Exposing connection parameters (connectionParameters on the CRD) — separate, lower-priority need.

Context

Came up while migrating aaf-6 stage away from the spec.storage JsonPatch workaround (#148 + bluedynamics/cloud-vinyl#43 context). The probe JsonPatch is the last remaining JsonPatch on the VinylCache CR in that deployment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions