@pattform/api-kit 3.3.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,6 +22,9 @@ export interface ContainerComponentArgs {
|
|
|
22
22
|
concurrency?: number;
|
|
23
23
|
readinessPath?: pulumi.Input<string>;
|
|
24
24
|
livenessPath?: pulumi.Input<string>;
|
|
25
|
+
startupCpuBoost?: pulumi.Input<boolean>;
|
|
26
|
+
startupFailureThreshold?: pulumi.Input<number>;
|
|
27
|
+
probePort?: pulumi.Input<number>;
|
|
25
28
|
gcpProject?: pulumi.Input<string>;
|
|
26
29
|
gcpRegion?: pulumi.Input<string>;
|
|
27
30
|
imageDigest?: pulumi.Input<string>;
|
|
@@ -9,7 +9,7 @@ const gcp = require("@pulumi/gcp");
|
|
|
9
9
|
*/
|
|
10
10
|
class ContainerComponent extends pulumi.ComponentResource {
|
|
11
11
|
constructor(name, args, opts) {
|
|
12
|
-
var _a, _b, _c, _d, _e, _f;
|
|
12
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
13
13
|
super("custom:pattform:ContainerComponent", name, args, opts);
|
|
14
14
|
// Project, region and image digest come from args when given (a
|
|
15
15
|
// capability has no stack config of its own), else from config as
|
|
@@ -58,6 +58,8 @@ class ContainerComponent extends pulumi.ComponentResource {
|
|
|
58
58
|
// Default Spring Boot probe paths (can be overridden via args)
|
|
59
59
|
const defaultReadinessPath = (_d = args.readinessPath) !== null && _d !== void 0 ? _d : "/actuator/health/readiness";
|
|
60
60
|
const defaultLivenessPath = (_e = args.livenessPath) !== null && _e !== void 0 ? _e : "/actuator/health/liveness";
|
|
61
|
+
// Spring Boot's actuator on its own management port (8081) by default.
|
|
62
|
+
const probePort = (_f = args.probePort) !== null && _f !== void 0 ? _f : 8081;
|
|
61
63
|
// Create a Cloud Run service for the container image.
|
|
62
64
|
this.service = new gcp.cloudrunv2.Service("container-component-" + args.imageName + "-service-" + args.environment, {
|
|
63
65
|
project: gcpProject,
|
|
@@ -66,7 +68,7 @@ class ContainerComponent extends pulumi.ComponentResource {
|
|
|
66
68
|
name: args.imageName + "-" + args.environment,
|
|
67
69
|
invokerIamDisabled: true,
|
|
68
70
|
template: {
|
|
69
|
-
maxInstanceRequestConcurrency: (
|
|
71
|
+
maxInstanceRequestConcurrency: (_g = args.concurrency) !== null && _g !== void 0 ? _g : 30,
|
|
70
72
|
scaling: {
|
|
71
73
|
maxInstanceCount: 2
|
|
72
74
|
},
|
|
@@ -78,6 +80,10 @@ class ContainerComponent extends pulumi.ComponentResource {
|
|
|
78
80
|
memory: args.memory,
|
|
79
81
|
cpu: args.cpu.toString(),
|
|
80
82
|
},
|
|
83
|
+
// Extra CPU only while an instance starts: a JVM
|
|
84
|
+
// Spring Boot app otherwise takes 12-16s on 1 vCPU.
|
|
85
|
+
// Billed for the boosted seconds only, no idle cost.
|
|
86
|
+
startupCpuBoost: (_h = args.startupCpuBoost) !== null && _h !== void 0 ? _h : true,
|
|
81
87
|
},
|
|
82
88
|
envs: [
|
|
83
89
|
...(args.envVars ? Object.entries(args.envVars).map(([key, value]) => ({
|
|
@@ -91,7 +97,7 @@ class ContainerComponent extends pulumi.ComponentResource {
|
|
|
91
97
|
livenessProbe: {
|
|
92
98
|
httpGet: {
|
|
93
99
|
path: defaultLivenessPath,
|
|
94
|
-
port:
|
|
100
|
+
port: probePort,
|
|
95
101
|
},
|
|
96
102
|
initialDelaySeconds: 30,
|
|
97
103
|
periodSeconds: 20,
|
|
@@ -101,12 +107,14 @@ class ContainerComponent extends pulumi.ComponentResource {
|
|
|
101
107
|
startupProbe: {
|
|
102
108
|
httpGet: {
|
|
103
109
|
path: defaultReadinessPath,
|
|
104
|
-
port:
|
|
110
|
+
port: probePort,
|
|
105
111
|
},
|
|
106
112
|
initialDelaySeconds: 2,
|
|
107
113
|
periodSeconds: 5,
|
|
108
114
|
timeoutSeconds: 1,
|
|
109
|
-
|
|
115
|
+
// A ceiling, not a delay: up to ~62s for a JVM cold
|
|
116
|
+
// start. A native image still passes on the first try.
|
|
117
|
+
failureThreshold: (_j = args.startupFailureThreshold) !== null && _j !== void 0 ? _j : 12,
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
120
|
],
|