Package com.vaadin.kubernetes.starter.ui
Class RollingUpdateHandler
java.lang.Object
com.vaadin.kubernetes.starter.ui.RollingUpdateHandler
- All Implemented Interfaces:
com.vaadin.flow.server.VaadinServiceInitListener,Serializable,EventListener
- Direct Known Subclasses:
ClusterSupport
public class RollingUpdateHandler
extends Object
implements com.vaadin.flow.server.VaadinServiceInitListener
Handles rolling updates for Vaadin applications running in a cluster.
When the ingress controller or gateway sets the
update version
header on requests to the current (old) version, and its value differs from
the configured application
version, a notification is shown prompting the user to switch to the new
version. When the user accepts, the
sticky session
cookie is removed and the session is invalidated, so that the next request
is routed to a pod running the new version.
- Since:
- 3.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRollingUpdateHandler(String appVersion, String stickySessionCookieName, String updateVersionHeaderName) Deprecated, for removal: This API element is subject to removal in a future version.RollingUpdateHandler(String appVersion, List<String> stickySessionCookieNames, String updateVersionHeaderName) Creates a newRollingUpdateHandlerinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidserviceInit(com.vaadin.flow.server.ServiceInitEvent serviceInitEvent) voidRegister the global version switch listener.
-
Constructor Details
-
RollingUpdateHandler
public RollingUpdateHandler(String appVersion, List<String> stickySessionCookieNames, String updateVersionHeaderName) Creates a newRollingUpdateHandlerinstance.- Parameters:
appVersion- the application version. When the update version header value differs from this version, a notification is shown prompting the user to switch to the new version. Ifnull, rolling update version detection is disabled.stickySessionCookieNames- the names of the cookies used by the ingress controller or gateway implementation for sticky sessions. All cookies in the list are removed when the user accepts a version switch, so that the next request is no longer pinned to the old pod. Multiple names are needed when the gateway sets more than one affinity cookie (e.g. Azure Application Gateway with AGIC).updateVersionHeaderName- the name of the HTTP request header used to detect a new application version during rolling updates. The ingress controller or gateway sets this header on requests to the current version with the new version as its value.- See Also:
-
RollingUpdateHandler
@Deprecated(forRemoval=true) public RollingUpdateHandler(String appVersion, String stickySessionCookieName, String updateVersionHeaderName) Deprecated, for removal: This API element is subject to removal in a future version.UseRollingUpdateHandler(String, List, String)instead to support multiple sticky session cookie names.Creates a newRollingUpdateHandlerinstance with a single sticky session cookie name.- Parameters:
appVersion- the application version. When the update version header value differs from this version, a notification is shown prompting the user to switch to the new version. Ifnull, rolling update version detection is disabled.stickySessionCookieName- the name of the cookie used by the ingress controller or gateway implementation for sticky sessions.updateVersionHeaderName- the name of the HTTP request header used to detect a new application version during rolling updates.- See Also:
-
-
Method Details
-
setSwitchVersionListener
Register the global version switch listener. If set tonullthe current session and the sticky cluster cookie are removed without any version switch condition check.- Parameters:
listener- the listener to register.
-
serviceInit
public void serviceInit(com.vaadin.flow.server.ServiceInitEvent serviceInitEvent) - Specified by:
serviceInitin interfacecom.vaadin.flow.server.VaadinServiceInitListener
-
RollingUpdateHandler(String, List, String)instead to support multiple sticky session cookie names.