@crossdelta/infrastructure 0.11.7 → 0.12.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.
- package/dist/index.cjs +15 -9
- package/dist/index.js +15 -9
- package/dist/runtimes/doks/caddy.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1142,7 +1142,7 @@ var CADDY_DEFAULTS = {
|
|
|
1142
1142
|
limits: { cpu: "200m", memory: "256Mi" }
|
|
1143
1143
|
},
|
|
1144
1144
|
storage: { size: "1Gi", storageClass: "do-block-storage" },
|
|
1145
|
-
healthCheck: { port:
|
|
1145
|
+
healthCheck: { port: 8080, path: "/healthz" }
|
|
1146
1146
|
};
|
|
1147
1147
|
var indent = (text, level) => {
|
|
1148
1148
|
const prefix = " ".repeat(level);
|
|
@@ -1155,9 +1155,7 @@ var basicAuthLines = (basicAuth) => basicAuth ? ["basic_auth {", ` ${basicAuth.
|
|
|
1155
1155
|
var generateHandleBlock = (handle, level, basicAuth) => {
|
|
1156
1156
|
const hasPath = handle.path != null;
|
|
1157
1157
|
const header = hasPath ? `handle ${handle.path}* {` : "handle {";
|
|
1158
|
-
const body = [
|
|
1159
|
-
...basicAuthLines(basicAuth)
|
|
1160
|
-
];
|
|
1158
|
+
const body = [...basicAuthLines(basicAuth)];
|
|
1161
1159
|
if (handle.redirect) {
|
|
1162
1160
|
body.push(`redir ${handle.redirect} permanent`);
|
|
1163
1161
|
} else if (handle.upstream) {
|
|
@@ -1172,8 +1170,11 @@ var generateHandleBlock = (handle, level, basicAuth) => {
|
|
|
1172
1170
|
${inner}
|
|
1173
1171
|
}`, level);
|
|
1174
1172
|
};
|
|
1175
|
-
var generateRouteBlock = (route, encode) => {
|
|
1173
|
+
var generateRouteBlock = (route, encode, useOnDemandTls) => {
|
|
1176
1174
|
const body = [];
|
|
1175
|
+
if (useOnDemandTls) {
|
|
1176
|
+
body.push(" tls {", " on_demand", " }");
|
|
1177
|
+
}
|
|
1177
1178
|
if (!route.redirect && encode?.length) {
|
|
1178
1179
|
body.push(` encode ${encode.join(" ")}`);
|
|
1179
1180
|
}
|
|
@@ -1232,9 +1233,10 @@ var generateCaddyfile = (config) => {
|
|
|
1232
1233
|
const healthCheckBlock = `:${healthCheck.port} {
|
|
1233
1234
|
respond ${healthCheck.path} 200
|
|
1234
1235
|
}`;
|
|
1236
|
+
const useOnDemandTls = config.onDemandTls != null;
|
|
1235
1237
|
const blocks = [
|
|
1236
1238
|
generateGlobalBlock(config),
|
|
1237
|
-
...config.routes.map((route) => generateRouteBlock(route, config.encode)),
|
|
1239
|
+
...config.routes.map((route) => generateRouteBlock(route, config.encode, useOnDemandTls)),
|
|
1238
1240
|
healthCheckBlock,
|
|
1239
1241
|
...config.catchAllUpstream && config.onDemandTls ? [generateCatchAllBlock(config.catchAllUpstream, config.encode)] : []
|
|
1240
1242
|
];
|
|
@@ -1264,10 +1266,11 @@ var deployCaddy = (provider, namespace, config) => {
|
|
|
1264
1266
|
}, { provider });
|
|
1265
1267
|
const caddyContainer = {
|
|
1266
1268
|
name: "caddy",
|
|
1267
|
-
image: "caddy:2-alpine",
|
|
1269
|
+
image: "caddy:2.11.2-alpine",
|
|
1268
1270
|
ports: [
|
|
1269
1271
|
{ name: "https", containerPort: 443, protocol: "TCP" },
|
|
1270
|
-
{ name: "http", containerPort: 80, protocol: "TCP" }
|
|
1272
|
+
{ name: "http", containerPort: 80, protocol: "TCP" },
|
|
1273
|
+
{ name: "health", containerPort: healthCheck.port, protocol: "TCP" }
|
|
1271
1274
|
],
|
|
1272
1275
|
resources: buildResourceSpec(config.resources),
|
|
1273
1276
|
volumeMounts: [
|
|
@@ -1322,9 +1325,12 @@ var deployCaddy = (provider, namespace, config) => {
|
|
|
1322
1325
|
namespace,
|
|
1323
1326
|
labels,
|
|
1324
1327
|
annotations: {
|
|
1328
|
+
"service.beta.kubernetes.io/do-loadbalancer-tls-passthrough": "true",
|
|
1325
1329
|
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-path": healthCheck.path,
|
|
1326
1330
|
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-protocol": "http",
|
|
1327
|
-
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-port": String(healthCheck.port)
|
|
1331
|
+
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-port": String(healthCheck.port),
|
|
1332
|
+
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-check-interval-seconds": "3",
|
|
1333
|
+
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-healthy-threshold": "3"
|
|
1328
1334
|
}
|
|
1329
1335
|
},
|
|
1330
1336
|
spec: {
|
package/dist/index.js
CHANGED
|
@@ -1046,7 +1046,7 @@ var CADDY_DEFAULTS = {
|
|
|
1046
1046
|
limits: { cpu: "200m", memory: "256Mi" }
|
|
1047
1047
|
},
|
|
1048
1048
|
storage: { size: "1Gi", storageClass: "do-block-storage" },
|
|
1049
|
-
healthCheck: { port:
|
|
1049
|
+
healthCheck: { port: 8080, path: "/healthz" }
|
|
1050
1050
|
};
|
|
1051
1051
|
var indent = (text, level) => {
|
|
1052
1052
|
const prefix = " ".repeat(level);
|
|
@@ -1059,9 +1059,7 @@ var basicAuthLines = (basicAuth) => basicAuth ? ["basic_auth {", ` ${basicAuth.
|
|
|
1059
1059
|
var generateHandleBlock = (handle, level, basicAuth) => {
|
|
1060
1060
|
const hasPath = handle.path != null;
|
|
1061
1061
|
const header = hasPath ? `handle ${handle.path}* {` : "handle {";
|
|
1062
|
-
const body = [
|
|
1063
|
-
...basicAuthLines(basicAuth)
|
|
1064
|
-
];
|
|
1062
|
+
const body = [...basicAuthLines(basicAuth)];
|
|
1065
1063
|
if (handle.redirect) {
|
|
1066
1064
|
body.push(`redir ${handle.redirect} permanent`);
|
|
1067
1065
|
} else if (handle.upstream) {
|
|
@@ -1076,8 +1074,11 @@ var generateHandleBlock = (handle, level, basicAuth) => {
|
|
|
1076
1074
|
${inner}
|
|
1077
1075
|
}`, level);
|
|
1078
1076
|
};
|
|
1079
|
-
var generateRouteBlock = (route, encode) => {
|
|
1077
|
+
var generateRouteBlock = (route, encode, useOnDemandTls) => {
|
|
1080
1078
|
const body = [];
|
|
1079
|
+
if (useOnDemandTls) {
|
|
1080
|
+
body.push(" tls {", " on_demand", " }");
|
|
1081
|
+
}
|
|
1081
1082
|
if (!route.redirect && encode?.length) {
|
|
1082
1083
|
body.push(` encode ${encode.join(" ")}`);
|
|
1083
1084
|
}
|
|
@@ -1136,9 +1137,10 @@ var generateCaddyfile = (config) => {
|
|
|
1136
1137
|
const healthCheckBlock = `:${healthCheck.port} {
|
|
1137
1138
|
respond ${healthCheck.path} 200
|
|
1138
1139
|
}`;
|
|
1140
|
+
const useOnDemandTls = config.onDemandTls != null;
|
|
1139
1141
|
const blocks = [
|
|
1140
1142
|
generateGlobalBlock(config),
|
|
1141
|
-
...config.routes.map((route) => generateRouteBlock(route, config.encode)),
|
|
1143
|
+
...config.routes.map((route) => generateRouteBlock(route, config.encode, useOnDemandTls)),
|
|
1142
1144
|
healthCheckBlock,
|
|
1143
1145
|
...config.catchAllUpstream && config.onDemandTls ? [generateCatchAllBlock(config.catchAllUpstream, config.encode)] : []
|
|
1144
1146
|
];
|
|
@@ -1168,10 +1170,11 @@ var deployCaddy = (provider, namespace, config) => {
|
|
|
1168
1170
|
}, { provider });
|
|
1169
1171
|
const caddyContainer = {
|
|
1170
1172
|
name: "caddy",
|
|
1171
|
-
image: "caddy:2-alpine",
|
|
1173
|
+
image: "caddy:2.11.2-alpine",
|
|
1172
1174
|
ports: [
|
|
1173
1175
|
{ name: "https", containerPort: 443, protocol: "TCP" },
|
|
1174
|
-
{ name: "http", containerPort: 80, protocol: "TCP" }
|
|
1176
|
+
{ name: "http", containerPort: 80, protocol: "TCP" },
|
|
1177
|
+
{ name: "health", containerPort: healthCheck.port, protocol: "TCP" }
|
|
1175
1178
|
],
|
|
1176
1179
|
resources: buildResourceSpec(config.resources),
|
|
1177
1180
|
volumeMounts: [
|
|
@@ -1226,9 +1229,12 @@ var deployCaddy = (provider, namespace, config) => {
|
|
|
1226
1229
|
namespace,
|
|
1227
1230
|
labels,
|
|
1228
1231
|
annotations: {
|
|
1232
|
+
"service.beta.kubernetes.io/do-loadbalancer-tls-passthrough": "true",
|
|
1229
1233
|
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-path": healthCheck.path,
|
|
1230
1234
|
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-protocol": "http",
|
|
1231
|
-
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-port": String(healthCheck.port)
|
|
1235
|
+
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-port": String(healthCheck.port),
|
|
1236
|
+
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-check-interval-seconds": "3",
|
|
1237
|
+
"service.beta.kubernetes.io/do-loadbalancer-healthcheck-healthy-threshold": "3"
|
|
1232
1238
|
}
|
|
1233
1239
|
},
|
|
1234
1240
|
spec: {
|
|
@@ -32,7 +32,7 @@ export declare const generateCaddyfile: (config: CaddyConfig) => string;
|
|
|
32
32
|
* Deploy Caddy as a reverse proxy to the cluster.
|
|
33
33
|
*
|
|
34
34
|
* Creates:
|
|
35
|
-
* - Deployment with `caddy:2-alpine` (Strategy: Recreate for RWO PVC)
|
|
35
|
+
* - Deployment with `caddy:2.11.2-alpine` (Strategy: Recreate for RWO PVC)
|
|
36
36
|
* - LoadBalancer Service with DigitalOcean health check annotations
|
|
37
37
|
* - PVC for cert persistence (`/data`)
|
|
38
38
|
* - ConfigMap with the generated Caddyfile
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossdelta/infrastructure",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@crossdelta/cloudevents": "^0.8.
|
|
38
|
+
"@crossdelta/cloudevents": "^0.8.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@pulumi/digitalocean": "^4.0.0",
|