@highstate/k8s 0.20.0 → 0.21.1
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/chunk-23vn2rdc.js +11 -0
- package/dist/chunk-2pfx13ay.js +11 -0
- package/dist/chunk-46ntav0c.js +299 -0
- package/dist/chunk-556pc9e6.js +155 -0
- package/dist/chunk-7kgjgcft.js +170 -0
- package/dist/{chunk-ADHZK6V2.js → chunk-9hs97f1q.js} +13 -11
- package/dist/chunk-aame3x1b.js +11 -0
- package/dist/chunk-b05q6fm2.js +37 -0
- package/dist/chunk-bmvc9d2d.js +11 -0
- package/dist/chunk-de82bbp2.js +7 -0
- package/dist/chunk-facs31cb.js +624 -0
- package/dist/chunk-h1b79v66.js +1425 -0
- package/dist/chunk-k4w9zpn5.js +215 -0
- package/dist/chunk-pqc6w52f.js +352 -0
- package/dist/chunk-qyshvz32.js +176 -0
- package/dist/chunk-tpfyj6fe.js +199 -0
- package/dist/chunk-z6bmpnm7.js +180 -0
- package/dist/highstate.manifest.json +3 -3
- package/dist/impl/dynamic-endpoint-resolver.js +82 -81
- package/dist/impl/gateway-route.js +131 -168
- package/dist/impl/tls-certificate.js +31 -32
- package/dist/index.js +245 -201
- package/dist/units/cert-manager/index.js +19 -13
- package/dist/units/cluster-patch/index.js +9 -8
- package/dist/units/dns01-issuer/index.js +44 -41
- package/dist/units/existing-cluster/index.js +25 -13
- package/dist/units/gateway-api/index.js +15 -16
- package/dist/units/reduced-access-cluster/index.js +28 -32
- package/package.json +21 -21
- package/src/cron-job.ts +26 -1
- package/src/deployment.ts +17 -1
- package/src/job.ts +15 -1
- package/src/scripting/bundle.ts +21 -98
- package/src/scripting/environment.ts +2 -9
- package/src/shared.ts +1 -1
- package/src/stateful-set.ts +17 -1
- package/src/workload.ts +31 -14
- package/LICENSE +0 -21
- package/dist/chunk-23X5SXQG.js +0 -301
- package/dist/chunk-23X5SXQG.js.map +0 -1
- package/dist/chunk-ADHZK6V2.js.map +0 -1
- package/dist/chunk-BTAEFJ5N.js +0 -291
- package/dist/chunk-BTAEFJ5N.js.map +0 -1
- package/dist/chunk-HH2JJELM.js +0 -13
- package/dist/chunk-HH2JJELM.js.map +0 -1
- package/dist/chunk-IXE3OKB4.js +0 -249
- package/dist/chunk-IXE3OKB4.js.map +0 -1
- package/dist/chunk-OG2OPX7B.js +0 -333
- package/dist/chunk-OG2OPX7B.js.map +0 -1
- package/dist/chunk-P26SQ2ZB.js +0 -393
- package/dist/chunk-P26SQ2ZB.js.map +0 -1
- package/dist/chunk-PG27ZY2H.js +0 -319
- package/dist/chunk-PG27ZY2H.js.map +0 -1
- package/dist/chunk-PZYGZSN5.js +0 -54
- package/dist/chunk-PZYGZSN5.js.map +0 -1
- package/dist/chunk-S77TE7UC.js +0 -309
- package/dist/chunk-S77TE7UC.js.map +0 -1
- package/dist/chunk-SZKOAHNX.js +0 -1804
- package/dist/chunk-SZKOAHNX.js.map +0 -1
- package/dist/chunk-TOLFVF4S.js +0 -889
- package/dist/chunk-TOLFVF4S.js.map +0 -1
- package/dist/chunk-TVKT3ZYX.js +0 -423
- package/dist/chunk-TVKT3ZYX.js.map +0 -1
- package/dist/cron-job-RKB2HYTO.js +0 -7
- package/dist/cron-job-RKB2HYTO.js.map +0 -1
- package/dist/deployment-T35TUOL2.js +0 -7
- package/dist/deployment-T35TUOL2.js.map +0 -1
- package/dist/impl/dynamic-endpoint-resolver.js.map +0 -1
- package/dist/impl/gateway-route.js.map +0 -1
- package/dist/impl/tls-certificate.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/job-PE4AKOHB.js +0 -7
- package/dist/job-PE4AKOHB.js.map +0 -1
- package/dist/stateful-set-LUIRHQJY.js +0 -7
- package/dist/stateful-set-LUIRHQJY.js.map +0 -1
- package/dist/units/cert-manager/index.js.map +0 -1
- package/dist/units/cluster-patch/index.js.map +0 -1
- package/dist/units/dns01-issuer/index.js.map +0 -1
- package/dist/units/existing-cluster/index.js.map +0 -1
- package/dist/units/gateway-api/index.js.map +0 -1
- package/dist/units/reduced-access-cluster/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,27 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
Gateway,
|
|
4
|
+
HttpRoute,
|
|
5
|
+
TcpRoute,
|
|
6
|
+
UdpRoute,
|
|
7
|
+
mapHttpRouteRuleMatch,
|
|
8
|
+
resolveBackendRef
|
|
9
|
+
} from "./chunk-46ntav0c.js";
|
|
10
|
+
import {
|
|
11
|
+
Certificate
|
|
12
|
+
} from "./chunk-556pc9e6.js";
|
|
13
|
+
import {
|
|
14
|
+
Job
|
|
15
|
+
} from "./chunk-qyshvz32.js";
|
|
16
|
+
import {
|
|
17
|
+
CronJob
|
|
18
|
+
} from "./chunk-tpfyj6fe.js";
|
|
19
|
+
import {
|
|
20
|
+
Chart,
|
|
21
|
+
RenderedChart,
|
|
22
|
+
getChartService,
|
|
23
|
+
getChartServiceOutput,
|
|
24
|
+
resolveHelmChart
|
|
25
|
+
} from "./chunk-pqc6w52f.js";
|
|
26
|
+
import {
|
|
27
|
+
Deployment
|
|
28
|
+
} from "./chunk-7kgjgcft.js";
|
|
29
|
+
import {
|
|
30
|
+
StatefulSet
|
|
31
|
+
} from "./chunk-z6bmpnm7.js";
|
|
32
|
+
import {
|
|
33
|
+
ConfigMap,
|
|
34
|
+
NativeNetworkPolicy,
|
|
35
|
+
NetworkPolicy,
|
|
36
|
+
PersistentVolumeClaim,
|
|
37
|
+
Workload,
|
|
38
|
+
filterPatchOwnedContainersInTemplate,
|
|
39
|
+
getAutoVolumeName,
|
|
40
|
+
getBestEndpoint,
|
|
41
|
+
getFallbackContainerName,
|
|
42
|
+
getWorkloadComponents,
|
|
43
|
+
getWorkloadServiceComponents,
|
|
44
|
+
getWorkloadVolumeResourceUuid,
|
|
45
|
+
mapContainerEnvironment,
|
|
46
|
+
mapContainerToRaw,
|
|
47
|
+
mapEnvironmentSource,
|
|
48
|
+
mapVolumeMount,
|
|
49
|
+
mapWorkloadVolume,
|
|
50
|
+
networkPolicyMediator,
|
|
51
|
+
podSpecDefaults,
|
|
52
|
+
requireBestEndpoint,
|
|
53
|
+
workloadExtraArgs,
|
|
54
|
+
workloadServiceExtraArgs
|
|
55
|
+
} from "./chunk-h1b79v66.js";
|
|
56
|
+
import {
|
|
57
|
+
dns01SolverMediator
|
|
58
|
+
} from "./chunk-de82bbp2.js";
|
|
59
|
+
import {
|
|
60
|
+
createK8sTerminal,
|
|
61
|
+
detectExternalIps
|
|
62
|
+
} from "./chunk-9hs97f1q.js";
|
|
63
|
+
import {
|
|
64
|
+
Service,
|
|
65
|
+
createServiceSpec,
|
|
66
|
+
getServiceType,
|
|
67
|
+
isEndpointFromCluster,
|
|
68
|
+
l4EndpointToServicePort,
|
|
69
|
+
mapContainerPortToServicePort,
|
|
70
|
+
mapServiceToLabelSelector
|
|
71
|
+
} from "./chunk-k4w9zpn5.js";
|
|
72
|
+
import {
|
|
73
|
+
ClusterAccessScope,
|
|
74
|
+
Namespace,
|
|
75
|
+
NamespacedResource,
|
|
76
|
+
Resource,
|
|
77
|
+
Secret,
|
|
78
|
+
commonExtraArgs,
|
|
79
|
+
getClusterKubeconfigContent,
|
|
80
|
+
getEmbeddedSecretFileContent,
|
|
81
|
+
getNamespaceName,
|
|
82
|
+
getProvider,
|
|
83
|
+
getProviderAsync,
|
|
84
|
+
images_default,
|
|
85
|
+
mapMetadata,
|
|
86
|
+
mapNamespaceNameToSelector,
|
|
87
|
+
mapSelectorLikeToSelector,
|
|
88
|
+
validateCluster
|
|
89
|
+
} from "./chunk-facs31cb.js";
|
|
90
|
+
import"./chunk-b05q6fm2.js";
|
|
91
|
+
// src/kubectl.ts
|
|
92
|
+
import { Command, MaterializedFile } from "@highstate/common";
|
|
93
|
+
import {
|
|
94
|
+
ComponentResource,
|
|
95
|
+
output
|
|
96
|
+
} from "@pulumi/pulumi";
|
|
25
97
|
function createCommand(command) {
|
|
26
98
|
if (Array.isArray(command)) {
|
|
27
99
|
return command.join(" ");
|
|
@@ -30,9 +102,7 @@ function createCommand(command) {
|
|
|
30
102
|
}
|
|
31
103
|
function buildKubeCommand(command, namespace) {
|
|
32
104
|
if (namespace) {
|
|
33
|
-
return output([command, namespace]).apply(
|
|
34
|
-
([cmd, ns]) => `kubectl -n ${ns} ${createCommand(cmd)}`
|
|
35
|
-
);
|
|
105
|
+
return output([command, namespace]).apply(([cmd, ns]) => `kubectl -n ${ns} ${createCommand(cmd)}`);
|
|
36
106
|
}
|
|
37
107
|
return output(command).apply((cmd) => `kubectl ${createCommand(cmd)}`);
|
|
38
108
|
}
|
|
@@ -46,18 +116,10 @@ function buildWorkloadExecCommand(command, workload) {
|
|
|
46
116
|
return `exec -it ${type}/${name} -- ${createCommand(command2)}`;
|
|
47
117
|
});
|
|
48
118
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
* The underlying command that will be executed when this unit is invoked.
|
|
52
|
-
*/
|
|
119
|
+
|
|
120
|
+
class KubeCommand extends ComponentResource {
|
|
53
121
|
command;
|
|
54
|
-
/**
|
|
55
|
-
* The standard output of the command.
|
|
56
|
-
*/
|
|
57
122
|
stdout;
|
|
58
|
-
/**
|
|
59
|
-
* The standard error of the command.
|
|
60
|
-
*/
|
|
61
123
|
stderr;
|
|
62
124
|
constructor(name, args, opts) {
|
|
63
125
|
super("highstate:k8s:KubeCommand", name, args, opts);
|
|
@@ -66,10 +128,10 @@ var KubeCommand = class _KubeCommand extends ComponentResource {
|
|
|
66
128
|
return new Command(`kubectl-${name}`, {
|
|
67
129
|
host: "local",
|
|
68
130
|
create: buildKubeCommand(args.create, args.namespace),
|
|
69
|
-
update: args.update ? buildKubeCommand(args.update, args.namespace) :
|
|
70
|
-
delete: args.delete ? buildKubeCommand(args.delete, args.namespace) :
|
|
131
|
+
update: args.update ? buildKubeCommand(args.update, args.namespace) : undefined,
|
|
132
|
+
delete: args.delete ? buildKubeCommand(args.delete, args.namespace) : undefined,
|
|
71
133
|
files: [kubeconfig],
|
|
72
|
-
image:
|
|
134
|
+
image: images_default["terminal-kubectl"].image,
|
|
73
135
|
containerShell: "bash",
|
|
74
136
|
environment: {
|
|
75
137
|
KUBECONFIG: kubeconfig.path
|
|
@@ -80,31 +142,32 @@ var KubeCommand = class _KubeCommand extends ComponentResource {
|
|
|
80
142
|
this.stderr = this.command.stderr;
|
|
81
143
|
}
|
|
82
144
|
static forNamespace(name, args, opts) {
|
|
83
|
-
return new
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
namespace: output(args.namespace).metadata.name
|
|
91
|
-
},
|
|
92
|
-
opts
|
|
93
|
-
);
|
|
145
|
+
return new KubeCommand(name, {
|
|
146
|
+
cluster: output(args.namespace).cluster,
|
|
147
|
+
create: args.create,
|
|
148
|
+
update: args.update,
|
|
149
|
+
delete: args.delete,
|
|
150
|
+
namespace: output(args.namespace).metadata.name
|
|
151
|
+
}, opts);
|
|
94
152
|
}
|
|
95
153
|
static execInto(name, args, opts) {
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
delete: args.delete ? buildWorkloadExecCommand(args.delete, args.workload) : void 0
|
|
103
|
-
},
|
|
104
|
-
opts
|
|
105
|
-
);
|
|
154
|
+
return KubeCommand.forNamespace(name, {
|
|
155
|
+
namespace: output(args.workload).namespace,
|
|
156
|
+
create: buildWorkloadExecCommand(args.create, args.workload),
|
|
157
|
+
update: args.update ? buildWorkloadExecCommand(args.update, args.workload) : undefined,
|
|
158
|
+
delete: args.delete ? buildWorkloadExecCommand(args.delete, args.workload) : undefined
|
|
159
|
+
}, opts);
|
|
106
160
|
}
|
|
107
|
-
}
|
|
161
|
+
}
|
|
162
|
+
// src/scripting/bundle.ts
|
|
163
|
+
import { parseEndpoint } from "@highstate/common";
|
|
164
|
+
import { text, trimIndentation } from "@highstate/contract";
|
|
165
|
+
import { normalize } from "@highstate/pulumi";
|
|
166
|
+
import {
|
|
167
|
+
ComponentResource as ComponentResource2,
|
|
168
|
+
output as output2
|
|
169
|
+
} from "@pulumi/pulumi";
|
|
170
|
+
import { deepmerge } from "deepmerge-ts";
|
|
108
171
|
|
|
109
172
|
// src/scripting/environment.ts
|
|
110
173
|
var emptyDistributionEnvironment = {
|
|
@@ -115,18 +178,16 @@ var emptyDistributionEnvironment = {
|
|
|
115
178
|
var emptyScriptEnvironment = {
|
|
116
179
|
alpine: {
|
|
117
180
|
...emptyDistributionEnvironment,
|
|
118
|
-
image:
|
|
181
|
+
image: images_default.alpine.image,
|
|
119
182
|
allowedEndpoints: [
|
|
120
|
-
//
|
|
121
183
|
"tcp://dl-cdn.alpinelinux.org:443",
|
|
122
184
|
"tcp://dl-cdn.alpinelinux.org:80"
|
|
123
185
|
]
|
|
124
186
|
},
|
|
125
187
|
ubuntu: {
|
|
126
188
|
...emptyDistributionEnvironment,
|
|
127
|
-
image:
|
|
189
|
+
image: images_default.ubuntu.image,
|
|
128
190
|
allowedEndpoints: [
|
|
129
|
-
//
|
|
130
191
|
"tcp://archive.ubuntu.com:80",
|
|
131
192
|
"tcp://archive.ubuntu.com:443",
|
|
132
193
|
"tcp://security.ubuntu.com:80",
|
|
@@ -141,158 +202,68 @@ var emptyScriptEnvironment = {
|
|
|
141
202
|
environment: {},
|
|
142
203
|
allowedEndpoints: []
|
|
143
204
|
};
|
|
144
|
-
var functionScriptImages = {
|
|
145
|
-
alpine: "oven/bun@sha256:6b14922b0885c3890cdb0b396090af1da486ba941df5ee94391eef64f7113c61",
|
|
146
|
-
ubuntu: "oven/bun@sha256:66b431441dc4c36d7e8164bfc61e6348ec1d7ce2862fc3a29f5dc9856e8205e4"
|
|
147
|
-
};
|
|
148
205
|
|
|
149
206
|
// src/scripting/bundle.ts
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* The config map containing the scripts.
|
|
153
|
-
*/
|
|
207
|
+
class ScriptBundle extends ComponentResource2 {
|
|
154
208
|
configMap;
|
|
155
|
-
/**
|
|
156
|
-
* The volumes that should be included in the workload.
|
|
157
|
-
*/
|
|
158
209
|
volumes;
|
|
159
|
-
/**
|
|
160
|
-
* The volume mounts that should be defined in the container.
|
|
161
|
-
*/
|
|
162
210
|
volumeMounts;
|
|
163
|
-
/**
|
|
164
|
-
* The environment variables that should be defined in the container.
|
|
165
|
-
*/
|
|
166
211
|
environment;
|
|
167
|
-
/**
|
|
168
|
-
* The image to use for the scripts.
|
|
169
|
-
*/
|
|
170
212
|
image;
|
|
171
|
-
/**
|
|
172
|
-
* The distribution to use for the scripts.
|
|
173
|
-
*/
|
|
174
213
|
distribution;
|
|
175
|
-
/**
|
|
176
|
-
* The list of endpoints that the script is allowed to access.
|
|
177
|
-
*/
|
|
178
214
|
allowedEndpoints;
|
|
179
215
|
constructor(name, args, opts) {
|
|
180
216
|
super("highstate:k8s:ScriptBundle", name, args, opts);
|
|
181
|
-
const scriptEnvironment =
|
|
182
|
-
const hasFunctionScripts = scriptEnvironment.apply((scriptEnvironment2) => {
|
|
183
|
-
return Object.values(scriptEnvironment2.files).some((file) => typeof file === "function");
|
|
184
|
-
});
|
|
217
|
+
const scriptEnvironment = output2(args).apply((args2) => normalize(args2.environment, args2.environments)).apply((args2) => deepmerge(emptyScriptEnvironment, ...args2));
|
|
185
218
|
this.distribution = args.distribution;
|
|
186
219
|
this.environment = scriptEnvironment.environment;
|
|
187
|
-
this.image =
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
(
|
|
194
|
-
const allowedEndpoints = [
|
|
195
|
-
...scriptEnvironment2.allowedEndpoints,
|
|
196
|
-
...scriptEnvironment2[args.distribution].allowedEndpoints
|
|
197
|
-
];
|
|
198
|
-
if (hasFunctionScripts2) {
|
|
199
|
-
allowedEndpoints.push("tcp://registry.npmjs.org:443");
|
|
200
|
-
}
|
|
201
|
-
return allowedEndpoints.map((endpoint) => parseEndpoint(endpoint));
|
|
202
|
-
}
|
|
203
|
-
);
|
|
204
|
-
this.configMap = output({ scriptEnvironment, args }).apply(({ scriptEnvironment: scriptEnvironment2, args: args2 }) => {
|
|
205
|
-
return ConfigMap.create(
|
|
206
|
-
name,
|
|
207
|
-
{
|
|
208
|
-
namespace: args2.namespace,
|
|
209
|
-
data: createScriptData(this.distribution, scriptEnvironment2)
|
|
210
|
-
},
|
|
211
|
-
{ ...opts, parent: this }
|
|
212
|
-
);
|
|
220
|
+
this.image = scriptEnvironment[args.distribution].image;
|
|
221
|
+
this.allowedEndpoints = scriptEnvironment.apply((scriptEnvironment2) => {
|
|
222
|
+
const allowedEndpoints = [
|
|
223
|
+
...scriptEnvironment2.allowedEndpoints,
|
|
224
|
+
...scriptEnvironment2[args.distribution].allowedEndpoints
|
|
225
|
+
];
|
|
226
|
+
return allowedEndpoints.map((endpoint) => parseEndpoint(endpoint));
|
|
213
227
|
});
|
|
214
|
-
this.
|
|
215
|
-
(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
228
|
+
this.configMap = output2({ scriptEnvironment, args }).apply(({ scriptEnvironment: scriptEnvironment2, args: args2 }) => {
|
|
229
|
+
return ConfigMap.create(name, {
|
|
230
|
+
namespace: args2.namespace,
|
|
231
|
+
data: createScriptData(this.distribution, scriptEnvironment2)
|
|
232
|
+
}, { ...opts, parent: this });
|
|
233
|
+
});
|
|
234
|
+
this.volumes = scriptEnvironment.volumes.apply((volumes) => {
|
|
235
|
+
return [
|
|
236
|
+
...volumes,
|
|
237
|
+
{
|
|
238
|
+
name: this.configMap.metadata.name,
|
|
239
|
+
configMap: {
|
|
219
240
|
name: this.configMap.metadata.name,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
...hasFunctionScripts2 ? [{ name: "node-modules", emptyDir: {} }] : []
|
|
227
|
-
];
|
|
228
|
-
}
|
|
229
|
-
);
|
|
230
|
-
this.volumeMounts = output({
|
|
231
|
-
hasFunctionScripts,
|
|
232
|
-
volumeMounts: scriptEnvironment.volumeMounts
|
|
233
|
-
}).apply(({ hasFunctionScripts: hasFunctionScripts2, volumeMounts }) => {
|
|
241
|
+
defaultMode: 360
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
];
|
|
245
|
+
});
|
|
246
|
+
this.volumeMounts = scriptEnvironment.volumeMounts.apply((volumeMounts) => {
|
|
234
247
|
return [
|
|
235
248
|
...volumeMounts,
|
|
236
249
|
{
|
|
237
250
|
volume: this.configMap,
|
|
238
251
|
mountPath: "/scripts"
|
|
239
|
-
}
|
|
240
|
-
...hasFunctionScripts2 ? [{ name: "node-modules", mountPath: "/scripts/node_modules" }] : []
|
|
252
|
+
}
|
|
241
253
|
];
|
|
242
254
|
});
|
|
243
255
|
}
|
|
244
|
-
};
|
|
245
|
-
function stripWorkspacePrefix(value) {
|
|
246
|
-
if (value.startsWith("workspace:")) {
|
|
247
|
-
return value.replace("workspace:", "");
|
|
248
|
-
}
|
|
249
|
-
return value;
|
|
250
256
|
}
|
|
251
257
|
async function createScriptData(distribution, environment) {
|
|
252
258
|
const scriptData = {};
|
|
253
259
|
const actions = [];
|
|
254
260
|
const distributionEnvironment = environment[distribution];
|
|
255
261
|
const setupScripts = { ...environment.setupScripts };
|
|
256
|
-
let hasFunctionScripts = false;
|
|
257
262
|
for (const key in environment.files) {
|
|
258
|
-
|
|
259
|
-
const serialized = await serializeFunction(environment.files[key]);
|
|
260
|
-
scriptData[key] = text`
|
|
261
|
-
#!/usr/local/bin/bun
|
|
262
|
-
|
|
263
|
-
${serialized.text}
|
|
264
|
-
|
|
265
|
-
exports.${serialized.exportName}()
|
|
266
|
-
`;
|
|
267
|
-
hasFunctionScripts = true;
|
|
268
|
-
} else {
|
|
269
|
-
scriptData[key] = environment.files[key];
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
if (hasFunctionScripts) {
|
|
273
|
-
const packageJson = await readPackageJSON();
|
|
274
|
-
packageJson.dependencies = omitBy(
|
|
275
|
-
mapValues(packageJson.dependencies ?? {}, stripWorkspacePrefix),
|
|
276
|
-
(_, key) => key.startsWith("@highstate/")
|
|
277
|
-
);
|
|
278
|
-
packageJson.devDependencies = omitBy(
|
|
279
|
-
mapValues(packageJson.devDependencies ?? {}, stripWorkspacePrefix),
|
|
280
|
-
(_, key) => key.startsWith("@highstate/")
|
|
281
|
-
);
|
|
282
|
-
scriptData["package.json"] = JSON.stringify(packageJson, null, 2);
|
|
283
|
-
setupScripts["resolve-dependencies.sh"] = text`
|
|
284
|
-
#!/usr/local/bin/bun
|
|
285
|
-
set -e
|
|
286
|
-
|
|
287
|
-
cd /scripts
|
|
288
|
-
bun install --production
|
|
289
|
-
`;
|
|
263
|
+
scriptData[key] = environment.files[key];
|
|
290
264
|
}
|
|
291
265
|
if (distributionEnvironment.preInstallPackages.length > 0) {
|
|
292
|
-
scriptData["pre-install-packages.sh"] = getInstallPackagesScript(
|
|
293
|
-
distribution,
|
|
294
|
-
distributionEnvironment.preInstallPackages
|
|
295
|
-
);
|
|
266
|
+
scriptData["pre-install-packages.sh"] = getInstallPackagesScript(distribution, distributionEnvironment.preInstallPackages);
|
|
296
267
|
actions.push(`
|
|
297
268
|
echo "+ Installing pre-install packages..."
|
|
298
269
|
/scripts/pre-install-packages.sh
|
|
@@ -310,10 +281,7 @@ async function createScriptData(distribution, environment) {
|
|
|
310
281
|
}
|
|
311
282
|
}
|
|
312
283
|
if (distributionEnvironment.packages.length > 0) {
|
|
313
|
-
scriptData["install-packages.sh"] = getInstallPackagesScript(
|
|
314
|
-
distribution,
|
|
315
|
-
distributionEnvironment.packages
|
|
316
|
-
);
|
|
284
|
+
scriptData["install-packages.sh"] = getInstallPackagesScript(distribution, distributionEnvironment.packages);
|
|
317
285
|
actions.push(`
|
|
318
286
|
echo "+ Installing packages..."
|
|
319
287
|
/scripts/install-packages.sh
|
|
@@ -342,7 +310,9 @@ async function createScriptData(distribution, environment) {
|
|
|
342
310
|
}
|
|
343
311
|
actions.push(`
|
|
344
312
|
function cleanup() {
|
|
345
|
-
${cleanupActions.map((s) => s.trim()).join(
|
|
313
|
+
${cleanupActions.map((s) => s.trim()).join(`
|
|
314
|
+
|
|
315
|
+
`)}
|
|
346
316
|
}
|
|
347
317
|
|
|
348
318
|
trap cleanup EXIT
|
|
@@ -358,7 +328,9 @@ async function createScriptData(distribution, environment) {
|
|
|
358
328
|
exit 1
|
|
359
329
|
fi
|
|
360
330
|
|
|
361
|
-
${actions.map((s) => s.trim()).join(
|
|
331
|
+
${actions.map((s) => s.trim()).join(`
|
|
332
|
+
|
|
333
|
+
`)}
|
|
362
334
|
|
|
363
335
|
echo "+ Running main script..."
|
|
364
336
|
$@
|
|
@@ -384,9 +356,12 @@ function getInstallPackagesScript(distribution, packages) {
|
|
|
384
356
|
`;
|
|
385
357
|
}
|
|
386
358
|
}
|
|
359
|
+
// src/scripting/container.ts
|
|
360
|
+
import { output as output3 } from "@pulumi/pulumi";
|
|
361
|
+
import { merge } from "remeda";
|
|
387
362
|
function createScriptContainer(options) {
|
|
388
|
-
const bundle =
|
|
389
|
-
return
|
|
363
|
+
const bundle = output3(options.bundle);
|
|
364
|
+
return output3({
|
|
390
365
|
options,
|
|
391
366
|
image: bundle.image,
|
|
392
367
|
volumeMounts: bundle.volumeMounts,
|
|
@@ -405,6 +380,8 @@ function createScriptContainer(options) {
|
|
|
405
380
|
};
|
|
406
381
|
});
|
|
407
382
|
}
|
|
383
|
+
// src/worker.ts
|
|
384
|
+
import { output as output4 } from "@pulumi/pulumi";
|
|
408
385
|
async function createMonitorWorker(namespace, resources) {
|
|
409
386
|
const scope = new ClusterAccessScope("monitor", {
|
|
410
387
|
rule: {
|
|
@@ -415,16 +392,83 @@ async function createMonitorWorker(namespace, resources) {
|
|
|
415
392
|
namespace,
|
|
416
393
|
resources
|
|
417
394
|
});
|
|
418
|
-
return
|
|
395
|
+
return output4({
|
|
419
396
|
name: "monitor",
|
|
420
|
-
image:
|
|
397
|
+
image: images_default["worker.k8s-monitor"].image,
|
|
421
398
|
params: {
|
|
422
399
|
kubeconfig: getClusterKubeconfigContent(scope.cluster),
|
|
423
|
-
resources:
|
|
400
|
+
resources: output4(resources).apply((resources2) => resources2.map((r) => r.entity))
|
|
424
401
|
}
|
|
425
402
|
});
|
|
426
403
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
404
|
+
export {
|
|
405
|
+
workloadServiceExtraArgs,
|
|
406
|
+
workloadExtraArgs,
|
|
407
|
+
validateCluster,
|
|
408
|
+
resolveHelmChart,
|
|
409
|
+
resolveBackendRef,
|
|
410
|
+
requireBestEndpoint,
|
|
411
|
+
podSpecDefaults,
|
|
412
|
+
networkPolicyMediator,
|
|
413
|
+
mapWorkloadVolume,
|
|
414
|
+
mapVolumeMount,
|
|
415
|
+
mapServiceToLabelSelector,
|
|
416
|
+
mapSelectorLikeToSelector,
|
|
417
|
+
mapNamespaceNameToSelector,
|
|
418
|
+
mapMetadata,
|
|
419
|
+
mapHttpRouteRuleMatch,
|
|
420
|
+
mapEnvironmentSource,
|
|
421
|
+
mapContainerToRaw,
|
|
422
|
+
mapContainerPortToServicePort,
|
|
423
|
+
mapContainerEnvironment,
|
|
424
|
+
l4EndpointToServicePort,
|
|
425
|
+
isEndpointFromCluster,
|
|
426
|
+
images_default as images,
|
|
427
|
+
getWorkloadVolumeResourceUuid,
|
|
428
|
+
getWorkloadServiceComponents,
|
|
429
|
+
getWorkloadComponents,
|
|
430
|
+
getServiceType,
|
|
431
|
+
getProviderAsync,
|
|
432
|
+
getProvider,
|
|
433
|
+
getNamespaceName,
|
|
434
|
+
getFallbackContainerName,
|
|
435
|
+
getEmbeddedSecretFileContent,
|
|
436
|
+
getClusterKubeconfigContent,
|
|
437
|
+
getChartServiceOutput,
|
|
438
|
+
getChartService,
|
|
439
|
+
getBestEndpoint,
|
|
440
|
+
getAutoVolumeName,
|
|
441
|
+
filterPatchOwnedContainersInTemplate,
|
|
442
|
+
emptyScriptEnvironment,
|
|
443
|
+
dns01SolverMediator,
|
|
444
|
+
detectExternalIps,
|
|
445
|
+
createServiceSpec,
|
|
446
|
+
createScriptContainer,
|
|
447
|
+
createMonitorWorker,
|
|
448
|
+
createK8sTerminal,
|
|
449
|
+
commonExtraArgs,
|
|
450
|
+
Workload,
|
|
451
|
+
UdpRoute,
|
|
452
|
+
TcpRoute,
|
|
453
|
+
StatefulSet,
|
|
454
|
+
Service,
|
|
455
|
+
Secret,
|
|
456
|
+
ScriptBundle,
|
|
457
|
+
Resource,
|
|
458
|
+
RenderedChart,
|
|
459
|
+
PersistentVolumeClaim,
|
|
460
|
+
NetworkPolicy,
|
|
461
|
+
NativeNetworkPolicy,
|
|
462
|
+
NamespacedResource,
|
|
463
|
+
Namespace,
|
|
464
|
+
KubeCommand,
|
|
465
|
+
Job,
|
|
466
|
+
HttpRoute,
|
|
467
|
+
Gateway,
|
|
468
|
+
Deployment,
|
|
469
|
+
CronJob,
|
|
470
|
+
ConfigMap,
|
|
471
|
+
ClusterAccessScope,
|
|
472
|
+
Chart,
|
|
473
|
+
Certificate
|
|
474
|
+
};
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
Chart
|
|
4
|
+
} from "../../chunk-pqc6w52f.js";
|
|
5
|
+
import"../../chunk-7kgjgcft.js";
|
|
6
|
+
import"../../chunk-z6bmpnm7.js";
|
|
7
|
+
import"../../chunk-h1b79v66.js";
|
|
8
|
+
import"../../chunk-k4w9zpn5.js";
|
|
9
|
+
import {
|
|
10
|
+
Namespace
|
|
11
|
+
} from "../../chunk-facs31cb.js";
|
|
12
|
+
import"../../chunk-b05q6fm2.js";
|
|
13
|
+
|
|
14
|
+
// src/units/cert-manager/index.ts
|
|
15
|
+
import { k8s } from "@highstate/library";
|
|
16
|
+
import { forUnit } from "@highstate/pulumi";
|
|
10
17
|
|
|
11
18
|
// assets/charts.json
|
|
12
19
|
var charts_default = {
|
|
@@ -38,7 +45,6 @@ new Chart("cert-manager", {
|
|
|
38
45
|
var cert_manager_default = outputs({
|
|
39
46
|
k8sCluster: inputs.k8sCluster
|
|
40
47
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
|
48
|
+
export {
|
|
49
|
+
cert_manager_default as default
|
|
50
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { k8s } from '@highstate/library';
|
|
4
|
-
import { forUnit, toPromise } from '@highstate/pulumi';
|
|
1
|
+
// @bun
|
|
2
|
+
import"../../chunk-b05q6fm2.js";
|
|
5
3
|
|
|
4
|
+
// src/units/cluster-patch/index.ts
|
|
5
|
+
import { l3EndpointToString, l4EndpointToString, parseEndpoints } from "@highstate/common";
|
|
6
|
+
import { k8s } from "@highstate/library";
|
|
7
|
+
import { forUnit, toPromise } from "@highstate/pulumi";
|
|
6
8
|
var { args, inputs, outputs } = forUnit(k8s.clusterPatch);
|
|
7
9
|
var cluster = await toPromise(inputs.k8sCluster);
|
|
8
10
|
var endpoints = parseEndpoints([...args.endpoints, ...inputs.endpoints], 3);
|
|
@@ -20,7 +22,6 @@ var cluster_patch_default = outputs({
|
|
|
20
22
|
apiEndpoints: apiEndpoints.map(l4EndpointToString)
|
|
21
23
|
}
|
|
22
24
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
25
|
+
export {
|
|
26
|
+
cluster_patch_default as default
|
|
27
|
+
};
|