@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.
- package/dist/chunk-2EEHJZPD.js +13 -0
- package/dist/chunk-2EEHJZPD.js.map +1 -0
- package/dist/{chunk-OFFSHGC6.js → chunk-4JGXGN2L.js} +66 -48
- package/dist/chunk-4JGXGN2L.js.map +1 -0
- package/dist/chunk-A3XGSDIW.js +306 -0
- package/dist/chunk-A3XGSDIW.js.map +1 -0
- package/dist/chunk-IMTXUK2U.js +244 -0
- package/dist/chunk-IMTXUK2U.js.map +1 -0
- package/dist/chunk-JYNXQ3I3.js +287 -0
- package/dist/chunk-JYNXQ3I3.js.map +1 -0
- package/dist/{chunk-5C2BJGES.js → chunk-KDD6XUWM.js} +30 -23
- package/dist/chunk-KDD6XUWM.js.map +1 -0
- package/dist/chunk-NOFJC3EM.js +236 -0
- package/dist/chunk-NOFJC3EM.js.map +1 -0
- package/dist/chunk-NXSYCA3V.js +337 -0
- package/dist/chunk-NXSYCA3V.js.map +1 -0
- package/dist/chunk-SBC3TUIN.js +1513 -0
- package/dist/chunk-SBC3TUIN.js.map +1 -0
- package/dist/chunk-SI7X6N46.js +338 -0
- package/dist/chunk-SI7X6N46.js.map +1 -0
- package/dist/chunk-WGMJCZSK.js +360 -0
- package/dist/chunk-WGMJCZSK.js.map +1 -0
- package/dist/deployment-752P6JIT.js +8 -0
- package/dist/{deployment-XK3CDJOE.js.map → deployment-752P6JIT.js.map} +1 -1
- package/dist/highstate.manifest.json +8 -7
- package/dist/impl/gateway-route.js +123 -0
- package/dist/impl/gateway-route.js.map +1 -0
- package/dist/impl/tls-certificate.js +32 -0
- package/dist/impl/tls-certificate.js.map +1 -0
- package/dist/index.js +736 -208
- package/dist/index.js.map +1 -1
- package/dist/stateful-set-N64YVKR7.js +8 -0
- package/dist/{stateful-set-7CAQWTV2.js.map → stateful-set-N64YVKR7.js.map} +1 -1
- package/dist/units/cert-manager/index.js +11 -10
- package/dist/units/cert-manager/index.js.map +1 -1
- package/dist/units/cluster-dns/index.js.map +1 -1
- package/dist/units/cluster-patch/index.js.map +1 -1
- package/dist/units/dns01-issuer/index.js +27 -23
- package/dist/units/dns01-issuer/index.js.map +1 -1
- package/dist/units/existing-cluster/index.js +11 -8
- package/dist/units/existing-cluster/index.js.map +1 -1
- package/dist/units/gateway-api/index.js +2 -2
- package/dist/units/gateway-api/index.js.map +1 -1
- package/package.json +40 -14
- package/src/cluster.ts +30 -22
- package/src/config-map.ts +195 -57
- package/src/container.ts +5 -5
- package/src/cron-job.ts +403 -31
- package/src/deployment.ts +260 -120
- package/src/dns01-solver.ts +10 -0
- package/src/gateway/backend.ts +2 -2
- package/src/gateway/gateway.ts +383 -0
- package/src/gateway/http-route.ts +17 -24
- package/src/gateway/index.ts +1 -0
- package/src/helm.ts +83 -53
- package/src/impl/gateway-route.ts +155 -0
- package/src/impl/tls-certificate.ts +33 -0
- package/src/index.ts +22 -67
- package/src/job.ts +393 -28
- package/src/namespace.ts +236 -99
- package/src/network-policy.ts +216 -165
- package/src/network.ts +2 -2
- package/src/pvc.ts +266 -65
- package/src/rbac.ts +218 -0
- package/src/scripting/bundle.ts +9 -20
- package/src/scripting/container.ts +1 -1
- package/src/scripting/environment.ts +5 -5
- package/src/secret.ts +200 -62
- package/src/service.ts +288 -158
- package/src/shared.ts +94 -67
- package/src/stateful-set.ts +270 -117
- package/src/tls.ts +344 -0
- package/src/units/cert-manager/index.ts +2 -3
- package/src/units/dns01-issuer/index.ts +30 -14
- package/src/units/existing-cluster/index.ts +10 -7
- package/src/units/gateway-api/index.ts +2 -2
- package/src/worker.ts +26 -0
- package/src/workload.ts +275 -171
- package/dist/chunk-5C2BJGES.js.map +0 -1
- package/dist/chunk-5TLC5BXR.js +0 -256
- package/dist/chunk-5TLC5BXR.js.map +0 -1
- package/dist/chunk-BBIY3KUN.js +0 -1557
- package/dist/chunk-BBIY3KUN.js.map +0 -1
- package/dist/chunk-OFFSHGC6.js.map +0 -1
- package/dist/chunk-TZHOUJRC.js +0 -202
- package/dist/chunk-TZHOUJRC.js.map +0 -1
- package/dist/chunk-YWRJ4EZM.js +0 -192
- package/dist/chunk-YWRJ4EZM.js.map +0 -1
- package/dist/deployment-XK3CDJOE.js +0 -6
- package/dist/stateful-set-7CAQWTV2.js +0 -6
- package/dist/units/access-point/index.js +0 -21
- package/dist/units/access-point/index.js.map +0 -1
- package/src/access-point.ts +0 -191
- package/src/units/access-point/index.ts +0 -19
- package/src/units/dns01-issuer/solver.ts +0 -23
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@highstate/k8s",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.19",
|
4
4
|
"type": "module",
|
5
5
|
"files": [
|
6
6
|
"dist",
|
@@ -11,6 +11,30 @@
|
|
11
11
|
".": {
|
12
12
|
"mode": "manual",
|
13
13
|
"version": "1"
|
14
|
+
},
|
15
|
+
"./units/cert-manager": {
|
16
|
+
"mode": "manual",
|
17
|
+
"version": "1"
|
18
|
+
},
|
19
|
+
"./units/cluster-patch": {
|
20
|
+
"mode": "manual",
|
21
|
+
"version": "1"
|
22
|
+
},
|
23
|
+
"./units/cluster-dns": {
|
24
|
+
"mode": "manual",
|
25
|
+
"version": "1"
|
26
|
+
},
|
27
|
+
"./units/dns01-issuer": {
|
28
|
+
"mode": "manual",
|
29
|
+
"version": "1"
|
30
|
+
},
|
31
|
+
"./units/existing-cluster": {
|
32
|
+
"mode": "manual",
|
33
|
+
"version": "1"
|
34
|
+
},
|
35
|
+
"./units/gateway-api": {
|
36
|
+
"mode": "manual",
|
37
|
+
"version": "1"
|
14
38
|
}
|
15
39
|
}
|
16
40
|
},
|
@@ -19,34 +43,35 @@
|
|
19
43
|
"types": "./src/index.ts",
|
20
44
|
"default": "./dist/index.js"
|
21
45
|
},
|
22
|
-
"./units/access-point": "./dist/units/access-point/index.js",
|
23
46
|
"./units/cert-manager": "./dist/units/cert-manager/index.js",
|
24
47
|
"./units/cluster-patch": "./dist/units/cluster-patch/index.js",
|
25
48
|
"./units/cluster-dns": "./dist/units/cluster-dns/index.js",
|
26
49
|
"./units/dns01-issuer": "./dist/units/dns01-issuer/index.js",
|
27
50
|
"./units/existing-cluster": "./dist/units/existing-cluster/index.js",
|
28
|
-
"./units/gateway-api": "./dist/units/gateway-api/index.js"
|
51
|
+
"./units/gateway-api": "./dist/units/gateway-api/index.js",
|
52
|
+
"./impl/gateway-route": "./dist/impl/gateway-route.js",
|
53
|
+
"./impl/tls-certificate": "./dist/impl/tls-certificate.js"
|
29
54
|
},
|
30
55
|
"publishConfig": {
|
31
56
|
"access": "public"
|
32
57
|
},
|
33
58
|
"scripts": {
|
34
59
|
"build": "highstate build",
|
35
|
-
"update-charts": "
|
36
|
-
"update-images": "
|
60
|
+
"update-charts": "../../../scripts/update-charts.sh ./assets/charts.json",
|
61
|
+
"update-images": "../../../scripts/update-images.sh ./assets/images.json",
|
37
62
|
"generate-crds": "./scripts/generate-crds.sh"
|
38
63
|
},
|
39
64
|
"dependencies": {
|
40
|
-
"@highstate/cert-manager": "^0.9.
|
41
|
-
"@highstate/common": "^0.9.
|
42
|
-
"@highstate/contract": "^0.9.
|
43
|
-
"@highstate/gateway-api": "^0.9.
|
44
|
-
"@highstate/library": "^0.9.
|
45
|
-
"@highstate/pulumi": "^0.9.
|
65
|
+
"@highstate/cert-manager": "^0.9.19",
|
66
|
+
"@highstate/common": "^0.9.19",
|
67
|
+
"@highstate/contract": "^0.9.19",
|
68
|
+
"@highstate/gateway-api": "^0.9.19",
|
69
|
+
"@highstate/library": "^0.9.19",
|
70
|
+
"@highstate/pulumi": "^0.9.19",
|
46
71
|
"@kubernetes/client-node": "^1.1.0",
|
47
72
|
"@pulumi/command": "^1.0.2",
|
48
73
|
"@pulumi/kubernetes": "^4.18.0",
|
49
|
-
"@pulumi/pulumi": "^3.
|
74
|
+
"@pulumi/pulumi": "^3.184.0",
|
50
75
|
"crypto-hash": "^3.1.0",
|
51
76
|
"deepmerge-ts": "^7.1.5",
|
52
77
|
"glob": "^11.0.1",
|
@@ -55,7 +80,8 @@
|
|
55
80
|
"remeda": "^2.21.0"
|
56
81
|
},
|
57
82
|
"devDependencies": {
|
58
|
-
"@highstate/cli": "^0.9.
|
83
|
+
"@highstate/cli": "^0.9.19",
|
84
|
+
"type-fest": "^4.41.0"
|
59
85
|
},
|
60
|
-
"gitHead": "
|
86
|
+
"gitHead": "e77d292335556c6e5b6275acda1a3d1609d786a1"
|
61
87
|
}
|
package/src/cluster.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { k8s } from "@highstate/library"
|
2
|
-
import { text } from "@highstate/contract"
|
3
|
-
import {
|
2
|
+
import { text, type UnitTerminal } from "@highstate/contract"
|
3
|
+
import { fileFromString, output, type Output, type Input } from "@highstate/pulumi"
|
4
4
|
import { CoreV1Api, type KubeConfig } from "@kubernetes/client-node"
|
5
5
|
import { images } from "./shared"
|
6
6
|
|
@@ -39,32 +39,40 @@ export async function detectExternalIps(
|
|
39
39
|
})
|
40
40
|
}
|
41
41
|
|
42
|
-
export function createK8sTerminal(kubeconfig: Input<string>):
|
43
|
-
return {
|
42
|
+
export function createK8sTerminal(kubeconfig: Input<string>): Output<UnitTerminal> {
|
43
|
+
return output({
|
44
44
|
name: "management",
|
45
|
-
title: "Cluster Management",
|
46
|
-
description: "Manage the cluster using kubectl and helm",
|
47
|
-
icon: "devicon:kubernetes",
|
48
45
|
|
49
|
-
|
50
|
-
|
46
|
+
meta: {
|
47
|
+
title: "Cluster Management",
|
48
|
+
description: "Manage the cluster using kubectl and helm",
|
49
|
+
icon: "devicon:kubernetes",
|
50
|
+
},
|
51
51
|
|
52
|
-
|
53
|
-
"
|
52
|
+
spec: {
|
53
|
+
image: images["terminal-kubectl"].image,
|
54
|
+
command: ["bash", "/welcome.sh"],
|
54
55
|
|
55
|
-
|
56
|
-
|
57
|
-
kubectl cluster-info
|
56
|
+
files: {
|
57
|
+
"/kubeconfig": fileFromString("kubeconfig", kubeconfig, { isSecret: true }),
|
58
58
|
|
59
|
-
|
60
|
-
|
59
|
+
"/welcome.sh": fileFromString(
|
60
|
+
"welcome.sh",
|
61
|
+
text`
|
62
|
+
echo "Connecting to the cluster..."
|
63
|
+
kubectl cluster-info
|
61
64
|
|
62
|
-
|
63
|
-
|
64
|
-
},
|
65
|
+
echo "Use 'kubectl' and 'helm' to manage the cluster."
|
66
|
+
echo
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
+
exec bash
|
69
|
+
`,
|
70
|
+
),
|
71
|
+
},
|
72
|
+
|
73
|
+
env: {
|
74
|
+
KUBECONFIG: "/kubeconfig",
|
75
|
+
},
|
68
76
|
},
|
69
|
-
}
|
77
|
+
})
|
70
78
|
}
|
package/src/config-map.ts
CHANGED
@@ -1,50 +1,61 @@
|
|
1
1
|
import type { k8s } from "@highstate/library"
|
2
|
+
import { getOrCreate } from "@highstate/contract"
|
3
|
+
import { toPromise } from "@highstate/pulumi"
|
2
4
|
import { core, type types } from "@pulumi/kubernetes"
|
3
5
|
import {
|
4
|
-
ComponentResource,
|
5
|
-
output,
|
6
|
-
Output,
|
7
6
|
type ComponentResourceOptions,
|
8
7
|
type Input,
|
9
8
|
type Inputs,
|
9
|
+
interpolate,
|
10
|
+
type Output,
|
11
|
+
output,
|
10
12
|
} from "@pulumi/pulumi"
|
11
|
-
import {
|
13
|
+
import { Namespace } from "./namespace"
|
14
|
+
import { getProvider, mapMetadata, ScopedResource, type ScopedResourceArgs } from "./shared"
|
12
15
|
|
13
|
-
export type ConfigMapArgs =
|
16
|
+
export type ConfigMapArgs = ScopedResourceArgs &
|
14
17
|
Omit<types.input.core.v1.ConfigMap, "kind" | "metadata" | "apiVersion">
|
15
18
|
|
16
|
-
export type
|
19
|
+
export type CreateOrGetConfigMapArgs = ConfigMapArgs & {
|
17
20
|
/**
|
18
|
-
* The
|
19
|
-
*
|
20
|
-
* If not provided, the config map will be created, otherwise it will be retrieved/patched.
|
21
|
+
* The config map entity to patch/retrieve.
|
21
22
|
*/
|
22
|
-
existing: Input<k8s.
|
23
|
+
existing: Input<k8s.ScopedResource> | undefined
|
23
24
|
}
|
24
25
|
|
25
|
-
|
26
|
+
/**
|
27
|
+
* Represents a Kubernetes ConfigMap resource with metadata and data.
|
28
|
+
*/
|
29
|
+
export abstract class ConfigMap extends ScopedResource {
|
26
30
|
protected constructor(
|
27
31
|
type: string,
|
28
32
|
name: string,
|
29
33
|
args: Inputs,
|
30
34
|
opts: ComponentResourceOptions | undefined,
|
31
35
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
/**
|
38
|
-
* The metadata of the underlying Kubernetes config map.
|
39
|
-
*/
|
40
|
-
readonly metadata: Output<types.output.meta.v1.ObjectMeta>,
|
36
|
+
apiVersion: Output<string>,
|
37
|
+
kind: Output<string>,
|
38
|
+
namespace: Output<Namespace>,
|
39
|
+
metadata: Output<types.output.meta.v1.ObjectMeta>,
|
41
40
|
|
42
41
|
/**
|
43
42
|
* The data of the underlying Kubernetes config map.
|
44
43
|
*/
|
45
44
|
readonly data: Output<Record<string, string>>,
|
46
45
|
) {
|
47
|
-
super(type, name, args, opts)
|
46
|
+
super(type, name, args, opts, apiVersion, kind, namespace, metadata)
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* The Highstate config map entity.
|
51
|
+
*/
|
52
|
+
get entity(): Output<k8s.ScopedResource> {
|
53
|
+
return output({
|
54
|
+
type: "config-map",
|
55
|
+
clusterId: this.cluster.id,
|
56
|
+
clusterName: this.cluster.name,
|
57
|
+
metadata: this.metadata,
|
58
|
+
})
|
48
59
|
}
|
49
60
|
|
50
61
|
/**
|
@@ -57,26 +68,66 @@ export abstract class ConfigMap extends ComponentResource {
|
|
57
68
|
/**
|
58
69
|
* Creates a new config map or patches an existing one.
|
59
70
|
*
|
60
|
-
*
|
71
|
+
* @param name The name of the resource. May not be the same as the config map name.
|
72
|
+
* @param args The arguments to create or patch the config map with.
|
73
|
+
* @param opts Optional resource options.
|
61
74
|
*/
|
62
75
|
static createOrPatch(
|
63
76
|
name: string,
|
64
|
-
args:
|
77
|
+
args: CreateOrGetConfigMapArgs,
|
65
78
|
opts?: ComponentResourceOptions,
|
66
79
|
): ConfigMap {
|
67
|
-
if (
|
68
|
-
return new
|
80
|
+
if (args.existing) {
|
81
|
+
return new ConfigMapPatch(name, {
|
82
|
+
...args,
|
83
|
+
name: output(args.existing).metadata.name,
|
84
|
+
})
|
69
85
|
}
|
70
86
|
|
71
|
-
return new
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
87
|
+
return new CreatedConfigMap(name, args, opts)
|
88
|
+
}
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Creates a new config map or gets an existing one.
|
92
|
+
*
|
93
|
+
* @param name The name of the resource. May not be the same as the config map name. Will not be used when existing config map is retrieved.
|
94
|
+
* @param args The arguments to create or get the config map with.
|
95
|
+
* @param opts Optional resource options.
|
96
|
+
*/
|
97
|
+
static async createOrGet(
|
98
|
+
name: string,
|
99
|
+
args: CreateOrGetConfigMapArgs,
|
100
|
+
opts?: ComponentResourceOptions,
|
101
|
+
): Promise<ConfigMap> {
|
102
|
+
if (args.existing) {
|
103
|
+
return await ConfigMap.forAsync(args.existing, output(args.namespace).cluster)
|
104
|
+
}
|
105
|
+
|
106
|
+
return new CreatedConfigMap(name, args, opts)
|
107
|
+
}
|
108
|
+
|
109
|
+
/**
|
110
|
+
* Patches an existing config map.
|
111
|
+
*
|
112
|
+
* Will throw an error if the config map does not exist.
|
113
|
+
*
|
114
|
+
* @param name The name of the resource. May not be the same as the config map name.
|
115
|
+
* @param args The arguments to patch the config map with.
|
116
|
+
* @param opts Optional resource options.
|
117
|
+
*/
|
118
|
+
static patch(name: string, args: ConfigMapArgs, opts?: ComponentResourceOptions): ConfigMap {
|
119
|
+
return new ConfigMapPatch(name, args, opts)
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Wraps an existing Kubernetes config map.
|
124
|
+
*/
|
125
|
+
static wrap(
|
126
|
+
name: string,
|
127
|
+
args: WrappedConfigMapArgs,
|
128
|
+
opts?: ComponentResourceOptions,
|
129
|
+
): ConfigMap {
|
130
|
+
return new WrappedConfigMap(name, args, opts)
|
80
131
|
}
|
81
132
|
|
82
133
|
/**
|
@@ -86,17 +137,61 @@ export abstract class ConfigMap extends ComponentResource {
|
|
86
137
|
*/
|
87
138
|
static get(
|
88
139
|
name: string,
|
89
|
-
|
90
|
-
cluster: Input<k8s.Cluster>,
|
140
|
+
args: ExternalConfigMapArgs,
|
91
141
|
opts?: ComponentResourceOptions,
|
92
142
|
): ConfigMap {
|
93
|
-
return new ExternalConfigMap(name,
|
143
|
+
return new ExternalConfigMap(name, args, opts)
|
144
|
+
}
|
145
|
+
|
146
|
+
private static readonly configMapCache = new Map<string, ConfigMap>()
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Gets an existing config map for a given entity.
|
150
|
+
* Prefer this method over `get` when possible.
|
151
|
+
*
|
152
|
+
* It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.
|
153
|
+
*
|
154
|
+
* This method is idempotent and will return the same instance for the same entity.
|
155
|
+
*
|
156
|
+
* @param entity The entity to get the config map for.
|
157
|
+
* @param cluster The cluster where the config map is located.
|
158
|
+
*/
|
159
|
+
static for(entity: k8s.ScopedResource, cluster: Input<k8s.Cluster>): ConfigMap {
|
160
|
+
return getOrCreate(
|
161
|
+
ConfigMap.configMapCache,
|
162
|
+
`${entity.clusterName}.${entity.metadata.namespace}.${entity.metadata.name}.${entity.clusterId}`,
|
163
|
+
name => {
|
164
|
+
return ConfigMap.get(name, {
|
165
|
+
name: entity.metadata.name,
|
166
|
+
namespace: Namespace.forResource(entity, cluster),
|
167
|
+
})
|
168
|
+
},
|
169
|
+
)
|
170
|
+
}
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Gets an existing config map for a given entity.
|
174
|
+
* Prefer this method over `get` when possible.
|
175
|
+
*
|
176
|
+
* It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.
|
177
|
+
*
|
178
|
+
* This method is idempotent and will return the same instance for the same entity.
|
179
|
+
*
|
180
|
+
* @param entity The entity to get the config map for.
|
181
|
+
* @param cluster The cluster where the config map is located.
|
182
|
+
*/
|
183
|
+
static async forAsync(
|
184
|
+
entity: Input<k8s.ScopedResource>,
|
185
|
+
cluster: Input<k8s.Cluster>,
|
186
|
+
): Promise<ConfigMap> {
|
187
|
+
const resolvedEntity = await toPromise(entity)
|
188
|
+
return ConfigMap.for(resolvedEntity, cluster)
|
94
189
|
}
|
95
190
|
}
|
96
191
|
|
97
192
|
class CreatedConfigMap extends ConfigMap {
|
98
193
|
constructor(name: string, args: ConfigMapArgs, opts?: ComponentResourceOptions) {
|
99
|
-
const configMap = output(args).apply(
|
194
|
+
const configMap = output(args.namespace).cluster.apply(cluster => {
|
100
195
|
return new core.v1.ConfigMap(
|
101
196
|
name,
|
102
197
|
{
|
@@ -106,7 +201,7 @@ class CreatedConfigMap extends ConfigMap {
|
|
106
201
|
{
|
107
202
|
...opts,
|
108
203
|
parent: this,
|
109
|
-
provider:
|
204
|
+
provider: getProvider(cluster),
|
110
205
|
},
|
111
206
|
)
|
112
207
|
})
|
@@ -116,7 +211,9 @@ class CreatedConfigMap extends ConfigMap {
|
|
116
211
|
name,
|
117
212
|
args,
|
118
213
|
opts,
|
119
|
-
|
214
|
+
configMap.apiVersion,
|
215
|
+
configMap.kind,
|
216
|
+
output(args.namespace),
|
120
217
|
configMap.metadata,
|
121
218
|
configMap.data,
|
122
219
|
)
|
@@ -125,7 +222,7 @@ class CreatedConfigMap extends ConfigMap {
|
|
125
222
|
|
126
223
|
class ConfigMapPatch extends ConfigMap {
|
127
224
|
constructor(name: string, args: ConfigMapArgs, opts?: ComponentResourceOptions) {
|
128
|
-
const configMap = output(args).apply(
|
225
|
+
const configMap = output(args.namespace).cluster.apply(cluster => {
|
129
226
|
return new core.v1.ConfigMapPatch(
|
130
227
|
name,
|
131
228
|
{
|
@@ -135,7 +232,7 @@ class ConfigMapPatch extends ConfigMap {
|
|
135
232
|
{
|
136
233
|
...opts,
|
137
234
|
parent: this,
|
138
|
-
provider:
|
235
|
+
provider: getProvider(cluster),
|
139
236
|
},
|
140
237
|
)
|
141
238
|
})
|
@@ -145,34 +242,75 @@ class ConfigMapPatch extends ConfigMap {
|
|
145
242
|
name,
|
146
243
|
args,
|
147
244
|
opts,
|
148
|
-
|
245
|
+
configMap.apiVersion,
|
246
|
+
configMap.kind,
|
247
|
+
output(args.namespace),
|
149
248
|
configMap.metadata,
|
150
249
|
configMap.data,
|
151
250
|
)
|
152
251
|
}
|
153
252
|
}
|
154
253
|
|
254
|
+
export type WrappedConfigMapArgs = {
|
255
|
+
/**
|
256
|
+
* The underlying Kubernetes config map to wrap.
|
257
|
+
*/
|
258
|
+
configMap: Input<core.v1.ConfigMap>
|
259
|
+
|
260
|
+
/**
|
261
|
+
* The namespace where the config map is located.
|
262
|
+
*/
|
263
|
+
namespace: Input<Namespace>
|
264
|
+
}
|
265
|
+
|
266
|
+
class WrappedConfigMap extends ConfigMap {
|
267
|
+
constructor(name: string, args: WrappedConfigMapArgs, opts?: ComponentResourceOptions) {
|
268
|
+
super(
|
269
|
+
"highstate:k8s:WrappedConfigMap",
|
270
|
+
name,
|
271
|
+
args,
|
272
|
+
opts,
|
273
|
+
|
274
|
+
output(args.configMap).apiVersion,
|
275
|
+
output(args.configMap).kind,
|
276
|
+
output(args.namespace),
|
277
|
+
output(args.configMap).metadata,
|
278
|
+
output(args.configMap).data,
|
279
|
+
)
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
export type ExternalConfigMapArgs = {
|
284
|
+
/**
|
285
|
+
* The name of the config map to get.
|
286
|
+
*/
|
287
|
+
name: Input<string>
|
288
|
+
|
289
|
+
/**
|
290
|
+
* The namespace where the config map is located.
|
291
|
+
*/
|
292
|
+
namespace: Input<Namespace>
|
293
|
+
}
|
294
|
+
|
155
295
|
class ExternalConfigMap extends ConfigMap {
|
156
|
-
constructor(
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
return core.v1.ConfigMap.get(name, realName, {
|
164
|
-
...opts,
|
165
|
-
parent: this,
|
166
|
-
provider: await getProvider(cluster),
|
167
|
-
})
|
296
|
+
constructor(name: string, args: ExternalConfigMapArgs, opts?: ComponentResourceOptions) {
|
297
|
+
const configMap = output(args.namespace).cluster.apply(cluster => {
|
298
|
+
return core.v1.ConfigMap.get(
|
299
|
+
name,
|
300
|
+
interpolate`${output(args.namespace).metadata.name}/${args.name}`,
|
301
|
+
{ ...opts, parent: this, provider: getProvider(cluster) },
|
302
|
+
)
|
168
303
|
})
|
169
304
|
|
170
305
|
super(
|
171
306
|
"highstate:k8s:ExternalConfigMap",
|
172
307
|
name,
|
173
|
-
|
308
|
+
args,
|
174
309
|
opts,
|
175
|
-
|
310
|
+
|
311
|
+
configMap.apiVersion,
|
312
|
+
configMap.kind,
|
313
|
+
output(args.namespace),
|
176
314
|
configMap.metadata,
|
177
315
|
configMap.data,
|
178
316
|
)
|
package/src/container.ts
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
import type { PartialKeys } from "@highstate/contract"
|
2
2
|
import type { k8s, network } from "@highstate/library"
|
3
|
-
import { core, type types } from "@pulumi/kubernetes"
|
4
3
|
import {
|
5
|
-
normalize,
|
6
|
-
Output,
|
7
|
-
output,
|
8
4
|
type Input,
|
9
5
|
type InputArray,
|
6
|
+
normalize,
|
7
|
+
type Output,
|
8
|
+
output,
|
10
9
|
type Unwrap,
|
11
10
|
} from "@highstate/pulumi"
|
11
|
+
import { core, type types } from "@pulumi/kubernetes"
|
12
12
|
import { concat, map, omit } from "remeda"
|
13
|
+
import { ConfigMap } from "./config-map"
|
13
14
|
import { PersistentVolumeClaim } from "./pvc"
|
14
15
|
import { Secret } from "./secret"
|
15
|
-
import { ConfigMap } from "./config-map"
|
16
16
|
|
17
17
|
export type Container = Omit<PartialKeys<types.input.core.v1.Container, "name">, "volumeMounts"> & {
|
18
18
|
/**
|