@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.
Files changed (81) hide show
  1. package/dist/chunk-23vn2rdc.js +11 -0
  2. package/dist/chunk-2pfx13ay.js +11 -0
  3. package/dist/chunk-46ntav0c.js +299 -0
  4. package/dist/chunk-556pc9e6.js +155 -0
  5. package/dist/chunk-7kgjgcft.js +170 -0
  6. package/dist/{chunk-ADHZK6V2.js → chunk-9hs97f1q.js} +13 -11
  7. package/dist/chunk-aame3x1b.js +11 -0
  8. package/dist/chunk-b05q6fm2.js +37 -0
  9. package/dist/chunk-bmvc9d2d.js +11 -0
  10. package/dist/chunk-de82bbp2.js +7 -0
  11. package/dist/chunk-facs31cb.js +624 -0
  12. package/dist/chunk-h1b79v66.js +1425 -0
  13. package/dist/chunk-k4w9zpn5.js +215 -0
  14. package/dist/chunk-pqc6w52f.js +352 -0
  15. package/dist/chunk-qyshvz32.js +176 -0
  16. package/dist/chunk-tpfyj6fe.js +199 -0
  17. package/dist/chunk-z6bmpnm7.js +180 -0
  18. package/dist/highstate.manifest.json +3 -3
  19. package/dist/impl/dynamic-endpoint-resolver.js +82 -81
  20. package/dist/impl/gateway-route.js +131 -168
  21. package/dist/impl/tls-certificate.js +31 -32
  22. package/dist/index.js +245 -201
  23. package/dist/units/cert-manager/index.js +19 -13
  24. package/dist/units/cluster-patch/index.js +9 -8
  25. package/dist/units/dns01-issuer/index.js +44 -41
  26. package/dist/units/existing-cluster/index.js +25 -13
  27. package/dist/units/gateway-api/index.js +15 -16
  28. package/dist/units/reduced-access-cluster/index.js +28 -32
  29. package/package.json +21 -21
  30. package/src/cron-job.ts +26 -1
  31. package/src/deployment.ts +17 -1
  32. package/src/job.ts +15 -1
  33. package/src/scripting/bundle.ts +21 -98
  34. package/src/scripting/environment.ts +2 -9
  35. package/src/shared.ts +1 -1
  36. package/src/stateful-set.ts +17 -1
  37. package/src/workload.ts +31 -14
  38. package/LICENSE +0 -21
  39. package/dist/chunk-23X5SXQG.js +0 -301
  40. package/dist/chunk-23X5SXQG.js.map +0 -1
  41. package/dist/chunk-ADHZK6V2.js.map +0 -1
  42. package/dist/chunk-BTAEFJ5N.js +0 -291
  43. package/dist/chunk-BTAEFJ5N.js.map +0 -1
  44. package/dist/chunk-HH2JJELM.js +0 -13
  45. package/dist/chunk-HH2JJELM.js.map +0 -1
  46. package/dist/chunk-IXE3OKB4.js +0 -249
  47. package/dist/chunk-IXE3OKB4.js.map +0 -1
  48. package/dist/chunk-OG2OPX7B.js +0 -333
  49. package/dist/chunk-OG2OPX7B.js.map +0 -1
  50. package/dist/chunk-P26SQ2ZB.js +0 -393
  51. package/dist/chunk-P26SQ2ZB.js.map +0 -1
  52. package/dist/chunk-PG27ZY2H.js +0 -319
  53. package/dist/chunk-PG27ZY2H.js.map +0 -1
  54. package/dist/chunk-PZYGZSN5.js +0 -54
  55. package/dist/chunk-PZYGZSN5.js.map +0 -1
  56. package/dist/chunk-S77TE7UC.js +0 -309
  57. package/dist/chunk-S77TE7UC.js.map +0 -1
  58. package/dist/chunk-SZKOAHNX.js +0 -1804
  59. package/dist/chunk-SZKOAHNX.js.map +0 -1
  60. package/dist/chunk-TOLFVF4S.js +0 -889
  61. package/dist/chunk-TOLFVF4S.js.map +0 -1
  62. package/dist/chunk-TVKT3ZYX.js +0 -423
  63. package/dist/chunk-TVKT3ZYX.js.map +0 -1
  64. package/dist/cron-job-RKB2HYTO.js +0 -7
  65. package/dist/cron-job-RKB2HYTO.js.map +0 -1
  66. package/dist/deployment-T35TUOL2.js +0 -7
  67. package/dist/deployment-T35TUOL2.js.map +0 -1
  68. package/dist/impl/dynamic-endpoint-resolver.js.map +0 -1
  69. package/dist/impl/gateway-route.js.map +0 -1
  70. package/dist/impl/tls-certificate.js.map +0 -1
  71. package/dist/index.js.map +0 -1
  72. package/dist/job-PE4AKOHB.js +0 -7
  73. package/dist/job-PE4AKOHB.js.map +0 -1
  74. package/dist/stateful-set-LUIRHQJY.js +0 -7
  75. package/dist/stateful-set-LUIRHQJY.js.map +0 -1
  76. package/dist/units/cert-manager/index.js.map +0 -1
  77. package/dist/units/cluster-patch/index.js.map +0 -1
  78. package/dist/units/dns01-issuer/index.js.map +0 -1
  79. package/dist/units/existing-cluster/index.js.map +0 -1
  80. package/dist/units/gateway-api/index.js.map +0 -1
  81. package/dist/units/reduced-access-cluster/index.js.map +0 -1
@@ -0,0 +1,176 @@
1
+ // @bun
2
+ import {
3
+ Workload,
4
+ filterPatchOwnedContainersInTemplate,
5
+ getWorkloadComponents
6
+ } from "./chunk-h1b79v66.js";
7
+ import {
8
+ Namespace,
9
+ commonExtraArgs,
10
+ getProvider,
11
+ mapMetadata
12
+ } from "./chunk-facs31cb.js";
13
+
14
+ // src/job.ts
15
+ import { getOrCreate } from "@highstate/contract";
16
+ import { k8s } from "@highstate/library";
17
+ import {
18
+ interpolate,
19
+ makeEntityOutput,
20
+ output,
21
+ toPromise
22
+ } from "@highstate/pulumi";
23
+ import { batch } from "@pulumi/kubernetes";
24
+ import { deepmerge } from "deepmerge-ts";
25
+ import { omit } from "remeda";
26
+ class Job extends Workload {
27
+ spec;
28
+ status;
29
+ static apiVersion = "batch/v1";
30
+ static kind = "Job";
31
+ constructor(type, name, args, opts, metadata, namespace, terminalArgs, containers, networkPolicy, spec, status) {
32
+ super(type, name, args, opts, metadata, namespace, terminalArgs, containers, spec.template, networkPolicy);
33
+ this.spec = spec;
34
+ this.status = status;
35
+ }
36
+ get templateMetadata() {
37
+ return this.spec.template.metadata;
38
+ }
39
+ get entity() {
40
+ return makeEntityOutput({
41
+ entity: k8s.jobEntity,
42
+ identity: this.metadata.uid,
43
+ meta: {
44
+ title: this.metadata.name
45
+ },
46
+ value: {
47
+ ...this.entityBase,
48
+ spec: this.spec
49
+ }
50
+ });
51
+ }
52
+ getTerminalMeta() {
53
+ return output({
54
+ title: "Job",
55
+ globalTitle: interpolate`Job | ${this.metadata.name}`,
56
+ description: "The shell inside the job.",
57
+ icon: "devicon:kubernetes"
58
+ });
59
+ }
60
+ get resourceType() {
61
+ return "job";
62
+ }
63
+ static create(name, args, opts) {
64
+ return new CreatedJob(name, args, opts);
65
+ }
66
+ static createOrPatch(name, args, opts) {
67
+ if (args.existing) {
68
+ return new JobPatch(name, {
69
+ ...args,
70
+ name: output(args.existing).metadata.name,
71
+ namespace: Namespace.forResourceAsync(args.existing, output(args.namespace).cluster)
72
+ });
73
+ }
74
+ return new CreatedJob(name, args, opts);
75
+ }
76
+ static async createOrGet(name, args, opts) {
77
+ if (args.existing) {
78
+ return await Job.forAsync(args.existing, output(args.namespace).cluster);
79
+ }
80
+ return new CreatedJob(name, args, opts);
81
+ }
82
+ static patch(name, args, opts) {
83
+ return new JobPatch(name, args, opts);
84
+ }
85
+ static wrap(name, args, opts) {
86
+ return new WrappedJob(name, args, opts);
87
+ }
88
+ static get(name, args, opts) {
89
+ return new ExternalJob(name, args, opts);
90
+ }
91
+ static jobCache = new Map;
92
+ static for(entity, cluster) {
93
+ return getOrCreate(Job.jobCache, `${entity.clusterName}.${entity.metadata.namespace}.${entity.metadata.name}.${entity.clusterId}`, (name) => {
94
+ return Job.get(name, {
95
+ name: entity.metadata.name,
96
+ namespace: Namespace.forResource(entity, cluster)
97
+ });
98
+ });
99
+ }
100
+ static async forAsync(entity, cluster) {
101
+ const resolvedEntity = await toPromise(entity);
102
+ return Job.for(resolvedEntity, cluster);
103
+ }
104
+ }
105
+ var jobExtraArgs = [...commonExtraArgs, "container", "containers"];
106
+
107
+ class CreatedJob extends Job {
108
+ constructor(name, args, opts) {
109
+ const { podTemplate, containers, networkPolicy } = getWorkloadComponents(name, args, () => this, opts);
110
+ const job = output(args.namespace).cluster.apply((cluster) => {
111
+ return new batch.v1.Job(name, {
112
+ metadata: mapMetadata(args, name),
113
+ spec: output({ args, podTemplate }).apply(({ args: args2, podTemplate: podTemplate2 }) => {
114
+ return deepmerge({
115
+ template: deepmerge({
116
+ spec: {
117
+ restartPolicy: "Never"
118
+ }
119
+ }, podTemplate2)
120
+ }, omit(args2, jobExtraArgs));
121
+ })
122
+ }, { ...opts, parent: this, provider: getProvider(cluster) });
123
+ });
124
+ super("highstate:k8s:Job", name, args, opts, job.metadata, output(args.namespace), output(args.terminal ?? {}), containers, networkPolicy, job.spec, job.status);
125
+ }
126
+ }
127
+
128
+ class JobPatch extends Job {
129
+ constructor(name, args, opts) {
130
+ const { podTemplate, containers, networkPolicy } = getWorkloadComponents(name, args, () => this, opts, true);
131
+ const job = output(args.namespace).cluster.apply((cluster) => {
132
+ return new batch.v1.JobPatch(name, {
133
+ metadata: mapMetadata(args, name),
134
+ spec: output({ args, podTemplate }).apply(({ args: args2, podTemplate: podTemplate2 }) => {
135
+ const spec = deepmerge({ template: podTemplate2 }, omit(args2, jobExtraArgs));
136
+ if (spec.template) {
137
+ spec.template = filterPatchOwnedContainersInTemplate(spec.template, podTemplate2);
138
+ }
139
+ return spec;
140
+ })
141
+ }, { ...opts, parent: this, provider: getProvider(cluster) });
142
+ });
143
+ const filteredSpec = output({ spec: job.spec, podTemplate }).apply(({ spec, podTemplate: podTemplate2 }) => {
144
+ if (!spec.template) {
145
+ return spec;
146
+ }
147
+ return {
148
+ ...spec,
149
+ template: filterPatchOwnedContainersInTemplate(spec.template, podTemplate2)
150
+ };
151
+ });
152
+ super("highstate:k8s:JobPatch", name, args, opts, job.metadata, output(args.namespace), output(args.terminal ?? {}), containers, networkPolicy, filteredSpec, job.status);
153
+ this.registerOutputs({
154
+ metadata: this.metadata,
155
+ spec: this.spec,
156
+ status: this.status
157
+ });
158
+ }
159
+ }
160
+
161
+ class WrappedJob extends Job {
162
+ constructor(name, args, opts) {
163
+ super("highstate:k8s:WrappedJob", name, args, opts, output(args.job).metadata, output(args.namespace), output(args.terminal ?? {}), output([]), output(undefined), output(args.job).spec, output(args.job).status);
164
+ }
165
+ }
166
+
167
+ class ExternalJob extends Job {
168
+ constructor(name, args, opts) {
169
+ const job = output(args.namespace).cluster.apply((cluster) => {
170
+ return batch.v1.Job.get(name, interpolate`${output(args.namespace).metadata.name}/${args.name}`, { ...opts, parent: this, provider: getProvider(cluster) });
171
+ });
172
+ super("highstate:k8s:ExternalJob", name, args, opts, job.metadata, output(args.namespace), output({}), output([]), output(undefined), job.spec, job.status);
173
+ }
174
+ }
175
+
176
+ export { Job };
@@ -0,0 +1,199 @@
1
+ // @bun
2
+ import {
3
+ Workload,
4
+ filterPatchOwnedContainersInTemplate,
5
+ getWorkloadComponents
6
+ } from "./chunk-h1b79v66.js";
7
+ import {
8
+ Namespace,
9
+ commonExtraArgs,
10
+ getProvider,
11
+ mapMetadata
12
+ } from "./chunk-facs31cb.js";
13
+
14
+ // src/cron-job.ts
15
+ import { getOrCreate } from "@highstate/contract";
16
+ import { k8s } from "@highstate/library";
17
+ import {
18
+ interpolate,
19
+ makeEntityOutput,
20
+ output,
21
+ toPromise
22
+ } from "@highstate/pulumi";
23
+ import { batch } from "@pulumi/kubernetes";
24
+ import { deepmerge } from "deepmerge-ts";
25
+ import { omit } from "remeda";
26
+ class CronJob extends Workload {
27
+ spec;
28
+ status;
29
+ static apiVersion = "batch/v1";
30
+ static kind = "CronJob";
31
+ constructor(type, name, args, opts, metadata, namespace, terminalArgs, containers, networkPolicy, spec, status) {
32
+ super(type, name, args, opts, metadata, namespace, terminalArgs, containers, spec.jobTemplate.spec.template, networkPolicy);
33
+ this.spec = spec;
34
+ this.status = status;
35
+ }
36
+ get templateMetadata() {
37
+ return this.spec.jobTemplate.spec.template.metadata;
38
+ }
39
+ get entity() {
40
+ return makeEntityOutput({
41
+ entity: k8s.cronJobEntity,
42
+ identity: this.metadata.uid,
43
+ meta: {
44
+ title: this.metadata.name
45
+ },
46
+ value: {
47
+ ...this.entityBase,
48
+ spec: this.spec.jobTemplate.spec
49
+ }
50
+ });
51
+ }
52
+ getTerminalMeta() {
53
+ return output({
54
+ title: "CronJob",
55
+ globalTitle: interpolate`CronJob | ${this.metadata.name}`,
56
+ description: "The shell inside the cron job.",
57
+ icon: "devicon:kubernetes"
58
+ });
59
+ }
60
+ get resourceType() {
61
+ return "cronjob";
62
+ }
63
+ static create(name, args, opts) {
64
+ return new CreatedCronJob(name, args, opts);
65
+ }
66
+ static createOrPatch(name, args, opts) {
67
+ if (args.existing) {
68
+ return new CronJobPatch(name, {
69
+ ...args,
70
+ name: output(args.existing).metadata.name,
71
+ namespace: Namespace.forResourceAsync(args.existing, output(args.namespace).cluster)
72
+ });
73
+ }
74
+ return new CreatedCronJob(name, args, opts);
75
+ }
76
+ static async createOrGet(name, args, opts) {
77
+ if (args.existing) {
78
+ return await CronJob.forAsync(args.existing, output(args.namespace).cluster);
79
+ }
80
+ return new CreatedCronJob(name, args, opts);
81
+ }
82
+ static patch(name, args, opts) {
83
+ return new CronJobPatch(name, args, opts);
84
+ }
85
+ static wrap(name, args, opts) {
86
+ return new WrappedCronJob(name, args, opts);
87
+ }
88
+ static get(name, args, opts) {
89
+ return new ExternalCronJob(name, args, opts);
90
+ }
91
+ static cronJobCache = new Map;
92
+ static for(entity, cluster) {
93
+ return getOrCreate(CronJob.cronJobCache, `${entity.clusterName}.${entity.metadata.namespace}.${entity.metadata.name}.${entity.clusterId}`, (name) => {
94
+ return CronJob.get(name, {
95
+ name: entity.metadata.name,
96
+ namespace: Namespace.forResource(entity, cluster)
97
+ });
98
+ });
99
+ }
100
+ static async forAsync(entity, cluster) {
101
+ const resolvedEntity = await toPromise(entity);
102
+ return CronJob.for(resolvedEntity, cluster);
103
+ }
104
+ }
105
+ var cronJobExtraArgs = [...commonExtraArgs, "container", "containers"];
106
+
107
+ class CreatedCronJob extends CronJob {
108
+ constructor(name, args, opts) {
109
+ const { podTemplate, containers, networkPolicy } = getWorkloadComponents(name, args, () => this, opts);
110
+ const cronJob = output(args.namespace).cluster.apply((cluster) => {
111
+ return new batch.v1.CronJob(name, {
112
+ metadata: mapMetadata(args, name),
113
+ spec: output({ args, podTemplate }).apply(({ args: args2, podTemplate: podTemplate2 }) => {
114
+ return deepmerge({
115
+ jobTemplate: {
116
+ spec: {
117
+ template: deepmerge({
118
+ spec: {
119
+ restartPolicy: "Never"
120
+ }
121
+ }, podTemplate2)
122
+ }
123
+ },
124
+ schedule: args2.schedule
125
+ }, omit(args2, cronJobExtraArgs));
126
+ })
127
+ }, {
128
+ ...opts,
129
+ parent: this,
130
+ provider: getProvider(cluster)
131
+ });
132
+ });
133
+ super("highstate:k8s:CronJob", name, args, opts, cronJob.metadata, output(args.namespace), output(args.terminal ?? {}), containers, networkPolicy, cronJob.spec, cronJob.status);
134
+ }
135
+ }
136
+
137
+ class CronJobPatch extends CronJob {
138
+ constructor(name, args, opts) {
139
+ const { podTemplate, containers, networkPolicy } = getWorkloadComponents(name, args, () => this, opts, true);
140
+ const cronJob = output(args.namespace).cluster.apply((cluster) => {
141
+ return new batch.v1.CronJobPatch(name, {
142
+ metadata: mapMetadata(args, name),
143
+ spec: output({ args, podTemplate }).apply(({ args: args2, podTemplate: podTemplate2 }) => {
144
+ const spec = deepmerge({
145
+ jobTemplate: {
146
+ spec: {
147
+ template: podTemplate2
148
+ }
149
+ },
150
+ schedule: args2.schedule
151
+ }, omit(args2, cronJobExtraArgs));
152
+ if (spec.jobTemplate?.spec?.template) {
153
+ spec.jobTemplate.spec.template = filterPatchOwnedContainersInTemplate(spec.jobTemplate.spec.template, podTemplate2);
154
+ }
155
+ return spec;
156
+ })
157
+ }, {
158
+ ...opts,
159
+ parent: this,
160
+ provider: getProvider(cluster)
161
+ });
162
+ });
163
+ const filteredSpec = output({ spec: cronJob.spec, podTemplate }).apply(({ spec, podTemplate: podTemplate2 }) => {
164
+ const template = spec.jobTemplate?.spec?.template;
165
+ if (!template) {
166
+ return spec;
167
+ }
168
+ const filteredTemplate = filterPatchOwnedContainersInTemplate(template, podTemplate2);
169
+ return {
170
+ ...spec,
171
+ jobTemplate: {
172
+ ...spec.jobTemplate,
173
+ spec: {
174
+ ...spec.jobTemplate.spec,
175
+ template: filteredTemplate
176
+ }
177
+ }
178
+ };
179
+ });
180
+ super("highstate:k8s:CronJobPatch", name, args, opts, cronJob.metadata, output(args.namespace), output(args.terminal ?? {}), containers, networkPolicy, filteredSpec, cronJob.status);
181
+ }
182
+ }
183
+
184
+ class WrappedCronJob extends CronJob {
185
+ constructor(name, args, opts) {
186
+ super("highstate:k8s:WrappedCronJob", name, args, opts, output(args.cronJob).metadata, output(args.namespace), output(args.terminal ?? {}), output([]), output(undefined), output(args.cronJob).spec, output(args.cronJob).status);
187
+ }
188
+ }
189
+
190
+ class ExternalCronJob extends CronJob {
191
+ constructor(name, args, opts) {
192
+ const cronJob = output(args.namespace).cluster.apply((cluster) => {
193
+ return batch.v1.CronJob.get(name, interpolate`${output(args.namespace).metadata.name}/${args.name}`, { ...opts, parent: this, provider: getProvider(cluster) });
194
+ });
195
+ super("highstate:k8s:ExternalCronJob", name, args, opts, cronJob.metadata, output(args.namespace), output({}), output([]), output(undefined), cronJob.spec, cronJob.status);
196
+ }
197
+ }
198
+
199
+ export { CronJob };
@@ -0,0 +1,180 @@
1
+ // @bun
2
+ import {
3
+ Workload,
4
+ filterPatchOwnedContainersInTemplate,
5
+ getWorkloadServiceComponents,
6
+ workloadServiceExtraArgs
7
+ } from "./chunk-h1b79v66.js";
8
+ import {
9
+ Namespace,
10
+ getProvider,
11
+ mapMetadata
12
+ } from "./chunk-facs31cb.js";
13
+
14
+ // src/stateful-set.ts
15
+ import { getOrCreate } from "@highstate/contract";
16
+ import { k8s } from "@highstate/library";
17
+ import {
18
+ interpolate,
19
+ makeEntityOutput,
20
+ output,
21
+ toPromise
22
+ } from "@highstate/pulumi";
23
+ import { apps } from "@pulumi/kubernetes";
24
+ import { deepmerge } from "deepmerge-ts";
25
+ import { omit } from "remeda";
26
+ class StatefulSet extends Workload {
27
+ spec;
28
+ status;
29
+ static apiVersion = "apps/v1";
30
+ static kind = "StatefulSet";
31
+ constructor(type, name, args, opts, metadata, namespace, terminalArgs, containers, networkPolicy, service, routes, spec, status) {
32
+ super(type, name, args, opts, metadata, namespace, terminalArgs, containers, spec.template, networkPolicy, service, routes);
33
+ this.spec = spec;
34
+ this.status = status;
35
+ }
36
+ get templateMetadata() {
37
+ return this.spec.template.metadata;
38
+ }
39
+ get entity() {
40
+ return makeEntityOutput({
41
+ entity: k8s.statefulSetEntity,
42
+ identity: this.metadata.uid,
43
+ meta: {
44
+ title: this.metadata.name
45
+ },
46
+ value: {
47
+ ...this.entityBase,
48
+ service: this.service.entity,
49
+ spec: this.spec
50
+ }
51
+ });
52
+ }
53
+ static create(name, args, opts) {
54
+ return new CreatedStatefulSet(name, args, opts);
55
+ }
56
+ static createOrPatch(name, args, opts) {
57
+ if (args.existing) {
58
+ return new StatefulSetPatch(name, {
59
+ ...args,
60
+ name: output(args.existing).metadata.name,
61
+ namespace: Namespace.forResourceAsync(args.existing, output(args.namespace).cluster)
62
+ });
63
+ }
64
+ return new CreatedStatefulSet(name, args, opts);
65
+ }
66
+ static async createOrGet(name, args, opts) {
67
+ if (args.existing) {
68
+ return await StatefulSet.forAsync(args.existing, output(args.namespace).cluster);
69
+ }
70
+ return new CreatedStatefulSet(name, args, opts);
71
+ }
72
+ static patch(name, args, opts) {
73
+ return new StatefulSetPatch(name, args, opts);
74
+ }
75
+ static wrap(name, args, opts) {
76
+ return new WrappedStatefulSet(name, args, opts);
77
+ }
78
+ static get(name, args, opts) {
79
+ return new ExternalStatefulSet(name, args, opts);
80
+ }
81
+ static statefulSetCache = new Map;
82
+ static for(entity, cluster) {
83
+ return getOrCreate(StatefulSet.statefulSetCache, `${entity.clusterName}.${entity.metadata.namespace}.${entity.metadata.name}.${entity.clusterId}`, (name) => {
84
+ return StatefulSet.get(name, {
85
+ name: entity.metadata.name,
86
+ namespace: Namespace.forResource(entity, cluster)
87
+ });
88
+ });
89
+ }
90
+ static async forAsync(entity, cluster) {
91
+ const resolvedEntity = await toPromise(entity);
92
+ return StatefulSet.for(resolvedEntity, cluster);
93
+ }
94
+ getTerminalMeta() {
95
+ return output({
96
+ title: "StatefulSet",
97
+ globalTitle: interpolate`StatefulSet | ${this.metadata.name}`,
98
+ description: "The shell inside the stateful set.",
99
+ icon: "devicon:kubernetes"
100
+ });
101
+ }
102
+ get resourceType() {
103
+ return "statefulset";
104
+ }
105
+ }
106
+
107
+ class CreatedStatefulSet extends StatefulSet {
108
+ constructor(name, args, opts) {
109
+ const { labels, podTemplate, networkPolicy, containers, service, routes } = getWorkloadServiceComponents(name, {
110
+ ...args,
111
+ service: output(args.service).apply((service2) => ({ ...service2 }))
112
+ }, () => this, opts);
113
+ const statefulSet = output(args.namespace).cluster.apply((cluster) => {
114
+ return new apps.v1.StatefulSet(name, {
115
+ metadata: mapMetadata(args, name),
116
+ spec: output({ args, podTemplate, labels, service }).apply(({ args: args2, podTemplate: podTemplate2, labels: labels2, service: service2 }) => {
117
+ return deepmerge({
118
+ serviceName: service2?.metadata.name,
119
+ template: podTemplate2,
120
+ selector: { matchLabels: labels2 }
121
+ }, omit(args2, workloadServiceExtraArgs));
122
+ })
123
+ }, {
124
+ ...opts,
125
+ parent: this,
126
+ provider: getProvider(cluster)
127
+ });
128
+ });
129
+ super("highstate:k8s:StatefulSet", name, args, opts, statefulSet.metadata, output(args.namespace), output(args.terminal ?? {}), containers, networkPolicy, service, routes, statefulSet.spec, statefulSet.status);
130
+ }
131
+ }
132
+
133
+ class StatefulSetPatch extends StatefulSet {
134
+ constructor(name, args, opts) {
135
+ const { podTemplate, networkPolicy, containers, service, routes } = getWorkloadServiceComponents(name, args, () => this, opts, true);
136
+ const statefulSet = output(args.namespace).cluster.apply((cluster) => {
137
+ return new apps.v1.StatefulSetPatch(name, {
138
+ metadata: mapMetadata(args, name),
139
+ spec: output({ args, podTemplate }).apply(({ args: args2, podTemplate: podTemplate2 }) => {
140
+ const spec = deepmerge({ template: podTemplate2 }, omit(args2, workloadServiceExtraArgs));
141
+ if (spec.template) {
142
+ spec.template = filterPatchOwnedContainersInTemplate(spec.template, podTemplate2);
143
+ }
144
+ return spec;
145
+ })
146
+ }, {
147
+ ...opts,
148
+ parent: this,
149
+ provider: getProvider(cluster)
150
+ });
151
+ });
152
+ const filteredSpec = output({ spec: statefulSet.spec, podTemplate }).apply(({ spec, podTemplate: podTemplate2 }) => {
153
+ if (!spec.template) {
154
+ return spec;
155
+ }
156
+ return {
157
+ ...spec,
158
+ template: filterPatchOwnedContainersInTemplate(spec.template, podTemplate2)
159
+ };
160
+ });
161
+ super("highstate:k8s:StatefulSetPatch", name, args, opts, statefulSet.metadata, output(args.namespace), output(args.terminal ?? {}), containers, networkPolicy, service, routes, filteredSpec, statefulSet.status);
162
+ }
163
+ }
164
+
165
+ class WrappedStatefulSet extends StatefulSet {
166
+ constructor(name, args, opts) {
167
+ super("highstate:k8s:WrappedStatefulSet", name, args, opts, output(args.statefulSet).metadata, output(args.namespace), output(args.terminal ?? {}), output([]), output(undefined), output(args.service), output([]), output(args.statefulSet).spec, output(args.statefulSet).status);
168
+ }
169
+ }
170
+
171
+ class ExternalStatefulSet extends StatefulSet {
172
+ constructor(name, args, opts) {
173
+ const statefulSet = output(args.namespace).cluster.apply((cluster) => {
174
+ return apps.v1.StatefulSet.get(name, interpolate`${output(args.namespace).metadata.name}/${args.name}`, { ...opts, parent: this, provider: getProvider(cluster) });
175
+ });
176
+ super("highstate:k8s:ExternalStatefulSet", name, args, opts, statefulSet.metadata, output(args.namespace), output({}), output([]), output(undefined), output(undefined), output([]), statefulSet.spec, statefulSet.status);
177
+ }
178
+ }
179
+
180
+ export { StatefulSet };
@@ -7,8 +7,8 @@
7
7
  "./dist/units/existing-cluster/index.js": 2212294583,
8
8
  "./dist/units/gateway-api/index.js": 2212294583,
9
9
  "./dist/units/reduced-access-cluster/index.js": 2212294583,
10
- "./dist/impl/dynamic-endpoint-resolver.js": 1003129543,
11
- "./dist/impl/gateway-route.js": 411996386,
12
- "./dist/impl/tls-certificate.js": 4278425047
10
+ "./dist/impl/dynamic-endpoint-resolver.js": 313156426,
11
+ "./dist/impl/gateway-route.js": 212793152,
12
+ "./dist/impl/tls-certificate.js": 2224932688
13
13
  }
14
14
  }