Loading…
Loading…
Explains how stored F5 BIG-IP instance records are mapped to connection settings for discovery services and log forwarding configurations.
The F5SettingsMapper is an internal utility component that centralizes the logic for translating a stored F5InstanceRecord into the specific settings objects required by discovery and reconciliation services.
This component solves the problem of configuration drift by providing a single, canonical source of truth for interpreting an F5 instance's stored configuration. Previously, this logic was duplicated between the operator-facing F5Controller and the background F5ManagedRuleReconciler. By delegating this mapping to F5SettingsMapper, the platform ensures that both manual operations and automated background tasks connect to F5 BIG-IP appliances using identical settings derived from the same logic.
Its primary function is to take an F5InstanceRecord as input and produce two distinct outputs:
F5DiscoveryService.F5Settings object for general connection and discovery.F5DiscoveryService.F5LogForwardingSettings object for configuring log forwarding.The mapper exposes static methods that perform direct translation from the fields of an F5InstanceRecord to the constructor arguments of the target settings objects.
The toSettings method creates an F5DiscoveryService.F5Settings object. This mapping is a direct pass-through of values from the F5InstanceRecord to the settings object.
The following F5InstanceRecord properties are mapped directly:
managementUrl()managementUrls()partitionName()selectedPartitionNames()primaryPolicyName()selectedPolicyNames()effectiveUsername()effectivePassword()frontendVsFilter()backendVsFilter()selectedFrontVirtualServers()selectedBackendVirtualServers()Additionally, a hardcoded boolean value of true is passed to the F5Settings constructor. The source does not specify the purpose of this parameter.
The toLogSettings method creates an F5DiscoveryService.F5LogForwardingSettings object, applying defaults for several fields if they are not specified in the F5InstanceRecord.
The mapping logic is as follows:
record.logProfileName() is null or blank, the value defaults to "S2R_AUTO_SOAP_LOGS". Otherwise, the value from the record is used.effectiveReceiverAddress logic. If the resulting address is not blank, it is provided as a single-element list. If it is blank, an empty list is provided."tcp".record.responseLogging() is null or blank, the value defaults to "all". Otherwise, the value from the record is used.The target address for log forwarding is determined using a specific fallback chain to provide both instance-level and global configuration. The effectiveReceiverAddress method implements this logic.
The address is selected based on the first available value in the following order of precedence:
logReceiverAddress value from the F5InstanceRecord.S2R_DISCOVERY_INGEST_LOG_RELAY_TARGET environment variable.S2R_F5_LOG_RELAY_TARGET environment variable.If none of these sources provide a non-blank value, an empty string is returned, effectively disabling log forwarding to a configured target.
The following diagram illustrates this decision flow:
flowchart TD
subgraph Log Receiver Address Resolution
A[Start] --> B{Instance-level `logReceiverAddress` configured?};
B -- Yes --> C[Use instance-level address];
B -- No --> D{`S2R_DISCOVERY_INGEST_LOG_RELAY_TARGET` env var set?};
D -- Yes --> E[Use `S2R_DISCOVERY_INGEST_LOG_RELAY_TARGET` value];
D -- No --> F{`S2R_F5_LOG_RELAY_TARGET` env var set?};
F -- Yes --> G[Use `S2R_F5_LOG_RELAY_TARGET` value];
F -- No --> H[Use empty string];
end
subgraph Result
C --> Z[Return address];
E --> Z;
G --> Z;
H --> Z;
endThe F5SettingsMapper provides the following public static methods.
toSettingsMaps an F5InstanceRecord to connection and discovery settings.
public static F5DiscoveryService.F5Settings toSettings(F5InstanceRecord record)
record: The F5InstanceRecord containing the stored configuration for the F5 BIG-IP instance.F5DiscoveryService.F5Settings object populated with values from the record.toLogSettingsMaps an F5InstanceRecord to log forwarding settings, applying system defaults where needed.
public static F5DiscoveryService.F5LogForwardingSettings toLogSettings(F5InstanceRecord record)
record: The F5InstanceRecord containing the stored configuration.F5DiscoveryService.F5LogForwardingSettings object populated with values from the record and applicable defaults.effectiveReceiverAddressResolves the definitive log receiver address using a fallback chain of instance configuration and environment variables.
public static String effectiveReceiverAddress(String configuredReceiverAddress)
configuredReceiverAddress: The address configured on the specific instance record, which may be null or empty.String containing the resolved log receiver address, or an empty string if no address is configured at any level.The behavior of the F5SettingsMapper is driven by the properties of the F5InstanceRecord and two platform-level environment variables.
F5InstanceRecord PropertiesThe following properties from an F5InstanceRecord object are used as inputs for the mapping process. The source does not specify the data types for these properties.
| Property | Used In | Description |
|---|---|---|
managementUrl() | toSettings | Mapped to the primary management URL for the F5 BIG-IP appliance. |
managementUrls() | toSettings | Mapped to the list of management URLs. |
partitionName() | toSettings | Mapped to the partition name. |
selectedPartitionNames() | toSettings | Mapped to the list of selected partition names. |
primaryPolicyName() | toSettings | Mapped to the primary policy name. |
selectedPolicyNames() | toSettings | Mapped to the list of selected policy names. |
effectiveUsername() | toSettings | Mapped to the username for authentication. |
effectivePassword() | toSettings | Mapped to the password for authentication. |
frontendVsFilter() | toSettings | Mapped to the frontend virtual server filter. |
backendVsFilter() | toSettings | Mapped to the backend virtual server filter. |
selectedFrontVirtualServers() | toSettings | Mapped to the list of selected frontend virtual servers. |
selectedBackendVirtualServers() | toSettings | Mapped to the list of selected backend virtual servers. |
logProfileName() | toLogSettings | The name for the log profile. Defaults to S2R_AUTO_SOAP_LOGS if not provided. |
logReceiverAddress() | toLogSettings | The instance-specific log receiver address. This is the highest precedence value for the log target. |
responseLogging() | toLogSettings | The response logging mode. Defaults to all if not provided. |
These environment variables provide a global default for the log forwarding target if an instance-specific address is not set.
IMPORTANT
The S2R_DISCOVERY_INGEST_LOG_RELAY_TARGET variable is preferred. The system only checks S2R_F5_LOG_RELAY_TARGET if the primary variable is not set.
| Variable | Description |
|---|---|
S2R_DISCOVERY_INGEST_LOG_RELAY_TARGET | The primary, deployment-wide target address for log forwarding. Overridden by an instance's logReceiverAddress. |
S2R_F5_LOG_RELAY_TARGET | A legacy, fallback environment variable for the log forwarding target. Used only if the primary variable is unset. |
The mapper is designed to be resilient by providing default values. Misconfiguration is unlikely to cause a hard failure but may result in unintended behavior.
F5InstanceRecord has a blank logProfileName, the system will automatically use the name S2R_AUTO_SOAP_LOGS.F5InstanceRecord has a blank responseLogging value, the system will default to logging all responses.logReceiverAddress is not set on the instance and neither of the fallback environment variables (S2R_DISCOVERY_INGEST_LOG_RELAY_TARGET or S2R_F5_LOG_RELAY_TARGET) are set, the resulting F5LogForwardingSettings will contain an empty list of targets. This will prevent the configuration of a log forwarding destination on the F5 appliance.F5DiscoveryService: The service that consumes the settings objects produced by this mapper to interact with F5 BIG-IP appliances.F5ManagedRuleReconciler: A background reconciliation process that uses this mapper to ensure its connection settings are consistent with other parts of the system.