@highstate/k8s 0.9.16 → 0.9.19

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.
Files changed (95) hide show
  1. package/dist/chunk-2EEHJZPD.js +13 -0
  2. package/dist/chunk-2EEHJZPD.js.map +1 -0
  3. package/dist/{chunk-OFFSHGC6.js → chunk-4JGXGN2L.js} +66 -48
  4. package/dist/chunk-4JGXGN2L.js.map +1 -0
  5. package/dist/chunk-A3XGSDIW.js +306 -0
  6. package/dist/chunk-A3XGSDIW.js.map +1 -0
  7. package/dist/chunk-IMTXUK2U.js +244 -0
  8. package/dist/chunk-IMTXUK2U.js.map +1 -0
  9. package/dist/chunk-JYNXQ3I3.js +287 -0
  10. package/dist/chunk-JYNXQ3I3.js.map +1 -0
  11. package/dist/{chunk-5C2BJGES.js → chunk-KDD6XUWM.js} +30 -23
  12. package/dist/chunk-KDD6XUWM.js.map +1 -0
  13. package/dist/chunk-NOFJC3EM.js +236 -0
  14. package/dist/chunk-NOFJC3EM.js.map +1 -0
  15. package/dist/chunk-NXSYCA3V.js +337 -0
  16. package/dist/chunk-NXSYCA3V.js.map +1 -0
  17. package/dist/chunk-SBC3TUIN.js +1513 -0
  18. package/dist/chunk-SBC3TUIN.js.map +1 -0
  19. package/dist/chunk-SI7X6N46.js +338 -0
  20. package/dist/chunk-SI7X6N46.js.map +1 -0
  21. package/dist/chunk-WGMJCZSK.js +360 -0
  22. package/dist/chunk-WGMJCZSK.js.map +1 -0
  23. package/dist/deployment-752P6JIT.js +8 -0
  24. package/dist/{deployment-XK3CDJOE.js.map → deployment-752P6JIT.js.map} +1 -1
  25. package/dist/highstate.manifest.json +8 -7
  26. package/dist/impl/gateway-route.js +123 -0
  27. package/dist/impl/gateway-route.js.map +1 -0
  28. package/dist/impl/tls-certificate.js +32 -0
  29. package/dist/impl/tls-certificate.js.map +1 -0
  30. package/dist/index.js +736 -208
  31. package/dist/index.js.map +1 -1
  32. package/dist/stateful-set-N64YVKR7.js +8 -0
  33. package/dist/{stateful-set-7CAQWTV2.js.map → stateful-set-N64YVKR7.js.map} +1 -1
  34. package/dist/units/cert-manager/index.js +11 -10
  35. package/dist/units/cert-manager/index.js.map +1 -1
  36. package/dist/units/cluster-dns/index.js.map +1 -1
  37. package/dist/units/cluster-patch/index.js.map +1 -1
  38. package/dist/units/dns01-issuer/index.js +27 -23
  39. package/dist/units/dns01-issuer/index.js.map +1 -1
  40. package/dist/units/existing-cluster/index.js +11 -8
  41. package/dist/units/existing-cluster/index.js.map +1 -1
  42. package/dist/units/gateway-api/index.js +2 -2
  43. package/dist/units/gateway-api/index.js.map +1 -1
  44. package/package.json +40 -14
  45. package/src/cluster.ts +30 -22
  46. package/src/config-map.ts +195 -57
  47. package/src/container.ts +5 -5
  48. package/src/cron-job.ts +403 -31
  49. package/src/deployment.ts +260 -120
  50. package/src/dns01-solver.ts +10 -0
  51. package/src/gateway/backend.ts +2 -2
  52. package/src/gateway/gateway.ts +383 -0
  53. package/src/gateway/http-route.ts +17 -24
  54. package/src/gateway/index.ts +1 -0
  55. package/src/helm.ts +83 -53
  56. package/src/impl/gateway-route.ts +155 -0
  57. package/src/impl/tls-certificate.ts +33 -0
  58. package/src/index.ts +22 -67
  59. package/src/job.ts +393 -28
  60. package/src/namespace.ts +236 -99
  61. package/src/network-policy.ts +216 -165
  62. package/src/network.ts +2 -2
  63. package/src/pvc.ts +266 -65
  64. package/src/rbac.ts +218 -0
  65. package/src/scripting/bundle.ts +9 -20
  66. package/src/scripting/container.ts +1 -1
  67. package/src/scripting/environment.ts +5 -5
  68. package/src/secret.ts +200 -62
  69. package/src/service.ts +288 -158
  70. package/src/shared.ts +94 -67
  71. package/src/stateful-set.ts +270 -117
  72. package/src/tls.ts +344 -0
  73. package/src/units/cert-manager/index.ts +2 -3
  74. package/src/units/dns01-issuer/index.ts +30 -14
  75. package/src/units/existing-cluster/index.ts +10 -7
  76. package/src/units/gateway-api/index.ts +2 -2
  77. package/src/worker.ts +26 -0
  78. package/src/workload.ts +275 -171
  79. package/dist/chunk-5C2BJGES.js.map +0 -1
  80. package/dist/chunk-5TLC5BXR.js +0 -256
  81. package/dist/chunk-5TLC5BXR.js.map +0 -1
  82. package/dist/chunk-BBIY3KUN.js +0 -1557
  83. package/dist/chunk-BBIY3KUN.js.map +0 -1
  84. package/dist/chunk-OFFSHGC6.js.map +0 -1
  85. package/dist/chunk-TZHOUJRC.js +0 -202
  86. package/dist/chunk-TZHOUJRC.js.map +0 -1
  87. package/dist/chunk-YWRJ4EZM.js +0 -192
  88. package/dist/chunk-YWRJ4EZM.js.map +0 -1
  89. package/dist/deployment-XK3CDJOE.js +0 -6
  90. package/dist/stateful-set-7CAQWTV2.js +0 -6
  91. package/dist/units/access-point/index.js +0 -21
  92. package/dist/units/access-point/index.js.map +0 -1
  93. package/src/access-point.ts +0 -191
  94. package/src/units/access-point/index.ts +0 -19
  95. package/src/units/dns01-issuer/solver.ts +0 -23
@@ -0,0 +1,244 @@
1
+ import { ScopedResource, Namespace, mapMetadata, getProvider } from './chunk-WGMJCZSK.js';
2
+ import { getOrCreate } from '@highstate/contract';
3
+ import { toPromise } from '@highstate/pulumi';
4
+ import { core } from '@pulumi/kubernetes';
5
+ import { output, interpolate } from '@pulumi/pulumi';
6
+
7
+ var Secret = class _Secret extends ScopedResource {
8
+ constructor(type, name, args, opts, apiVersion, kind, namespace, metadata, data, stringData) {
9
+ super(type, name, args, opts, apiVersion, kind, namespace, metadata);
10
+ this.data = data;
11
+ this.stringData = stringData;
12
+ }
13
+ /**
14
+ * The Highstate secret entity.
15
+ */
16
+ get entity() {
17
+ return output({
18
+ type: "secret",
19
+ clusterId: this.cluster.id,
20
+ clusterName: this.cluster.name,
21
+ metadata: this.metadata
22
+ });
23
+ }
24
+ /**
25
+ * Gets the value of the secret field by the given key in `data`.
26
+ *
27
+ * Automatically decodes the base64 value.
28
+ *
29
+ * @param key The key of the secret.
30
+ * @returns The value of the secret.
31
+ */
32
+ getValue(key) {
33
+ return this.data[key].apply((value) => Buffer.from(value, "base64").toString());
34
+ }
35
+ /**
36
+ * Creates a new secret.
37
+ */
38
+ static create(name, args, opts) {
39
+ return new CreatedSecret(name, args, opts);
40
+ }
41
+ /**
42
+ * Creates a new secret or patches an existing one.
43
+ *
44
+ * @param name The name of the resource. May not be the same as the secret name.
45
+ * @param args The arguments to create or patch the secret with.
46
+ * @param opts Optional resource options.
47
+ */
48
+ static createOrPatch(name, args, opts) {
49
+ if (args.existing) {
50
+ return new SecretPatch(name, {
51
+ ...args,
52
+ name: output(args.existing).metadata.name
53
+ });
54
+ }
55
+ return new CreatedSecret(name, args, opts);
56
+ }
57
+ /**
58
+ * Creates a new secret or gets an existing one.
59
+ *
60
+ * @param name The name of the resource. May not be the same as the secret name. Will not be used when existing secret is retrieved.
61
+ * @param args The arguments to create or get the secret with.
62
+ * @param opts Optional resource options.
63
+ */
64
+ static async createOrGet(name, args, opts) {
65
+ if (args.existing) {
66
+ return await _Secret.forAsync(args.existing, output(args.namespace).cluster);
67
+ }
68
+ return new CreatedSecret(name, args, opts);
69
+ }
70
+ /**
71
+ * Patches an existing secret.
72
+ *
73
+ * Will throw an error if the secret does not exist.
74
+ *
75
+ * @param name The name of the resource. May not be the same as the secret name.
76
+ * @param args The arguments to patch the secret with.
77
+ * @param opts Optional resource options.
78
+ */
79
+ static patch(name, args, opts) {
80
+ return new SecretPatch(name, args, opts);
81
+ }
82
+ /**
83
+ * Wraps an existing Kubernetes secret.
84
+ */
85
+ static wrap(name, args, opts) {
86
+ return new WrappedSecret(name, args, opts);
87
+ }
88
+ /**
89
+ * Gets an existing secret.
90
+ *
91
+ * Will throw an error if the secret does not exist.
92
+ */
93
+ static get(name, args, opts) {
94
+ return new ExternalSecret(name, args, opts);
95
+ }
96
+ static secretCache = /* @__PURE__ */ new Map();
97
+ /**
98
+ * Gets an existing secret for a given entity.
99
+ * Prefer this method over `get` when possible.
100
+ *
101
+ * It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.
102
+ *
103
+ * This method is idempotent and will return the same instance for the same entity.
104
+ *
105
+ * @param entity The entity to get the secret for.
106
+ * @param cluster The cluster where the secret is located.
107
+ */
108
+ static for(entity, cluster) {
109
+ return getOrCreate(
110
+ _Secret.secretCache,
111
+ `${entity.clusterName}.${entity.metadata.namespace}.${entity.metadata.name}.${entity.clusterId}`,
112
+ (name) => {
113
+ return _Secret.get(name, {
114
+ name: entity.metadata.name,
115
+ namespace: Namespace.forResource(entity, cluster)
116
+ });
117
+ }
118
+ );
119
+ }
120
+ /**
121
+ * Gets an existing secret for a given entity.
122
+ * Prefer this method over `get` when possible.
123
+ *
124
+ * It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.
125
+ *
126
+ * This method is idempotent and will return the same instance for the same entity.
127
+ *
128
+ * @param entity The entity to get the secret for.
129
+ * @param cluster The cluster where the secret is located.
130
+ */
131
+ static async forAsync(entity, cluster) {
132
+ const resolvedEntity = await toPromise(entity);
133
+ return _Secret.for(resolvedEntity, cluster);
134
+ }
135
+ };
136
+ var CreatedSecret = class extends Secret {
137
+ constructor(name, args, opts) {
138
+ const secret = output(args.namespace).cluster.apply((cluster) => {
139
+ return new core.v1.Secret(
140
+ name,
141
+ {
142
+ metadata: mapMetadata(args, name),
143
+ data: args.data,
144
+ stringData: args.stringData,
145
+ type: args.type,
146
+ immutable: args.immutable
147
+ },
148
+ {
149
+ ...opts,
150
+ parent: this,
151
+ provider: getProvider(cluster)
152
+ }
153
+ );
154
+ });
155
+ super(
156
+ "highstate:k8s:Secret",
157
+ name,
158
+ args,
159
+ opts,
160
+ secret.apiVersion,
161
+ secret.kind,
162
+ output(args.namespace),
163
+ secret.metadata,
164
+ secret.data,
165
+ secret.stringData
166
+ );
167
+ }
168
+ };
169
+ var SecretPatch = class extends Secret {
170
+ constructor(name, args, opts) {
171
+ const secret = output(args.namespace).cluster.apply((cluster) => {
172
+ return new core.v1.SecretPatch(
173
+ name,
174
+ {
175
+ metadata: mapMetadata(args, name),
176
+ data: args.data,
177
+ stringData: args.stringData,
178
+ type: args.type,
179
+ immutable: args.immutable
180
+ },
181
+ {
182
+ ...opts,
183
+ parent: this,
184
+ provider: getProvider(cluster)
185
+ }
186
+ );
187
+ });
188
+ super(
189
+ "highstate:k8s:SecretPatch",
190
+ name,
191
+ args,
192
+ opts,
193
+ secret.apiVersion,
194
+ secret.kind,
195
+ output(args.namespace),
196
+ secret.metadata,
197
+ secret.data,
198
+ secret.stringData
199
+ );
200
+ }
201
+ };
202
+ var WrappedSecret = class extends Secret {
203
+ constructor(name, args, opts) {
204
+ super(
205
+ "highstate:k8s:WrappedSecret",
206
+ name,
207
+ args,
208
+ opts,
209
+ output(args.secret).apiVersion,
210
+ output(args.secret).kind,
211
+ output(args.namespace),
212
+ output(args.secret).metadata,
213
+ output(args.secret).data,
214
+ output(args.secret).stringData
215
+ );
216
+ }
217
+ };
218
+ var ExternalSecret = class extends Secret {
219
+ constructor(name, args, opts) {
220
+ const secret = output(args.namespace).cluster.apply((cluster) => {
221
+ return core.v1.Secret.get(
222
+ name,
223
+ interpolate`${output(args.namespace).metadata.name}/${args.name}`,
224
+ { ...opts, parent: this, provider: getProvider(cluster) }
225
+ );
226
+ });
227
+ super(
228
+ "highstate:k8s:ExternalSecret",
229
+ name,
230
+ args,
231
+ opts,
232
+ secret.apiVersion,
233
+ secret.kind,
234
+ output(args.namespace),
235
+ secret.metadata,
236
+ secret.data,
237
+ secret.stringData
238
+ );
239
+ }
240
+ };
241
+
242
+ export { Secret };
243
+ //# sourceMappingURL=chunk-IMTXUK2U.js.map
244
+ //# sourceMappingURL=chunk-IMTXUK2U.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/secret.ts"],"names":[],"mappings":";;;;;;AA4BO,IAAe,MAAA,GAAf,MAAe,OAAA,SAAe,cAAA,CAAe;AAAA,EACxC,WAAA,CACR,IAAA,EACA,IAAA,EACA,IAAA,EACA,IAAA,EAEA,YACA,IAAA,EACA,SA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MACE,8BAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA;AAAA,MAEA,MAAA,CAAO,UAAA;AAAA,MACP,MAAA,CAAO,IAAA;AAAA,MACP,MAAA,CAAO,KAAK,SAAS,CAAA;AAAA,MACrB,MAAA,CAAO,QAAA;AAAA,MACP,MAAA,CAAO,IAAA;AAAA,MACP,MAAA,CAAO;AAAA,KACT;AAAA,EACF;AACF,CAAA","file":"chunk-IMTXUK2U.js","sourcesContent":["import type { k8s } from \"@highstate/library\"\nimport { getOrCreate } from \"@highstate/contract\"\nimport { toPromise } from \"@highstate/pulumi\"\nimport { core, type types } from \"@pulumi/kubernetes\"\nimport {\n type ComponentResourceOptions,\n type Input,\n type Inputs,\n interpolate,\n type Output,\n output,\n} from \"@pulumi/pulumi\"\nimport { getProvider, mapMetadata, type ScopedResourceArgs, ScopedResource } from \"./shared\"\nimport { Namespace } from \"./namespace\"\n\nexport type SecretArgs = ScopedResourceArgs &\n Omit<types.input.core.v1.Secret, \"kind\" | \"metadata\" | \"apiVersion\">\n\nexport type CreateOrGetSecretArgs = SecretArgs & {\n /**\n * The secret entity to patch/retrieve.\n */\n existing: Input<k8s.ScopedResource> | undefined\n}\n\n/**\n * Represents a Kubernetes Secret resource with metadata and data.\n */\nexport abstract class Secret extends ScopedResource {\n protected constructor(\n type: string,\n name: string,\n args: Inputs,\n opts: ComponentResourceOptions | undefined,\n\n apiVersion: Output<string>,\n kind: Output<string>,\n namespace: Output<Namespace>,\n metadata: Output<types.output.meta.v1.ObjectMeta>,\n\n /**\n * The data of the underlying Kubernetes secret.\n */\n readonly data: Output<Record<string, string>>,\n\n /**\n * The stringData of the underlying Kubernetes secret.\n */\n readonly stringData: Output<Record<string, string>>,\n ) {\n super(type, name, args, opts, apiVersion, kind, namespace, metadata)\n }\n\n /**\n * The Highstate secret entity.\n */\n get entity(): Output<k8s.ScopedResource> {\n return output({\n type: \"secret\",\n clusterId: this.cluster.id,\n clusterName: this.cluster.name,\n metadata: this.metadata,\n })\n }\n\n /**\n * Gets the value of the secret field by the given key in `data`.\n *\n * Automatically decodes the base64 value.\n *\n * @param key The key of the secret.\n * @returns The value of the secret.\n */\n getValue(key: string): Output<string> {\n return this.data[key].apply(value => Buffer.from(value, \"base64\").toString())\n }\n\n /**\n * Creates a new secret.\n */\n static create(name: string, args: SecretArgs, opts?: ComponentResourceOptions): Secret {\n return new CreatedSecret(name, args, opts)\n }\n\n /**\n * Creates a new secret or patches an existing one.\n *\n * @param name The name of the resource. May not be the same as the secret name.\n * @param args The arguments to create or patch the secret with.\n * @param opts Optional resource options.\n */\n static createOrPatch(\n name: string,\n args: CreateOrGetSecretArgs,\n opts?: ComponentResourceOptions,\n ): Secret {\n if (args.existing) {\n return new SecretPatch(name, {\n ...args,\n name: output(args.existing).metadata.name,\n })\n }\n\n return new CreatedSecret(name, args, opts)\n }\n\n /**\n * Creates a new secret or gets an existing one.\n *\n * @param name The name of the resource. May not be the same as the secret name. Will not be used when existing secret is retrieved.\n * @param args The arguments to create or get the secret with.\n * @param opts Optional resource options.\n */\n static async createOrGet(\n name: string,\n args: CreateOrGetSecretArgs,\n opts?: ComponentResourceOptions,\n ): Promise<Secret> {\n if (args.existing) {\n return await Secret.forAsync(args.existing, output(args.namespace).cluster)\n }\n\n return new CreatedSecret(name, args, opts)\n }\n\n /**\n * Patches an existing secret.\n *\n * Will throw an error if the secret does not exist.\n *\n * @param name The name of the resource. May not be the same as the secret name.\n * @param args The arguments to patch the secret with.\n * @param opts Optional resource options.\n */\n static patch(name: string, args: SecretArgs, opts?: ComponentResourceOptions): Secret {\n return new SecretPatch(name, args, opts)\n }\n\n /**\n * Wraps an existing Kubernetes secret.\n */\n static wrap(name: string, args: WrappedSecretArgs, opts?: ComponentResourceOptions): Secret {\n return new WrappedSecret(name, args, opts)\n }\n\n /**\n * Gets an existing secret.\n *\n * Will throw an error if the secret does not exist.\n */\n static get(name: string, args: ExternalSecretArgs, opts?: ComponentResourceOptions): Secret {\n return new ExternalSecret(name, args, opts)\n }\n\n private static readonly secretCache = new Map<string, Secret>()\n\n /**\n * Gets an existing secret for a given entity.\n * Prefer this method over `get` when possible.\n *\n * It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.\n *\n * This method is idempotent and will return the same instance for the same entity.\n *\n * @param entity The entity to get the secret for.\n * @param cluster The cluster where the secret is located.\n */\n static for(entity: k8s.ScopedResource, cluster: Input<k8s.Cluster>): Secret {\n return getOrCreate(\n Secret.secretCache,\n `${entity.clusterName}.${entity.metadata.namespace}.${entity.metadata.name}.${entity.clusterId}`,\n name => {\n return Secret.get(name, {\n name: entity.metadata.name,\n namespace: Namespace.forResource(entity, cluster),\n })\n },\n )\n }\n\n /**\n * Gets an existing secret for a given entity.\n * Prefer this method over `get` when possible.\n *\n * It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.\n *\n * This method is idempotent and will return the same instance for the same entity.\n *\n * @param entity The entity to get the secret for.\n * @param cluster The cluster where the secret is located.\n */\n static async forAsync(\n entity: Input<k8s.ScopedResource>,\n cluster: Input<k8s.Cluster>,\n ): Promise<Secret> {\n const resolvedEntity = await toPromise(entity)\n return Secret.for(resolvedEntity, cluster)\n }\n}\n\nclass CreatedSecret extends Secret {\n constructor(name: string, args: SecretArgs, opts?: ComponentResourceOptions) {\n const secret = output(args.namespace).cluster.apply(cluster => {\n return new core.v1.Secret(\n name,\n {\n metadata: mapMetadata(args, name),\n data: args.data,\n stringData: args.stringData,\n type: args.type,\n immutable: args.immutable,\n },\n {\n ...opts,\n parent: this,\n provider: getProvider(cluster),\n },\n )\n })\n\n super(\n \"highstate:k8s:Secret\",\n name,\n args,\n opts,\n secret.apiVersion,\n secret.kind,\n output(args.namespace),\n secret.metadata,\n secret.data,\n secret.stringData,\n )\n }\n}\n\nclass SecretPatch extends Secret {\n constructor(name: string, args: SecretArgs, opts?: ComponentResourceOptions) {\n const secret = output(args.namespace).cluster.apply(cluster => {\n return new core.v1.SecretPatch(\n name,\n {\n metadata: mapMetadata(args, name),\n data: args.data,\n stringData: args.stringData,\n type: args.type,\n immutable: args.immutable,\n },\n {\n ...opts,\n parent: this,\n provider: getProvider(cluster),\n },\n )\n })\n\n super(\n \"highstate:k8s:SecretPatch\",\n name,\n args,\n opts,\n secret.apiVersion,\n secret.kind,\n output(args.namespace),\n secret.metadata,\n secret.data,\n secret.stringData,\n )\n }\n}\n\nexport type WrappedSecretArgs = {\n /**\n * The underlying Kubernetes secret to wrap.\n */\n secret: Input<core.v1.Secret>\n\n /**\n * The namespace where the secret is located.\n */\n namespace: Input<Namespace>\n}\n\nclass WrappedSecret extends Secret {\n constructor(name: string, args: WrappedSecretArgs, opts?: ComponentResourceOptions) {\n super(\n \"highstate:k8s:WrappedSecret\",\n name,\n args,\n opts,\n\n output(args.secret).apiVersion,\n output(args.secret).kind,\n output(args.namespace),\n output(args.secret).metadata,\n output(args.secret).data,\n output(args.secret).stringData,\n )\n }\n}\n\nexport type ExternalSecretArgs = {\n /**\n * The name of the secret to get.\n */\n name: Input<string>\n\n /**\n * The namespace where the secret is located.\n */\n namespace: Input<Namespace>\n}\n\nclass ExternalSecret extends Secret {\n constructor(name: string, args: ExternalSecretArgs, opts?: ComponentResourceOptions) {\n const secret = output(args.namespace).cluster.apply(cluster => {\n return core.v1.Secret.get(\n name,\n interpolate`${output(args.namespace).metadata.name}/${args.name}`,\n { ...opts, parent: this, provider: getProvider(cluster) },\n )\n })\n\n super(\n \"highstate:k8s:ExternalSecret\",\n name,\n args,\n opts,\n\n secret.apiVersion,\n secret.kind,\n output(args.namespace),\n secret.metadata,\n secret.data,\n secret.stringData,\n )\n }\n}\n"]}
@@ -0,0 +1,287 @@
1
+ import { ExposableWorkload, getExposableWorkloadComponents, exposableWorkloadExtraArgs } from './chunk-SBC3TUIN.js';
2
+ import { Namespace, mapMetadata, getProvider } from './chunk-WGMJCZSK.js';
3
+ import { getOrCreate } from '@highstate/contract';
4
+ import { output, interpolate, toPromise } from '@highstate/pulumi';
5
+ import { apps } from '@pulumi/kubernetes';
6
+ import { deepmerge } from 'deepmerge-ts';
7
+ import { omit } from 'remeda';
8
+
9
+ var Deployment = class _Deployment extends ExposableWorkload {
10
+ constructor(type, name, args, opts, apiVersion, kind, terminalArgs, containers, namespace, metadata, networkPolicy, service, routes, spec, status) {
11
+ super(
12
+ type,
13
+ name,
14
+ args,
15
+ opts,
16
+ apiVersion,
17
+ kind,
18
+ terminalArgs,
19
+ containers,
20
+ namespace,
21
+ metadata,
22
+ networkPolicy,
23
+ service,
24
+ routes
25
+ );
26
+ this.spec = spec;
27
+ this.status = status;
28
+ }
29
+ getTerminalMeta() {
30
+ return output({
31
+ title: "Deployment",
32
+ globalTitle: interpolate`Deployment | ${this.metadata.name}`,
33
+ description: "The shell inside the deployment.",
34
+ icon: "devicon:kubernetes"
35
+ });
36
+ }
37
+ /**
38
+ * The Highstate deployment entity.
39
+ */
40
+ get entity() {
41
+ return output({
42
+ type: "deployment",
43
+ clusterId: this.cluster.id,
44
+ clusterName: this.cluster.name,
45
+ metadata: this.metadata,
46
+ service: this._service.apply((service) => service?.entity)
47
+ });
48
+ }
49
+ /**
50
+ * Creates a new deployment.
51
+ */
52
+ static create(name, args, opts) {
53
+ return new CreatedDeployment(name, args, opts);
54
+ }
55
+ /**
56
+ * Creates a new deployment or patches an existing one.
57
+ *
58
+ * @param name The name of the resource. May not be the same as the deployment name.
59
+ * @param args The arguments to create or patch the deployment with.
60
+ * @param opts Optional resource options.
61
+ */
62
+ static createOrPatch(name, args, opts) {
63
+ if (args.existing) {
64
+ return new DeploymentPatch(name, {
65
+ ...args,
66
+ name: output(args.existing).metadata.name,
67
+ namespace: Namespace.forResourceAsync(args.existing, output(args.namespace).cluster)
68
+ });
69
+ }
70
+ return new CreatedDeployment(name, args, opts);
71
+ }
72
+ /**
73
+ * Creates a new deployment or gets an existing one.
74
+ *
75
+ * @param name The name of the resource. May not be the same as the deployment name. Will not be used when existing deployment is retrieved.
76
+ * @param args The arguments to create or get the deployment with.
77
+ * @param opts Optional resource options.
78
+ */
79
+ static async createOrGet(name, args, opts) {
80
+ if (args.existing) {
81
+ return await _Deployment.forAsync(args.existing, output(args.namespace).cluster);
82
+ }
83
+ return new CreatedDeployment(name, args, opts);
84
+ }
85
+ /**
86
+ * Patches an existing deployment.
87
+ *
88
+ * Will throw an error if the deployment does not exist.
89
+ *
90
+ * @param name The name of the resource. May not be the same as the deployment name.
91
+ * @param args The arguments to patch the deployment with.
92
+ * @param opts Optional resource options.
93
+ */
94
+ static patch(name, args, opts) {
95
+ return new DeploymentPatch(name, args, opts);
96
+ }
97
+ /**
98
+ * Wraps an existing Kubernetes deployment.
99
+ */
100
+ static wrap(name, args, opts) {
101
+ return new WrappedDeployment(name, args, opts);
102
+ }
103
+ /**
104
+ * Gets an existing deployment.
105
+ *
106
+ * Will throw an error if the deployment does not exist.
107
+ */
108
+ static get(name, args, opts) {
109
+ return new ExternalDeployment(name, args, opts);
110
+ }
111
+ static deploymentCache = /* @__PURE__ */ new Map();
112
+ /**
113
+ * Gets an existing deployment for a given entity.
114
+ * Prefer this method over `get` when possible.
115
+ *
116
+ * It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.
117
+ *
118
+ * This method is idempotent and will return the same instance for the same entity.
119
+ *
120
+ * @param entity The entity to get the deployment for.
121
+ * @param cluster The cluster where the deployment is located.
122
+ */
123
+ static for(entity, cluster) {
124
+ return getOrCreate(
125
+ _Deployment.deploymentCache,
126
+ `${entity.clusterName}.${entity.metadata.namespace}.${entity.metadata.name}.${entity.clusterId}`,
127
+ (name) => {
128
+ return _Deployment.get(name, {
129
+ name: entity.metadata.name,
130
+ namespace: Namespace.forResource(entity, cluster)
131
+ });
132
+ }
133
+ );
134
+ }
135
+ /**
136
+ * Gets an existing deployment for a given entity.
137
+ * Prefer this method over `get` when possible.
138
+ *
139
+ * It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.
140
+ *
141
+ * This method is idempotent and will return the same instance for the same entity.
142
+ *
143
+ * @param entity The entity to get the deployment for.
144
+ * @param cluster The cluster where the deployment is located.
145
+ */
146
+ static async forAsync(entity, cluster) {
147
+ const resolvedEntity = await toPromise(entity);
148
+ return _Deployment.for(resolvedEntity, cluster);
149
+ }
150
+ };
151
+ var CreatedDeployment = class extends Deployment {
152
+ constructor(name, args, opts) {
153
+ const { labels, podTemplate, networkPolicy, containers, service, routes } = getExposableWorkloadComponents(name, args, () => this, opts);
154
+ const deployment = output(args.namespace).cluster.apply((cluster) => {
155
+ return new apps.v1.Deployment(
156
+ name,
157
+ {
158
+ metadata: mapMetadata(args, name),
159
+ spec: output({ args, podTemplate, labels }).apply(({ args: args2, podTemplate: podTemplate2, labels: labels2 }) => {
160
+ return deepmerge(
161
+ {
162
+ template: podTemplate2,
163
+ selector: { matchLabels: labels2 }
164
+ },
165
+ omit(args2, exposableWorkloadExtraArgs)
166
+ );
167
+ })
168
+ },
169
+ { ...opts, parent: this, provider: getProvider(cluster) }
170
+ );
171
+ });
172
+ super(
173
+ "highstate:k8s:Deployment",
174
+ name,
175
+ args,
176
+ opts,
177
+ deployment.apiVersion,
178
+ deployment.kind,
179
+ output(args.terminal ?? {}),
180
+ containers,
181
+ output(args.namespace),
182
+ deployment.metadata,
183
+ networkPolicy,
184
+ service,
185
+ routes,
186
+ deployment.spec,
187
+ deployment.status
188
+ );
189
+ }
190
+ };
191
+ var DeploymentPatch = class extends Deployment {
192
+ constructor(name, args, opts) {
193
+ const { labels, podTemplate, networkPolicy, containers, service, routes } = getExposableWorkloadComponents(name, args, () => this, opts);
194
+ const deployment = output(args.namespace).cluster.apply((cluster) => {
195
+ return new apps.v1.DeploymentPatch(
196
+ name,
197
+ {
198
+ metadata: mapMetadata(args, name),
199
+ spec: output({ args, podTemplate, labels }).apply(({ args: args2, podTemplate: podTemplate2, labels: labels2 }) => {
200
+ return deepmerge(
201
+ {
202
+ template: podTemplate2,
203
+ selector: { matchLabels: labels2 }
204
+ },
205
+ omit(args2, exposableWorkloadExtraArgs)
206
+ );
207
+ })
208
+ },
209
+ {
210
+ ...opts,
211
+ parent: this,
212
+ provider: getProvider(cluster)
213
+ }
214
+ );
215
+ });
216
+ super(
217
+ "highstate:k8s:DeploymentPatch",
218
+ name,
219
+ args,
220
+ opts,
221
+ deployment.apiVersion,
222
+ deployment.kind,
223
+ output(args.terminal ?? {}),
224
+ containers,
225
+ output(args.namespace),
226
+ deployment.metadata,
227
+ networkPolicy,
228
+ service,
229
+ routes,
230
+ deployment.spec,
231
+ deployment.status
232
+ );
233
+ }
234
+ };
235
+ var WrappedDeployment = class extends Deployment {
236
+ constructor(name, args, opts) {
237
+ super(
238
+ "highstate:k8s:WrappedDeployment",
239
+ name,
240
+ args,
241
+ opts,
242
+ output(args.deployment).apiVersion,
243
+ output(args.deployment).kind,
244
+ output(args.terminal ?? {}),
245
+ output([]),
246
+ output(args.namespace),
247
+ output(args.deployment).metadata,
248
+ output(void 0),
249
+ output(void 0),
250
+ output([]),
251
+ output(args.deployment).spec,
252
+ output(args.deployment).status
253
+ );
254
+ }
255
+ };
256
+ var ExternalDeployment = class extends Deployment {
257
+ constructor(name, args, opts) {
258
+ const deployment = output(args.namespace).cluster.apply((cluster) => {
259
+ return apps.v1.Deployment.get(
260
+ name,
261
+ interpolate`${output(args.namespace).metadata.name}/${args.name}`,
262
+ { ...opts, parent: this, provider: getProvider(cluster) }
263
+ );
264
+ });
265
+ super(
266
+ "highstate:k8s:ExternalDeployment",
267
+ name,
268
+ args,
269
+ opts,
270
+ deployment.apiVersion,
271
+ deployment.kind,
272
+ output({}),
273
+ output([]),
274
+ output(args.namespace),
275
+ deployment.metadata,
276
+ output(void 0),
277
+ output(void 0),
278
+ output([]),
279
+ deployment.spec,
280
+ deployment.status
281
+ );
282
+ }
283
+ };
284
+
285
+ export { Deployment };
286
+ //# sourceMappingURL=chunk-JYNXQ3I3.js.map
287
+ //# sourceMappingURL=chunk-JYNXQ3I3.js.map
@@ -0,0 +1 @@
1
+ {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AK,UAAU,CAAA,CAAE;AAAA,KAC1B;AAAA,EACF;AACF,CAAA;AAcA,IAAM,kBAAA,GAAN,cAAiC,UAAA,CAAW;AAAA,EAC1C,WAAA,CAAY,IAAA,EAAc,IAAA,EAA8B,IAAA,EAAiC;AACvF,IAAA,MAAM,aAAa,MAAA,CAAO,IAAA,CAAK,SAAS,CAAA,CAAE,OAAA,CAAQ,MAAM,CAAA,OAAA,KAAW;AACjE,MAAA,OAAO,IAAA,CAAK,GAAG,UAAA,CAAW,GAAA;AAAA,QACxB,IAAA;AAAA,QACA,WAAA,CAAA,EAAc,OAAO,IAAA,CAAK,SAAS,EAAE,QAAA,CAAS,IAAI,CAAA,CAAA,EAAI,IAAA,CAAK,IAAI,CAAA,CAAA;AAAA,QAC/D,EAAE,GAAG,IAAA,EAAM,MAAA,EAAQ,MAAM,QAAA,EAAU,WAAA,CAAY,OAAO,CAAA;AAAE,OAC1D;AAAA,IACF,CAAC,CAAA;AAED,IAAA,KAAA;AAAA,MACE,kCAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA;AAAA,MAEA,UAAA,CAAW,UAAA;AAAA,MACX,UAAA,CAAW,IAAA;AAAA,MACX,MAAA,CAAO,EAAE,CAAA;AAAA,MACT,MAAA,CAAO,EAAE,CAAA;AAAA,MACT,MAAA,CAAO,KAAK,SAAS,CAAA;AAAA,MACrB,UAAA,CAAW,QAAA;AAAA,MAEX,OAAO,MAAS,CAAA;AAAA,MAChB,OAAO,MAAS,CAAA;AAAA,MAChB,MAAA,CAAO,EAAE,CAAA;AAAA,MAET,UAAA,CAAW,IAAA;AAAA,MACX,UAAA,CAAW;AAAA,KACb;AAAA,EACF;AACF,CAAA","file":"chunk-JYNXQ3I3.js","sourcesContent":["import type { AccessPointRoute } from \"@highstate/common\"\nimport type { k8s } from \"@highstate/library\"\nimport type { Container } from \"./container\"\nimport type { NetworkPolicy } from \"./network-policy\"\nimport type { Service } from \"./service\"\nimport { getOrCreate, type UnitTerminal } from \"@highstate/contract\"\nimport {\n type ComponentResourceOptions,\n type Input,\n type Inputs,\n interpolate,\n type Output,\n output,\n toPromise,\n type Unwrap,\n} from \"@highstate/pulumi\"\nimport { apps, type types } from \"@pulumi/kubernetes\"\nimport { deepmerge } from \"deepmerge-ts\"\nimport { omit } from \"remeda\"\nimport { Namespace } from \"./namespace\"\nimport { getProvider, mapMetadata } from \"./shared\"\nimport {\n ExposableWorkload,\n type ExposableWorkloadArgs,\n exposableWorkloadExtraArgs,\n getExposableWorkloadComponents,\n type WorkloadTerminalArgs,\n} from \"./workload\"\n\nexport type DeploymentArgs = Omit<ExposableWorkloadArgs, \"existing\"> &\n Omit<Partial<types.input.apps.v1.DeploymentSpec>, \"template\"> & {\n template?: {\n metadata?: types.input.meta.v1.ObjectMeta\n spec?: Partial<types.input.core.v1.PodSpec>\n }\n }\n\nexport type CreateOrGetDeploymentArgs = DeploymentArgs & {\n /**\n * The entity to use to determine the deployment to patch.\n */\n existing: Input<k8s.Deployment> | undefined\n}\n\nexport abstract class Deployment extends ExposableWorkload {\n protected constructor(\n type: string,\n name: string,\n args: Inputs,\n opts: ComponentResourceOptions | undefined,\n\n apiVersion: Output<string>,\n kind: Output<string>,\n terminalArgs: Output<Unwrap<WorkloadTerminalArgs>>,\n containers: Output<Container[]>,\n namespace: Output<Namespace>,\n metadata: Output<types.output.meta.v1.ObjectMeta>,\n networkPolicy: Output<NetworkPolicy | undefined>,\n\n service: Output<Service | undefined>,\n routes: Output<AccessPointRoute[]>,\n\n /**\n * The spec of the underlying Kubernetes deployment.\n */\n readonly spec: Output<types.output.apps.v1.DeploymentSpec>,\n\n /**\n * The status of the underlying Kubernetes deployment.\n */\n readonly status: Output<types.output.apps.v1.DeploymentStatus>,\n ) {\n super(\n type,\n name,\n args,\n opts,\n apiVersion,\n kind,\n terminalArgs,\n containers,\n namespace,\n metadata,\n networkPolicy,\n service,\n routes,\n )\n }\n\n protected override getTerminalMeta(): Output<UnitTerminal[\"meta\"]> {\n return output({\n title: \"Deployment\",\n globalTitle: interpolate`Deployment | ${this.metadata.name}`,\n description: \"The shell inside the deployment.\",\n icon: \"devicon:kubernetes\",\n })\n }\n\n /**\n * The Highstate deployment entity.\n */\n get entity(): Output<k8s.Deployment> {\n return output({\n type: \"deployment\",\n clusterId: this.cluster.id,\n clusterName: this.cluster.name,\n metadata: this.metadata,\n service: this._service.apply(service => service?.entity),\n })\n }\n\n /**\n * Creates a new deployment.\n */\n static create(name: string, args: DeploymentArgs, opts?: ComponentResourceOptions): Deployment {\n return new CreatedDeployment(name, args, opts)\n }\n\n /**\n * Creates a new deployment or patches an existing one.\n *\n * @param name The name of the resource. May not be the same as the deployment name.\n * @param args The arguments to create or patch the deployment with.\n * @param opts Optional resource options.\n */\n static createOrPatch(\n name: string,\n args: CreateOrGetDeploymentArgs,\n opts?: ComponentResourceOptions,\n ): Deployment {\n if (args.existing) {\n return new DeploymentPatch(name, {\n ...args,\n name: output(args.existing).metadata.name,\n namespace: Namespace.forResourceAsync(args.existing, output(args.namespace).cluster),\n })\n }\n\n return new CreatedDeployment(name, args, opts)\n }\n\n /**\n * Creates a new deployment or gets an existing one.\n *\n * @param name The name of the resource. May not be the same as the deployment name. Will not be used when existing deployment is retrieved.\n * @param args The arguments to create or get the deployment with.\n * @param opts Optional resource options.\n */\n static async createOrGet(\n name: string,\n args: CreateOrGetDeploymentArgs,\n opts?: ComponentResourceOptions,\n ): Promise<Deployment> {\n if (args.existing) {\n return await Deployment.forAsync(args.existing, output(args.namespace).cluster)\n }\n\n return new CreatedDeployment(name, args, opts)\n }\n\n /**\n * Patches an existing deployment.\n *\n * Will throw an error if the deployment does not exist.\n *\n * @param name The name of the resource. May not be the same as the deployment name.\n * @param args The arguments to patch the deployment with.\n * @param opts Optional resource options.\n */\n static patch(name: string, args: DeploymentArgs, opts?: ComponentResourceOptions): Deployment {\n return new DeploymentPatch(name, args, opts)\n }\n\n /**\n * Wraps an existing Kubernetes deployment.\n */\n static wrap(\n name: string,\n args: WrappedDeploymentArgs,\n opts?: ComponentResourceOptions,\n ): Deployment {\n return new WrappedDeployment(name, args, opts)\n }\n\n /**\n * Gets an existing deployment.\n *\n * Will throw an error if the deployment does not exist.\n */\n static get(\n name: string,\n args: ExternalDeploymentArgs,\n opts?: ComponentResourceOptions,\n ): Deployment {\n return new ExternalDeployment(name, args, opts)\n }\n\n private static readonly deploymentCache = new Map<string, Deployment>()\n\n /**\n * Gets an existing deployment for a given entity.\n * Prefer this method over `get` when possible.\n *\n * It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.\n *\n * This method is idempotent and will return the same instance for the same entity.\n *\n * @param entity The entity to get the deployment for.\n * @param cluster The cluster where the deployment is located.\n */\n static for(entity: k8s.Deployment, cluster: Input<k8s.Cluster>): Deployment {\n return getOrCreate(\n Deployment.deploymentCache,\n `${entity.clusterName}.${entity.metadata.namespace}.${entity.metadata.name}.${entity.clusterId}`,\n name => {\n return Deployment.get(name, {\n name: entity.metadata.name,\n namespace: Namespace.forResource(entity, cluster),\n })\n },\n )\n }\n\n /**\n * Gets an existing deployment for a given entity.\n * Prefer this method over `get` when possible.\n *\n * It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.\n *\n * This method is idempotent and will return the same instance for the same entity.\n *\n * @param entity The entity to get the deployment for.\n * @param cluster The cluster where the deployment is located.\n */\n static async forAsync(\n entity: Input<k8s.Deployment>,\n cluster: Input<k8s.Cluster>,\n ): Promise<Deployment> {\n const resolvedEntity = await toPromise(entity)\n return Deployment.for(resolvedEntity, cluster)\n }\n}\n\nclass CreatedDeployment extends Deployment {\n constructor(name: string, args: DeploymentArgs, opts?: ComponentResourceOptions) {\n const { labels, podTemplate, networkPolicy, containers, service, routes } =\n getExposableWorkloadComponents(name, args, () => this, opts)\n\n const deployment = output(args.namespace).cluster.apply(cluster => {\n return new apps.v1.Deployment(\n name,\n {\n metadata: mapMetadata(args, name),\n spec: output({ args, podTemplate, labels }).apply(({ args, podTemplate, labels }) => {\n return deepmerge(\n {\n template: podTemplate,\n selector: { matchLabels: labels },\n },\n omit(args, exposableWorkloadExtraArgs),\n ) as types.input.apps.v1.DeploymentSpec\n }),\n },\n { ...opts, parent: this, provider: getProvider(cluster) },\n )\n })\n\n super(\n \"highstate:k8s:Deployment\",\n name,\n args,\n opts,\n\n deployment.apiVersion,\n deployment.kind,\n output(args.terminal ?? {}),\n containers,\n output(args.namespace),\n deployment.metadata,\n networkPolicy,\n\n service,\n routes,\n\n deployment.spec,\n deployment.status,\n )\n }\n}\n\nclass DeploymentPatch extends Deployment {\n constructor(name: string, args: DeploymentArgs, opts?: ComponentResourceOptions) {\n const { labels, podTemplate, networkPolicy, containers, service, routes } =\n getExposableWorkloadComponents(name, args, () => this, opts)\n\n const deployment = output(args.namespace).cluster.apply(cluster => {\n return new apps.v1.DeploymentPatch(\n name,\n {\n metadata: mapMetadata(args, name),\n spec: output({ args, podTemplate, labels }).apply(({ args, podTemplate, labels }) => {\n return deepmerge(\n {\n template: podTemplate,\n selector: { matchLabels: labels },\n },\n omit(args, exposableWorkloadExtraArgs),\n ) as types.input.apps.v1.DeploymentSpec\n }),\n },\n {\n ...opts,\n parent: this,\n provider: getProvider(cluster),\n },\n )\n })\n\n super(\n \"highstate:k8s:DeploymentPatch\",\n name,\n args,\n opts,\n\n deployment.apiVersion,\n deployment.kind,\n output(args.terminal ?? {}),\n containers,\n output(args.namespace),\n deployment.metadata,\n networkPolicy,\n\n service,\n routes,\n\n deployment.spec,\n deployment.status,\n )\n }\n}\n\nexport type WrappedDeploymentArgs = {\n /**\n * The underlying Kubernetes deployment to wrap.\n */\n deployment: Input<apps.v1.Deployment>\n\n /**\n * The namespace where the deployment is located.\n */\n namespace: Input<Namespace>\n\n /**\n * The args for the terminal to use.\n */\n terminal?: Input<WorkloadTerminalArgs>\n}\n\nclass WrappedDeployment extends Deployment {\n constructor(name: string, args: WrappedDeploymentArgs, opts?: ComponentResourceOptions) {\n super(\n \"highstate:k8s:WrappedDeployment\",\n name,\n args,\n opts,\n\n output(args.deployment).apiVersion,\n output(args.deployment).kind,\n output(args.terminal ?? {}),\n output([]),\n output(args.namespace),\n output(args.deployment).metadata,\n\n output(undefined),\n output(undefined),\n output([]),\n\n output(args.deployment).spec,\n output(args.deployment).status,\n )\n }\n}\n\nexport type ExternalDeploymentArgs = {\n /**\n * The name of the deployment to get.\n */\n name: Input<string>\n\n /**\n * The namespace where the deployment is located.\n */\n namespace: Input<Namespace>\n}\n\nclass ExternalDeployment extends Deployment {\n constructor(name: string, args: ExternalDeploymentArgs, opts?: ComponentResourceOptions) {\n const deployment = output(args.namespace).cluster.apply(cluster => {\n return apps.v1.Deployment.get(\n name,\n interpolate`${output(args.namespace).metadata.name}/${args.name}`,\n { ...opts, parent: this, provider: getProvider(cluster) },\n )\n })\n\n super(\n \"highstate:k8s:ExternalDeployment\",\n name,\n args,\n opts,\n\n deployment.apiVersion,\n deployment.kind,\n output({}),\n output([]),\n output(args.namespace),\n deployment.metadata,\n\n output(undefined),\n output(undefined),\n output([]),\n\n deployment.spec,\n deployment.status,\n )\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { images_exports } from './chunk-5TLC5BXR.js';
1
+ import { images_exports } from './chunk-WGMJCZSK.js';
2
2
  import { text } from '@highstate/contract';
3
- import { secret } from '@highstate/pulumi';
3
+ import { output, fileFromString } from '@highstate/pulumi';
4
4
  import { CoreV1Api } from '@kubernetes/client-node';
5
5
 
6
6
  function isPrivateIp(ip) {
@@ -28,31 +28,38 @@ async function detectExternalIps(kubeConfig, internalIpsPolicy) {
28
28
  });
29
29
  }
30
30
  function createK8sTerminal(kubeconfig) {
31
- return {
31
+ return output({
32
32
  name: "management",
33
- title: "Cluster Management",
34
- description: "Manage the cluster using kubectl and helm",
35
- icon: "devicon:kubernetes",
36
- image: images_exports["terminal-kubectl"].image,
37
- command: ["bash", "/welcome.sh"],
38
- files: {
39
- "/kubeconfig": secret(kubeconfig),
40
- "/welcome.sh": text`
41
- echo "Connecting to the cluster..."
42
- kubectl cluster-info
33
+ meta: {
34
+ title: "Cluster Management",
35
+ description: "Manage the cluster using kubectl and helm",
36
+ icon: "devicon:kubernetes"
37
+ },
38
+ spec: {
39
+ image: images_exports["terminal-kubectl"].image,
40
+ command: ["bash", "/welcome.sh"],
41
+ files: {
42
+ "/kubeconfig": fileFromString("kubeconfig", kubeconfig, { isSecret: true }),
43
+ "/welcome.sh": fileFromString(
44
+ "welcome.sh",
45
+ text`
46
+ echo "Connecting to the cluster..."
47
+ kubectl cluster-info
43
48
 
44
- echo "Use 'kubectl' and 'helm' to manage the cluster."
45
- echo
49
+ echo "Use 'kubectl' and 'helm' to manage the cluster."
50
+ echo
46
51
 
47
- exec bash
48
- `
49
- },
50
- env: {
51
- KUBECONFIG: "/kubeconfig"
52
+ exec bash
53
+ `
54
+ )
55
+ },
56
+ env: {
57
+ KUBECONFIG: "/kubeconfig"
58
+ }
52
59
  }
53
- };
60
+ });
54
61
  }
55
62
 
56
63
  export { createK8sTerminal, detectExternalIps };
57
- //# sourceMappingURL=chunk-5C2BJGES.js.map
58
- //# sourceMappingURL=chunk-5C2BJGES.js.map
64
+ //# sourceMappingURL=chunk-KDD6XUWM.js.map
65
+ //# sourceMappingURL=chunk-KDD6XUWM.js.map