@highstate/k8s 0.9.18 → 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/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 +39 -13
- 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/src/scripting/bundle.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ContainerEnvironment, ContainerVolumeMount, WorkloadVolume } from "../container"
|
2
2
|
import type { network } from "@highstate/library"
|
3
|
-
import {
|
3
|
+
import { normalize, type InputArray } from "@highstate/pulumi"
|
4
4
|
import {
|
5
5
|
ComponentResource,
|
6
6
|
output,
|
@@ -9,13 +9,13 @@ import {
|
|
9
9
|
type Output,
|
10
10
|
type Unwrap,
|
11
11
|
} from "@pulumi/pulumi"
|
12
|
-
import { mapValues, omitBy
|
12
|
+
import { mapValues, omitBy } from "remeda"
|
13
13
|
import { deepmerge } from "deepmerge-ts"
|
14
14
|
import { readPackageJSON } from "pkg-types"
|
15
15
|
import { text, trimIndentation } from "@highstate/contract"
|
16
16
|
import { parseL34Endpoint } from "@highstate/common"
|
17
17
|
import { serializeFunction } from "@pulumi/pulumi/runtime/index.js"
|
18
|
-
import {
|
18
|
+
import type { ScopedResourceArgs } from "../shared"
|
19
19
|
import { ConfigMap } from "../config-map"
|
20
20
|
import {
|
21
21
|
emptyScriptEnvironment,
|
@@ -25,7 +25,7 @@ import {
|
|
25
25
|
type ScriptEnvironment,
|
26
26
|
} from "./environment"
|
27
27
|
|
28
|
-
export type ScriptBundleArgs =
|
28
|
+
export type ScriptBundleArgs = ScopedResourceArgs & {
|
29
29
|
/**
|
30
30
|
* The environment to bundle the scripts from.
|
31
31
|
*/
|
@@ -81,11 +81,11 @@ export class ScriptBundle extends ComponentResource {
|
|
81
81
|
constructor(name: string, args: ScriptBundleArgs, opts?: ComponentResourceOptions) {
|
82
82
|
super("highstate:k8s:ScriptBundle", name, args, opts)
|
83
83
|
|
84
|
-
const scriptEnvironment =
|
85
|
-
|
86
|
-
apply(args =>
|
87
|
-
|
88
|
-
|
84
|
+
const scriptEnvironment = output(args)
|
85
|
+
.apply(args => normalize(args.environment, args.environments))
|
86
|
+
.apply(args => deepmerge(emptyScriptEnvironment, ...args)) as Output<
|
87
|
+
Unwrap<ResolvedScriptEnvironment>
|
88
|
+
>
|
89
89
|
|
90
90
|
const hasFunctionScripts = scriptEnvironment.apply(scriptEnvironment => {
|
91
91
|
return Object.values(scriptEnvironment.files).some(file => typeof file === "function")
|
@@ -121,7 +121,6 @@ export class ScriptBundle extends ComponentResource {
|
|
121
121
|
return ConfigMap.create(
|
122
122
|
name,
|
123
123
|
{
|
124
|
-
cluster: args.cluster,
|
125
124
|
namespace: args.namespace,
|
126
125
|
|
127
126
|
data: createScriptData(this.distribution, scriptEnvironment),
|
@@ -162,16 +161,6 @@ export class ScriptBundle extends ComponentResource {
|
|
162
161
|
: []),
|
163
162
|
]
|
164
163
|
})
|
165
|
-
|
166
|
-
this.registerOutputs({
|
167
|
-
configMap: this.configMap,
|
168
|
-
volumes: this.volumes,
|
169
|
-
volumeMounts: this.volumeMounts,
|
170
|
-
environment: this.environment,
|
171
|
-
distribution: this.distribution,
|
172
|
-
allowedEndpoints: this.allowedEndpoints,
|
173
|
-
image: this.image,
|
174
|
-
})
|
175
164
|
}
|
176
165
|
}
|
177
166
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Container } from "../container"
|
2
2
|
import type { ScriptBundle } from "./bundle"
|
3
3
|
import { merge } from "remeda"
|
4
|
-
import { Output, output, type Input } from "@pulumi/pulumi"
|
4
|
+
import { type Output, output, type Input } from "@pulumi/pulumi"
|
5
5
|
|
6
6
|
export type ScriptContainer = Container & {
|
7
7
|
/**
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Input, InputArray,
|
1
|
+
import type { Input, InputArray, InputRecord } from "@highstate/pulumi"
|
2
2
|
import type { ContainerEnvironment, ContainerVolumeMount, WorkloadVolume } from "../container"
|
3
3
|
import type { InputL34Endpoint } from "@highstate/common"
|
4
4
|
|
@@ -21,7 +21,7 @@ export type DistributionEnvironment = {
|
|
21
21
|
* The pre-install scripts that should be run before installing packages.
|
22
22
|
* Typically, these scripts are used to install additional repositories.
|
23
23
|
*/
|
24
|
-
preInstallScripts?:
|
24
|
+
preInstallScripts?: InputRecord<string>
|
25
25
|
|
26
26
|
/**
|
27
27
|
* The packages that are available in the environment.
|
@@ -46,17 +46,17 @@ export type ScriptEnvironment = {
|
|
46
46
|
/**
|
47
47
|
* The setup scripts that should be run before the script.
|
48
48
|
*/
|
49
|
-
setupScripts?:
|
49
|
+
setupScripts?: InputRecord<string>
|
50
50
|
|
51
51
|
/**
|
52
52
|
* The cleanup scripts that should be run after the script.
|
53
53
|
*/
|
54
|
-
cleanupScripts?:
|
54
|
+
cleanupScripts?: InputRecord<string>
|
55
55
|
|
56
56
|
/**
|
57
57
|
* The arbitrary files available in the environment including scripts.
|
58
58
|
*/
|
59
|
-
files?:
|
59
|
+
files?: InputRecord<string | ScriptProgram>
|
60
60
|
|
61
61
|
/**
|
62
62
|
* The volumes that should be defined in the environment.
|
package/src/secret.ts
CHANGED
@@ -1,43 +1,42 @@
|
|
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 { getProvider, mapMetadata,
|
13
|
+
import { getProvider, mapMetadata, type ScopedResourceArgs, ScopedResource } from "./shared"
|
14
|
+
import { Namespace } from "./namespace"
|
12
15
|
|
13
|
-
export type SecretArgs =
|
16
|
+
export type SecretArgs = ScopedResourceArgs &
|
14
17
|
Omit<types.input.core.v1.Secret, "kind" | "metadata" | "apiVersion">
|
15
18
|
|
16
|
-
export type
|
19
|
+
export type CreateOrGetSecretArgs = SecretArgs & {
|
17
20
|
/**
|
18
|
-
* The
|
19
|
-
*
|
20
|
-
* If not provided, the secret will be created, otherwise it will be retrieved/patched.
|
21
|
+
* The secret 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 Secret resource with metadata and data.
|
28
|
+
*/
|
29
|
+
export abstract class Secret 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 secret.
|
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 secret.
|
@@ -49,7 +48,31 @@ export abstract class Secret extends ComponentResource {
|
|
49
48
|
*/
|
50
49
|
readonly stringData: Output<Record<string, string>>,
|
51
50
|
) {
|
52
|
-
super(type, name, args, opts)
|
51
|
+
super(type, name, args, opts, apiVersion, kind, namespace, metadata)
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* The Highstate secret entity.
|
56
|
+
*/
|
57
|
+
get entity(): Output<k8s.ScopedResource> {
|
58
|
+
return output({
|
59
|
+
type: "secret",
|
60
|
+
clusterId: this.cluster.id,
|
61
|
+
clusterName: this.cluster.name,
|
62
|
+
metadata: this.metadata,
|
63
|
+
})
|
64
|
+
}
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Gets the value of the secret field by the given key in `data`.
|
68
|
+
*
|
69
|
+
* Automatically decodes the base64 value.
|
70
|
+
*
|
71
|
+
* @param key The key of the secret.
|
72
|
+
* @returns The value of the secret.
|
73
|
+
*/
|
74
|
+
getValue(key: string): Output<string> {
|
75
|
+
return this.data[key].apply(value => Buffer.from(value, "base64").toString())
|
53
76
|
}
|
54
77
|
|
55
78
|
/**
|
@@ -62,26 +85,62 @@ export abstract class Secret extends ComponentResource {
|
|
62
85
|
/**
|
63
86
|
* Creates a new secret or patches an existing one.
|
64
87
|
*
|
65
|
-
*
|
88
|
+
* @param name The name of the resource. May not be the same as the secret name.
|
89
|
+
* @param args The arguments to create or patch the secret with.
|
90
|
+
* @param opts Optional resource options.
|
66
91
|
*/
|
67
92
|
static createOrPatch(
|
68
93
|
name: string,
|
69
|
-
args:
|
94
|
+
args: CreateOrGetSecretArgs,
|
70
95
|
opts?: ComponentResourceOptions,
|
71
96
|
): Secret {
|
72
|
-
if (
|
73
|
-
return new
|
97
|
+
if (args.existing) {
|
98
|
+
return new SecretPatch(name, {
|
99
|
+
...args,
|
100
|
+
name: output(args.existing).metadata.name,
|
101
|
+
})
|
74
102
|
}
|
75
103
|
|
76
|
-
return new
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
104
|
+
return new CreatedSecret(name, args, opts)
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Creates a new secret or gets an existing one.
|
109
|
+
*
|
110
|
+
* @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.
|
111
|
+
* @param args The arguments to create or get the secret with.
|
112
|
+
* @param opts Optional resource options.
|
113
|
+
*/
|
114
|
+
static async createOrGet(
|
115
|
+
name: string,
|
116
|
+
args: CreateOrGetSecretArgs,
|
117
|
+
opts?: ComponentResourceOptions,
|
118
|
+
): Promise<Secret> {
|
119
|
+
if (args.existing) {
|
120
|
+
return await Secret.forAsync(args.existing, output(args.namespace).cluster)
|
121
|
+
}
|
122
|
+
|
123
|
+
return new CreatedSecret(name, args, opts)
|
124
|
+
}
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Patches an existing secret.
|
128
|
+
*
|
129
|
+
* Will throw an error if the secret does not exist.
|
130
|
+
*
|
131
|
+
* @param name The name of the resource. May not be the same as the secret name.
|
132
|
+
* @param args The arguments to patch the secret with.
|
133
|
+
* @param opts Optional resource options.
|
134
|
+
*/
|
135
|
+
static patch(name: string, args: SecretArgs, opts?: ComponentResourceOptions): Secret {
|
136
|
+
return new SecretPatch(name, args, opts)
|
137
|
+
}
|
138
|
+
|
139
|
+
/**
|
140
|
+
* Wraps an existing Kubernetes secret.
|
141
|
+
*/
|
142
|
+
static wrap(name: string, args: WrappedSecretArgs, opts?: ComponentResourceOptions): Secret {
|
143
|
+
return new WrappedSecret(name, args, opts)
|
85
144
|
}
|
86
145
|
|
87
146
|
/**
|
@@ -89,19 +148,59 @@ export abstract class Secret extends ComponentResource {
|
|
89
148
|
*
|
90
149
|
* Will throw an error if the secret does not exist.
|
91
150
|
*/
|
92
|
-
static get(
|
93
|
-
name
|
94
|
-
|
151
|
+
static get(name: string, args: ExternalSecretArgs, opts?: ComponentResourceOptions): Secret {
|
152
|
+
return new ExternalSecret(name, args, opts)
|
153
|
+
}
|
154
|
+
|
155
|
+
private static readonly secretCache = new Map<string, Secret>()
|
156
|
+
|
157
|
+
/**
|
158
|
+
* Gets an existing secret for a given entity.
|
159
|
+
* Prefer this method over `get` when possible.
|
160
|
+
*
|
161
|
+
* It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.
|
162
|
+
*
|
163
|
+
* This method is idempotent and will return the same instance for the same entity.
|
164
|
+
*
|
165
|
+
* @param entity The entity to get the secret for.
|
166
|
+
* @param cluster The cluster where the secret is located.
|
167
|
+
*/
|
168
|
+
static for(entity: k8s.ScopedResource, cluster: Input<k8s.Cluster>): Secret {
|
169
|
+
return getOrCreate(
|
170
|
+
Secret.secretCache,
|
171
|
+
`${entity.clusterName}.${entity.metadata.namespace}.${entity.metadata.name}.${entity.clusterId}`,
|
172
|
+
name => {
|
173
|
+
return Secret.get(name, {
|
174
|
+
name: entity.metadata.name,
|
175
|
+
namespace: Namespace.forResource(entity, cluster),
|
176
|
+
})
|
177
|
+
},
|
178
|
+
)
|
179
|
+
}
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Gets an existing secret for a given entity.
|
183
|
+
* Prefer this method over `get` when possible.
|
184
|
+
*
|
185
|
+
* It automatically names the resource with the following format: `{clusterName}.{namespace}.{name}.{clusterId}`.
|
186
|
+
*
|
187
|
+
* This method is idempotent and will return the same instance for the same entity.
|
188
|
+
*
|
189
|
+
* @param entity The entity to get the secret for.
|
190
|
+
* @param cluster The cluster where the secret is located.
|
191
|
+
*/
|
192
|
+
static async forAsync(
|
193
|
+
entity: Input<k8s.ScopedResource>,
|
95
194
|
cluster: Input<k8s.Cluster>,
|
96
|
-
|
97
|
-
|
98
|
-
return
|
195
|
+
): Promise<Secret> {
|
196
|
+
const resolvedEntity = await toPromise(entity)
|
197
|
+
return Secret.for(resolvedEntity, cluster)
|
99
198
|
}
|
100
199
|
}
|
101
200
|
|
102
201
|
class CreatedSecret extends Secret {
|
103
202
|
constructor(name: string, args: SecretArgs, opts?: ComponentResourceOptions) {
|
104
|
-
const secret = output(args).apply(
|
203
|
+
const secret = output(args.namespace).cluster.apply(cluster => {
|
105
204
|
return new core.v1.Secret(
|
106
205
|
name,
|
107
206
|
{
|
@@ -114,7 +213,7 @@ class CreatedSecret extends Secret {
|
|
114
213
|
{
|
115
214
|
...opts,
|
116
215
|
parent: this,
|
117
|
-
provider:
|
216
|
+
provider: getProvider(cluster),
|
118
217
|
},
|
119
218
|
)
|
120
219
|
})
|
@@ -124,7 +223,9 @@ class CreatedSecret extends Secret {
|
|
124
223
|
name,
|
125
224
|
args,
|
126
225
|
opts,
|
127
|
-
|
226
|
+
secret.apiVersion,
|
227
|
+
secret.kind,
|
228
|
+
output(args.namespace),
|
128
229
|
secret.metadata,
|
129
230
|
secret.data,
|
130
231
|
secret.stringData,
|
@@ -134,7 +235,7 @@ class CreatedSecret extends Secret {
|
|
134
235
|
|
135
236
|
class SecretPatch extends Secret {
|
136
237
|
constructor(name: string, args: SecretArgs, opts?: ComponentResourceOptions) {
|
137
|
-
const secret = output(args).apply(
|
238
|
+
const secret = output(args.namespace).cluster.apply(cluster => {
|
138
239
|
return new core.v1.SecretPatch(
|
139
240
|
name,
|
140
241
|
{
|
@@ -147,7 +248,7 @@ class SecretPatch extends Secret {
|
|
147
248
|
{
|
148
249
|
...opts,
|
149
250
|
parent: this,
|
150
|
-
provider:
|
251
|
+
provider: getProvider(cluster),
|
151
252
|
},
|
152
253
|
)
|
153
254
|
})
|
@@ -157,7 +258,9 @@ class SecretPatch extends Secret {
|
|
157
258
|
name,
|
158
259
|
args,
|
159
260
|
opts,
|
160
|
-
|
261
|
+
secret.apiVersion,
|
262
|
+
secret.kind,
|
263
|
+
output(args.namespace),
|
161
264
|
secret.metadata,
|
162
265
|
secret.data,
|
163
266
|
secret.stringData,
|
@@ -165,32 +268,67 @@ class SecretPatch extends Secret {
|
|
165
268
|
}
|
166
269
|
}
|
167
270
|
|
271
|
+
export type WrappedSecretArgs = {
|
272
|
+
/**
|
273
|
+
* The underlying Kubernetes secret to wrap.
|
274
|
+
*/
|
275
|
+
secret: Input<core.v1.Secret>
|
276
|
+
|
277
|
+
/**
|
278
|
+
* The namespace where the secret is located.
|
279
|
+
*/
|
280
|
+
namespace: Input<Namespace>
|
281
|
+
}
|
282
|
+
|
283
|
+
class WrappedSecret extends Secret {
|
284
|
+
constructor(name: string, args: WrappedSecretArgs, opts?: ComponentResourceOptions) {
|
285
|
+
super(
|
286
|
+
"highstate:k8s:WrappedSecret",
|
287
|
+
name,
|
288
|
+
args,
|
289
|
+
opts,
|
290
|
+
|
291
|
+
output(args.secret).apiVersion,
|
292
|
+
output(args.secret).kind,
|
293
|
+
output(args.namespace),
|
294
|
+
output(args.secret).metadata,
|
295
|
+
output(args.secret).data,
|
296
|
+
output(args.secret).stringData,
|
297
|
+
)
|
298
|
+
}
|
299
|
+
}
|
300
|
+
|
301
|
+
export type ExternalSecretArgs = {
|
302
|
+
/**
|
303
|
+
* The name of the secret to get.
|
304
|
+
*/
|
305
|
+
name: Input<string>
|
306
|
+
|
307
|
+
/**
|
308
|
+
* The namespace where the secret is located.
|
309
|
+
*/
|
310
|
+
namespace: Input<Namespace>
|
311
|
+
}
|
312
|
+
|
168
313
|
class ExternalSecret extends Secret {
|
169
|
-
constructor(
|
170
|
-
|
171
|
-
id: Input<string>,
|
172
|
-
cluster: Input<k8s.Cluster>,
|
173
|
-
opts?: ComponentResourceOptions,
|
174
|
-
) {
|
175
|
-
const secret = output(id).apply(async realName => {
|
314
|
+
constructor(name: string, args: ExternalSecretArgs, opts?: ComponentResourceOptions) {
|
315
|
+
const secret = output(args.namespace).cluster.apply(cluster => {
|
176
316
|
return core.v1.Secret.get(
|
177
|
-
//
|
178
317
|
name,
|
179
|
-
|
180
|
-
{
|
181
|
-
...opts,
|
182
|
-
parent: this,
|
183
|
-
provider: await getProvider(cluster),
|
184
|
-
},
|
318
|
+
interpolate`${output(args.namespace).metadata.name}/${args.name}`,
|
319
|
+
{ ...opts, parent: this, provider: getProvider(cluster) },
|
185
320
|
)
|
186
321
|
})
|
187
322
|
|
188
323
|
super(
|
189
324
|
"highstate:k8s:ExternalSecret",
|
190
325
|
name,
|
191
|
-
|
326
|
+
args,
|
192
327
|
opts,
|
193
|
-
|
328
|
+
|
329
|
+
secret.apiVersion,
|
330
|
+
secret.kind,
|
331
|
+
output(args.namespace),
|
194
332
|
secret.metadata,
|
195
333
|
secret.data,
|
196
334
|
secret.stringData,
|