mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-05-12 17:04:48 +00:00
Merge branch 'ATS-116' into 'master'
ATS-116 : Disable k8s Liveness probes with Transformations See merge request Repository/alfresco-docker-transformers!17
This commit is contained in:
commit
487d81175f
@ -25,10 +25,6 @@
|
||||
*/
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import org.alfresco.util.TempFileProvider;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -37,6 +33,11 @@ import java.nio.file.StandardCopyOption;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.alfresco.util.TempFileProvider;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
/**
|
||||
* Provides the logic performing test transformations by the live and ready probes.
|
||||
*
|
||||
@ -76,6 +77,7 @@ abstract class ProbeTestTransform
|
||||
long maxTime = Long.MAX_VALUE;
|
||||
long nextTransformTime;
|
||||
|
||||
private final boolean livenessTransformEnabled;
|
||||
private final long livenessTransformPeriod;
|
||||
private long maxTransformCount = Long.MAX_VALUE;
|
||||
private long maxTransformTime;
|
||||
@ -111,6 +113,19 @@ abstract class ProbeTestTransform
|
||||
maxTransformCount = getPositiveLongEnv("maxTransforms", maxTransforms);
|
||||
maxTransformTime = getPositiveLongEnv("maxTransformSeconds", maxTransformSeconds)*1000;
|
||||
livenessTransformPeriod = getPositiveLongEnv("livenessTransformPeriodSeconds", livenessTransformPeriodSeconds)*1000;
|
||||
livenessTransformEnabled = getBooleanEnvVar("livenessTransformEnabled", false);
|
||||
}
|
||||
|
||||
private boolean getBooleanEnvVar(final String name, final boolean defaultValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Boolean.parseBoolean(System.getenv(name));
|
||||
}
|
||||
catch (Exception ignore)
|
||||
{
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
protected long getPositiveLongEnv(String name, long defaultValue)
|
||||
@ -140,6 +155,11 @@ abstract class ProbeTestTransform
|
||||
{
|
||||
// If not initialised OR it is a live probe and we are scheduled to to do a test transform.
|
||||
probeCount++;
|
||||
// TODO: update/fix/refactor liveness probes as part of ATS-138
|
||||
if (isLiveProbe && !livenessTransformEnabled)
|
||||
{
|
||||
return doNothing(true);
|
||||
}
|
||||
return (isLiveProbe && livenessTransformPeriod > 0 &&
|
||||
(transCount <= AVERAGE_OVER_TRANSFORMS || nextTransformTime < System.currentTimeMillis()))
|
||||
|| !initialised.get()
|
||||
|
@ -1,5 +1,14 @@
|
||||
# Transformer k8s liveness and readiness probes
|
||||
|
||||
>**Note:** The transform-specific liveness probes are currently disabled by default in the
|
||||
Alfresco Docker Transformers **2.0.0-RC3** release. They can be enabled through the
|
||||
"**livenessTransformEnabled**" environment variable.
|
||||
>
|
||||
> The T-Engine liveness probes will be reevaluated/changed/improved as part of the ATS-138 story.
|
||||
>
|
||||
> Without the transform-specific liveness probees, calls to the "/live" endpoint of the
|
||||
T-Engines only check if the JVM is alive.
|
||||
|
||||
The transformer's liveness and readiness probes perform small test transformations to check that a pod has fully started up and that it is still healthy.
|
||||
|
||||
Initial test transforms are performed by both probes on start up. After a successful transform, the readiness probe always returns a success message and does no more transformations. As a result requests will not be suspended to the pod unless there is a network issue.
|
||||
|
Loading…
x
Reference in New Issue
Block a user