Skip to content

Commit

Permalink
feat: plone readiness/liveness-probe switch added (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens authored Oct 29, 2024
1 parent 9c5ff32 commit 630095e
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 111 deletions.
22 changes: 22 additions & 0 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 46 additions & 34 deletions src/plone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ export interface PloneBaseOptions {
readonly requestMemory?: string;
readonly environment?: kplus.Env;
// readiness Probe
readonly readinessEnabled?: boolean;
readonly readinessInitialDelaySeconds?: number;
readonly readinessIimeoutSeconds?: number;
readonly readinessPeriodSeconds?: number;
readonly readinessSuccessThreshold?: number;
readonly readinessFailureThreshold?: number;
// liveness Probe
readonly livenessEnabled?: boolean;
readonly livenessInitialDelaySeconds?: number;
readonly livenessIimeoutSeconds?: number;
readonly livenessPeriodSeconds?: number;
Expand Down Expand Up @@ -83,24 +85,28 @@ export class Plone extends Construct {
path: '/',
port: IntOrString.fromNumber(backendPort),
};

const backendLivenessProbe: Probe = {
httpGet: backendActionHttpGet,
initialDelaySeconds: backend.livenessInitialDelaySeconds ?? 30,
timeoutSeconds: backend.livenessIimeoutSeconds ?? 5,
periodSeconds: backend.livenessPeriodSeconds ?? 10,
successThreshold: backend.livenessSuccessThreshold ?? 1,
failureThreshold: backend.livenessFailureThreshold ?? 3,
};
const backendReadinessProbe: Probe = {
httpGet: backendActionHttpGet,
initialDelaySeconds: backend.readinessInitialDelaySeconds ?? 10,
timeoutSeconds: backend.readinessIimeoutSeconds ?? 15,
periodSeconds: backend.readinessPeriodSeconds ?? 10,
successThreshold: backend.readinessSuccessThreshold ?? 1,
failureThreshold: backend.readinessFailureThreshold ?? 3,
};

var backendLivenessProbe: Probe | undefined = undefined;
if (backend.livenessEnabled ?? false) {
backendLivenessProbe = {
httpGet: backendActionHttpGet,
initialDelaySeconds: backend.livenessInitialDelaySeconds ?? 30,
timeoutSeconds: backend.livenessIimeoutSeconds ?? 5,
periodSeconds: backend.livenessPeriodSeconds ?? 10,
successThreshold: backend.livenessSuccessThreshold ?? 1,
failureThreshold: backend.livenessFailureThreshold ?? 3,
};
}
var backendReadinessProbe: Probe | undefined = undefined;
if (backend.readinessEnabled ?? true) {
backendReadinessProbe = {
httpGet: backendActionHttpGet,
initialDelaySeconds: backend.readinessInitialDelaySeconds ?? 10,
timeoutSeconds: backend.readinessIimeoutSeconds ?? 15,
periodSeconds: backend.readinessPeriodSeconds ?? 10,
successThreshold: backend.readinessSuccessThreshold ?? 1,
failureThreshold: backend.readinessFailureThreshold ?? 3,
};
}
// Deployment
const backendDeployment = new PloneDeployment(this, 'backend', {
labels: backendLabels,
Expand Down Expand Up @@ -151,22 +157,28 @@ export class Plone extends Construct {
path: '/',
port: IntOrString.fromNumber(frontendPort),
};
const frontendLivenessProbe: Probe = {
httpGet: frontendActionHttpGet,
initialDelaySeconds: frontend.livenessInitialDelaySeconds ?? 30,
timeoutSeconds: frontend.livenessIimeoutSeconds ?? 5,
periodSeconds: frontend.livenessPeriodSeconds ?? 10,
successThreshold: frontend.livenessSuccessThreshold ?? 1,
failureThreshold: frontend.livenessFailureThreshold ?? 3,
};
const frontendReadinessProbe: Probe = {
httpGet: frontendActionHttpGet,
initialDelaySeconds: frontend.readinessInitialDelaySeconds ?? 10,
timeoutSeconds: frontend.readinessIimeoutSeconds ?? 15,
periodSeconds: frontend.readinessPeriodSeconds ?? 10,
successThreshold: frontend.readinessSuccessThreshold ?? 1,
failureThreshold: frontend.readinessFailureThreshold ?? 3,
};
var frontendLivenessProbe: Probe | undefined = undefined;
if (frontend.livenessEnabled ?? false) {
frontendLivenessProbe = {
httpGet: frontendActionHttpGet,
initialDelaySeconds: frontend.livenessInitialDelaySeconds ?? 30,
timeoutSeconds: frontend.livenessIimeoutSeconds ?? 5,
periodSeconds: frontend.livenessPeriodSeconds ?? 10,
successThreshold: frontend.livenessSuccessThreshold ?? 1,
failureThreshold: frontend.livenessFailureThreshold ?? 3,
};
}
var frontendReadinessProbe: Probe | undefined = undefined;
if (frontend.readinessEnabled ?? true) {
frontendReadinessProbe = {
httpGet: frontendActionHttpGet,
initialDelaySeconds: frontend.readinessInitialDelaySeconds ?? 10,
timeoutSeconds: frontend.readinessIimeoutSeconds ?? 15,
periodSeconds: frontend.readinessPeriodSeconds ?? 10,
successThreshold: frontend.readinessSuccessThreshold ?? 1,
failureThreshold: frontend.readinessFailureThreshold ?? 3,
};
}

// Environment for RAZZLE
var frontendEnvironment = frontend.environment ?? new kplus.Env([], {});
Expand Down
24 changes: 2 additions & 22 deletions test/__snapshots__/httpcache.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 5 additions & 55 deletions test/__snapshots__/plone.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 630095e

Please sign in to comment.