Package io.kroxylicious.proxy.model
Class VirtualClusterModel
java.lang.Object
io.kroxylicious.proxy.model.VirtualClusterModel
- All Implemented Interfaces:
AutoCloseable
Runtime representation of a virtual cluster: its name, target Kafka cluster, gateways,
TLS configuration, and the components whose lifecycle is bound to this VC.
Owned resources
The VCM owns and is responsible for closing two per-VC components directly:FilterChainFactory— the filter chain factory for this VC. Each VCM has its own FCF.TlsCredentialSupplierManager— the TLS credential supplier for this VC.
DynamicRouting
instance carries and owns the RouterChainFactory; the VCM
closes it via the routing model.
Lifecycle
The VCM is created when the VC is configured (or reconfigured via hot-reload), and closed viaclose() when the VC's lifecycle reaches Stopped. The
VirtualClusterRegistry drives the close.
close() is idempotent: the underlying components guard against double-close,
so accidental redundant close calls are safe.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVirtualClusterModel(String clusterName, TargetCluster targetCluster, boolean logNetwork, boolean logFrames, List<NamedFilterDefinition> filters) VirtualClusterModel(String clusterName, RoutingModel routing, boolean logNetwork, boolean logFrames, List<NamedFilterDefinition> filters, CacheConfiguration topicNameCacheConfig, TransportSubjectBuilderConfig transportSubjectBuilderConfig, Duration drainTimeout, PluginFactoryRegistry pluginFactoryRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGateway(String name, NodeIdentificationStrategy nodeIdentificationStrategy, Optional<io.kroxylicious.proxy.config.tls.Tls> tls) voidclose()Closes resources associated with this virtual cluster — the TLS credential supplier manager(s) held by the routing model and theFilterChainFactory.static voidconfigureCipherSuites(io.netty.handler.ssl.SslContextBuilder sslContextBuilder, io.kroxylicious.proxy.config.tls.Tls tlsConfiguration) static voidconfigureEnabledProtocols(io.netty.handler.ssl.SslContextBuilder sslContextBuilder, io.kroxylicious.proxy.config.tls.Tls tlsConfiguration) static NettyTrustProviderconfigureTrustProvider(io.kroxylicious.proxy.config.tls.Tls tlsConfiguration) io.kroxylicious.proxy.router.RouterReturns this VC's filter chain factory.gateways()getUpstreamClusterForRoute(String routeName) Returns theUpstreamClusterModelfor a specific route, ornullif the route does not target an upstream cluster (e.g. it targets a nested router).booleanbooleanvoidrouting()intio.kroxylicious.proxy.authentication.TransportSubjectBuildertoString()booleanChecks if this virtual cluster uses dynamic TLS credential supplier.
-
Field Details
-
DEFAULT_SOCKET_FRAME_MAX_SIZE_BYTES
public static final int DEFAULT_SOCKET_FRAME_MAX_SIZE_BYTES- See Also:
-
-
Constructor Details
-
VirtualClusterModel
@VisibleForTesting public VirtualClusterModel(String clusterName, TargetCluster targetCluster, boolean logNetwork, boolean logFrames, List<NamedFilterDefinition> filters) -
VirtualClusterModel
public VirtualClusterModel(String clusterName, RoutingModel routing, boolean logNetwork, boolean logFrames, List<NamedFilterDefinition> filters, CacheConfiguration topicNameCacheConfig, @Nullable TransportSubjectBuilderConfig transportSubjectBuilderConfig, Duration drainTimeout, @Nullable PluginFactoryRegistry pluginFactoryRegistry)
-
-
Method Details
-
filterChainFactory
Returns this VC's filter chain factory. The returned factory is alive for the lifetime of this VCM; closing the VCM (viaclose(), driven byVirtualClusterRegistryon transition intoStopped) also closes the FCF. Callers should not retain the reference past the VC's lifetime. -
createRouter
public io.kroxylicious.proxy.router.Router createRouter() -
drainTimeout
-
routing
-
logVirtualClusterSummary
public void logVirtualClusterSummary() -
addGateway
public void addGateway(String name, NodeIdentificationStrategy nodeIdentificationStrategy, Optional<io.kroxylicious.proxy.config.tls.Tls> tls) -
getClusterName
-
isLogNetwork
public boolean isLogNetwork() -
isLogFrames
public boolean isLogFrames() -
socketFrameMaxSizeBytes
public int socketFrameMaxSizeBytes() -
toString
-
getUpstreamClusterForRoute
Returns theUpstreamClusterModelfor a specific route, ornullif the route does not target an upstream cluster (e.g. it targets a nested router). -
close
public void close()Closes resources associated with this virtual cluster — the TLS credential supplier manager(s) held by the routing model and theFilterChainFactory. Called byVirtualClusterRegistryon lifecycle transition intoStopped. Safe to call multiple times — the FCF's underlyingWrapper.closeis idempotent via an internalAtomicBoolean, andTlsCredentialSupplierManager.closetolerates re-entry.- Specified by:
closein interfaceAutoCloseable
-
usesDynamicTlsCredentials
public boolean usesDynamicTlsCredentials()Checks if this virtual cluster uses dynamic TLS credential supplier.- Returns:
- true if a credential supplier is configured
-
configureTrustProvider
public static NettyTrustProvider configureTrustProvider(io.kroxylicious.proxy.config.tls.Tls tlsConfiguration) -
configureCipherSuites
public static void configureCipherSuites(io.netty.handler.ssl.SslContextBuilder sslContextBuilder, io.kroxylicious.proxy.config.tls.Tls tlsConfiguration) -
configureEnabledProtocols
public static void configureEnabledProtocols(io.netty.handler.ssl.SslContextBuilder sslContextBuilder, io.kroxylicious.proxy.config.tls.Tls tlsConfiguration) -
getFilters
-
gateways
-
subjectBuilder
public io.kroxylicious.proxy.authentication.TransportSubjectBuilder subjectBuilder(PluginFactoryRegistry pfr) -
getTopicNameCacheFilter
-