Loading…
Loading…
Explains the automatic F5 catalog snapshot, policy scan, and relay VM warmup process that runs when the Admin API service starts. Details the triggers and
The F5CatalogWarmupRunner is a system component that automatically runs when the Admin API service starts up. Its purpose is to proactively populate, or "warm up," the system's cache and state for all configured F5 BIG-IP instances. This ensures that data about F5 configurations and managed relay Virtual Machines (VMs) is fresh and available immediately after a service deployment or restart, preventing initial API calls from experiencing delays.
The warmup process is triggered by the ApplicationReadyEvent, which signals that the application is fully initialized. The process operates on a per-tenant basis, ensuring data isolation. For each tenant, it identifies all enabled F5 instances and performs three key actions for each one:
This startup routine is critical for system readiness, especially the asynchronous dispatch of relay VM provisioning, which prevents long-running cloud operations from blocking the service's startup and delaying its "ready" status.
The warmup process follows a specific sequence of operations upon application startup. The entire flow is designed to be robust, with error handling at each step and mechanisms to avoid blocking the main application thread.
flowchart TD
subgraph Admin API Service Startup
A[Application Ready] --> B{For each Tenant};
B --> C{Find enabled F5 instances};
C --> D{Any instances?};
D -- No --> E[Log and skip];
D -- Yes --> F{For each F5 instance};
F --> G[1. Warm Catalog Snapshot];
G --> H[Persist Catalog State];
H --> I[2. Warm Policy Scan];
I --> J[Persist Scan State];
J --> K[3. Warm Managed Relay];
end
subgraph "Async Relay VM Warmup"
K -- dispatches --> L{Is Relay Enabled?};
L -- No --> M[Stop];
L -- Yes --> N[Dispatch to background executor];
N --> O[Ensure Relay VM is Healthy];
O --> P[Persist Relay State];
end
subgraph Error Handling
G -- on exception --> G_Fail[Record Catalog Failure];
I -- on exception --> I_Fail[Record Scan Failure];
O -- on exception --> O_Fail[Record Relay Unhealthy];
endApplicationReadyEvent.F5CatalogWarmupRunner iterates through all tenants configured in the system, executing the warmup process independently for each one.F5InstanceRecord entries. It filters this list to include only instances that are enabled and have a managementUrl defined. If no such instances are found, it logs a message and the process for that tenant concludes.F5DiscoveryService.
ok), is persisted to the database via f5SyncStateRepository.markCatalogLoaded.failed, the exception message, and a placeholder data structure. This failure state is then persisted to the database.selectedPolicyNames configured.
f5SyncStateRepository.markManualScan.failed status and error message being recorded in the database.relayEnabled set to true. If not, this step is skipped.RelayWarmupDispatcher). This prevents the main startup thread from blocking on potentially slow cloud infrastructure operations (e.g., creating a VM), which could take several minutes.WARMUP_TIMEOUT).The runManagedRelayWarmup task executes in a background thread and performs the following:
DiscoveryIngestVmService.ensureRelayHealthy for the instance. This service handles the logic of checking, creating, or recreating the relay VM to ensure it is operational.f5SyncStateRepository.markRelayProvisioned.unhealthy in the database via f5SyncStateRepository.markRelayHealth.NOTE
If the asynchronous relay warmup fails, is rejected by a saturated executor, or times out, a separate scheduled background task for reconciling active relays will attempt to provision the relay again during its next periodic health check. Startup warmup is a best-effort attempt and does not block service availability.
The relay warmup process depends on a public URL for the discovery ingest service. This URL is resolved using a specific order of precedence.
| Name | Type | Description |
|---|---|---|
S2R_DISCOVERY_INGEST_PUBLIC_URL | Environment Var | The primary environment variable for setting the public URL of the discovery ingest service. This is the preferred variable. |
S2R_F5_INGEST_PUBLIC_URL | Environment Var | A legacy environment variable for the same purpose. It is used as a fallback if S2R_DISCOVERY_INGEST_PUBLIC_URL is not set. |
ingest_public_url on F5InstanceRecord | Database Field | If neither environment variable is set, the system uses the ingest_public_url value configured on the F5 instance record in the database. |
IMPORTANT
The ingest public URL must be configured for the relay warmup to function. If none of the above sources provide a URL, the process will throw an IllegalStateException with the error code S2R-ADM-0427, and the relay VM for that instance will not be warmed up.
| Condition | Trigger |
|---|---|
| No instances warmed up | No F5InstanceRecord entries in the database are enabled and have a managementUrl. |
| Catalog or Policy Scan Fails | An exception occurs during the discovery call to the F5 device (e.g., network issue, invalid credentials, device error). |
| Relay Warmup Fails | An exception occurs during the ensureRelayHealthy operation, or the operation times out (15 minutes). |
warn message (e.g., Startup F5 relay warmup failed for instance=...). The relay's health status is marked as unhealthy in the database, with the error message from the exception.S2R_DISCOVERY_INGEST_PUBLIC_URL (or S2R_F5_INGEST_PUBLIC_URL) environment variable is not set, AND the ingest_public_url field is not set on the F5 instance record in the database. |IllegalStateException with message S2R-ADM-0427 ingest public URL is not configured.... The relay warmup for that instance is aborted.S2R_DISCOVERY_INGEST_PUBLIC_URL environment variable for the Admin API service, or ensure the ingest_public_url is correctly set on the F5 instance configuration via the API.DiscoveryIngestHealthService) periodically checks the health of all active relay VMs and attempts to reconcile any that are unhealthy, independently of this startup process.