@highstate/k8s 0.9.6 → 0.9.8
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-FKNHHKOL.js → chunk-HTQP2NB4.js} +10 -3
- package/dist/chunk-HTQP2NB4.js.map +1 -0
- package/dist/{chunk-HW3NS3MC.js → chunk-J6O3TE56.js} +7 -7
- package/dist/chunk-J6O3TE56.js.map +1 -0
- package/dist/{chunk-UNVSWG6D.js → chunk-JBGQQVTZ.js} +3 -3
- package/dist/{chunk-QGHMLKTW.js → chunk-UNVUOHHB.js} +7 -7
- package/dist/{chunk-DQSCJM5S.js → chunk-YEH2UAPS.js} +3 -3
- package/dist/{chunk-OQ7UXASD.js → chunk-YTCZBMAL.js} +3 -3
- package/dist/deployment-TFCMSEGW.js +10 -0
- package/dist/highstate.manifest.json +4 -4
- package/dist/index.js +6 -6
- package/dist/stateful-set-2OEPSK44.js +10 -0
- package/dist/units/cert-manager/index.js +3 -3
- package/dist/units/dns01-issuer/index.js +1 -1
- package/dist/units/gateway-api/index.js +1 -1
- package/package.json +9 -9
- package/src/namespace.ts +16 -2
- package/src/service.ts +6 -6
- package/dist/chunk-FKNHHKOL.js.map +0 -1
- package/dist/chunk-HW3NS3MC.js.map +0 -1
- package/dist/deployment-ZP3ASKPT.js +0 -10
- package/dist/stateful-set-2AH7RAF7.js +0 -10
- /package/dist/{chunk-UNVSWG6D.js.map → chunk-JBGQQVTZ.js.map} +0 -0
- /package/dist/{chunk-QGHMLKTW.js.map → chunk-UNVUOHHB.js.map} +0 -0
- /package/dist/{chunk-DQSCJM5S.js.map → chunk-YEH2UAPS.js.map} +0 -0
- /package/dist/{chunk-OQ7UXASD.js.map → chunk-YTCZBMAL.js.map} +0 -0
- /package/dist/{deployment-ZP3ASKPT.js.map → deployment-TFCMSEGW.js.map} +0 -0
- /package/dist/{stateful-set-2AH7RAF7.js.map → stateful-set-2OEPSK44.js.map} +0 -0
@@ -163,13 +163,20 @@ var Namespace = class extends ComponentResource {
|
|
163
163
|
return new ExternalNamespace(name, id, cluster, opts);
|
164
164
|
}
|
165
165
|
};
|
166
|
+
function mapNamespaceMetadata(args, name) {
|
167
|
+
const labels = args.metadata?.labels ?? {};
|
168
|
+
if (args.privileged) {
|
169
|
+
labels["pod-security.kubernetes.io/enforce"] = "privileged";
|
170
|
+
}
|
171
|
+
return { ...mapMetadata(args, name), labels };
|
172
|
+
}
|
166
173
|
var CreatedNamespace = class extends Namespace {
|
167
174
|
constructor(name, args, opts) {
|
168
175
|
const namespace = output2(args).apply(async (args2) => {
|
169
176
|
return new core2.v1.Namespace(
|
170
177
|
name,
|
171
178
|
{
|
172
|
-
metadata:
|
179
|
+
metadata: mapNamespaceMetadata(args2, name)
|
173
180
|
},
|
174
181
|
{
|
175
182
|
...opts,
|
@@ -196,7 +203,7 @@ var NamespacePatch = class extends Namespace {
|
|
196
203
|
return new core2.v1.NamespacePatch(
|
197
204
|
name,
|
198
205
|
{
|
199
|
-
metadata:
|
206
|
+
metadata: mapNamespaceMetadata(args2, name)
|
200
207
|
},
|
201
208
|
{
|
202
209
|
...opts,
|
@@ -257,4 +264,4 @@ export {
|
|
257
264
|
getAppDisplayName,
|
258
265
|
withPatchName
|
259
266
|
};
|
260
|
-
//# sourceMappingURL=chunk-
|
267
|
+
//# sourceMappingURL=chunk-HTQP2NB4.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/namespace.ts","../src/shared.ts"],"sourcesContent":["import type { k8s } from \"@highstate/library\"\nimport { core, type types } from \"@pulumi/kubernetes\"\nimport {\n ComponentResource,\n output,\n Output,\n type ComponentResourceOptions,\n type Input,\n type Inputs,\n type Unwrap,\n} from \"@pulumi/pulumi\"\nimport { getProvider, mapMetadata, type CommonArgs } from \"./shared\"\n\nexport type NamespaceArgs = Omit<CommonArgs, \"namespace\"> & {\n /**\n * Whether to apply \"pod-security.kubernetes.io/enforce=privileged\" label to the namespace.\n */\n privileged?: boolean\n}\n\nexport type CreateOrPatchNamespaceArgs = NamespaceArgs & {\n /**\n * The resource to use to determine the name of the namespace.\n *\n * If not provided, the namespace will be created, otherwise it will be retrieved/patched.\n */\n resource: Input<k8s.Resource> | undefined\n}\n\nexport abstract class Namespace extends ComponentResource {\n protected constructor(\n type: string,\n name: string,\n args: Inputs,\n opts: ComponentResourceOptions | undefined,\n\n /**\n * The cluster where the namespace is created.\n */\n readonly cluster: Output<k8s.Cluster>,\n\n /*\n * The metadata of the underlying Kubernetes namespace.\n */\n readonly metadata: Output<types.output.meta.v1.ObjectMeta>,\n\n /**\n * The spec of the underlying Kubernetes namespace.\n */\n readonly spec: Output<types.output.core.v1.NamespaceSpec>,\n\n /**\n * The status of the underlying Kubernetes namespace.\n */\n readonly status: Output<types.output.core.v1.NamespaceStatus>,\n ) {\n super(type, name, args, opts)\n }\n\n /**\n * Creates a new namespace.\n */\n static create(name: string, args: NamespaceArgs, opts?: ComponentResourceOptions): Namespace {\n return new CreatedNamespace(name, args, opts)\n }\n\n /**\n * Creates a new namespace or patches an existing one.\n *\n * Will throw an error if the namespace does not exist when `args.resource` is provided.\n */\n static createOrPatch(\n name: string,\n args: CreateOrPatchNamespaceArgs,\n opts?: ComponentResourceOptions,\n ): Namespace {\n if (!args.resource) {\n return new CreatedNamespace(name, args, opts)\n }\n\n return new NamespacePatch(\n name,\n {\n ...args,\n name: output(args).apply(args => {\n if (args.resource!.clusterId !== args.cluster.id) {\n throw new Error(\n `Cluster mismatch when patching namespace \"${name}\": \"${args.resource!.clusterId}\" != \"${args.cluster.id}\"`,\n )\n }\n\n return args.resource!.metadata.namespace\n }),\n },\n opts,\n )\n }\n\n /**\n * Creates a new namespace or gets an existing one.\n *\n * Will throw an error if the namespace does not exist when `args.resource` is provided.\n */\n static createOrGet(\n name: string,\n args: CreateOrPatchNamespaceArgs,\n opts?: ComponentResourceOptions,\n ): Namespace {\n if (!args.resource) {\n return new CreatedNamespace(name, args, opts)\n }\n\n return new ExternalNamespace(\n name,\n output(args).apply(args => {\n if (args.resource!.clusterId !== args.cluster.id) {\n throw new Error(\n `Cluster mismatch when receiving namespace \"${name}\": \"${args.resource!.clusterId}\" != \"${args.cluster.id}\"`,\n )\n }\n\n return args.resource!.metadata.namespace\n }),\n args.cluster,\n opts,\n )\n }\n\n /**\n * Patches an existing namespace.\n *\n * Will throw an error if the namespace does not exist.\n */\n static patch(name: string, args: NamespaceArgs, opts?: ComponentResourceOptions): Namespace {\n return new NamespacePatch(name, args, opts)\n }\n\n /**\n * Gets an existing namespace.\n *\n * Will throw an error if the namespace does not exist.\n */\n static get(\n name: string,\n id: Input<string>,\n cluster: Input<k8s.Cluster>,\n opts?: ComponentResourceOptions,\n ): Namespace {\n return new ExternalNamespace(name, id, cluster, opts)\n }\n}\n\nfunction mapNamespaceMetadata(\n args: Unwrap<NamespaceArgs>,\n name: string,\n): types.input.meta.v1.ObjectMeta {\n const labels: Record<string, string> = args.metadata?.labels ?? {}\n\n if (args.privileged) {\n labels[\"pod-security.kubernetes.io/enforce\"] = \"privileged\"\n }\n\n return { ...mapMetadata(args, name), labels }\n}\n\nclass CreatedNamespace extends Namespace {\n constructor(name: string, args: NamespaceArgs, opts?: ComponentResourceOptions) {\n const namespace = output(args).apply(async args => {\n return new core.v1.Namespace(\n name,\n {\n metadata: mapNamespaceMetadata(args, name),\n },\n {\n ...opts,\n parent: this,\n provider: await getProvider(args.cluster),\n },\n )\n })\n\n super(\n \"highstate:k8s:Namespace\",\n name,\n args,\n opts,\n output(args.cluster),\n namespace.metadata,\n namespace.spec,\n namespace.status,\n )\n }\n}\n\nclass NamespacePatch extends Namespace {\n constructor(name: string, args: NamespaceArgs, opts?: ComponentResourceOptions) {\n const namespace = output(args).apply(async args => {\n return new core.v1.NamespacePatch(\n name,\n {\n metadata: mapNamespaceMetadata(args, name),\n },\n {\n ...opts,\n parent: this,\n provider: await getProvider(args.cluster),\n },\n )\n })\n\n super(\n \"highstate:k8s:NamespacePatch\",\n name,\n args,\n opts,\n output(args.cluster),\n namespace.metadata,\n namespace.spec,\n namespace.status,\n )\n }\n}\n\nclass ExternalNamespace extends Namespace {\n constructor(\n name: string,\n id: Input<string>,\n cluster: Input<k8s.Cluster>,\n opts?: ComponentResourceOptions,\n ) {\n const namespace = output(id).apply(async realName => {\n return core.v1.Namespace.get(\n //\n name,\n realName,\n {\n ...opts,\n parent: this,\n provider: await getProvider(cluster),\n },\n )\n })\n\n super(\n \"highstate:k8s:ExternalNamespace\",\n name,\n { id, cluster },\n opts,\n output(cluster),\n namespace.metadata,\n namespace.spec,\n namespace.status,\n )\n }\n}\n","import type { PartialKeys } from \"@highstate/contract\"\nimport type { k8s } from \"@highstate/library\"\nimport { Output, output, toPromise, type Input, type Unwrap } from \"@highstate/pulumi\"\nimport { core, Provider, types } from \"@pulumi/kubernetes\"\nimport { Namespace } from \"./namespace\"\n\nconst providers = new Map<string, Provider>()\n\nexport function getProvider(cluster: Input<k8s.Cluster>): Promise<Provider> {\n const provider = output(cluster).apply(cluster => {\n const existingProvider = providers.get(cluster.id)\n if (existingProvider) {\n return existingProvider\n }\n\n const provider = new Provider(`${cluster.name}-${cluster.id}`, {\n kubeconfig: cluster.kubeconfig,\n })\n providers.set(cluster.id, provider)\n\n return provider\n })\n\n return toPromise(provider)\n}\n\nexport type NamespaceLike = core.v1.Namespace | Namespace | string\n\nexport type CommonArgs = {\n /**\n * The name of the resource.\n */\n name?: Input<string>\n\n /**\n * The namespace to create the resource in.\n */\n namespace: Input<NamespaceLike | undefined>\n\n /**\n * The cluster to create the resource in.\n */\n cluster: Input<k8s.Cluster>\n\n /**\n * The metadata to apply to the resource.\n */\n metadata?: Input<types.input.meta.v1.ObjectMeta>\n}\n\nexport const commonExtraArgs = [\"name\", \"namespace\", \"cluster\", \"metadata\"] as const\n\nexport function mapMetadata(\n args: PartialKeys<Unwrap<CommonArgs>, \"namespace\" | \"cluster\">,\n fallbackName?: string,\n): types.input.meta.v1.ObjectMeta {\n return {\n ...args.metadata,\n name: args.name ?? args.metadata?.name ?? fallbackName,\n namespace: args.namespace ? mapNamespaceLikeToNamespaceName(args.namespace) : undefined,\n }\n}\n\nexport type SelectorLike = types.input.meta.v1.LabelSelector | Record<string, Input<string>>\n\nexport function mapSelectorLikeToSelector(\n selector: SelectorLike,\n): types.input.meta.v1.LabelSelector {\n if (\"matchLabels\" in selector || \"matchExpressions\" in selector) {\n return selector\n }\n\n return {\n matchLabels: selector as Record<string, Input<string>>,\n }\n}\n\nexport function mapNamespaceLikeToNamespaceName(namespace: NamespaceLike): Output<string> {\n if (Namespace.isInstance(namespace)) {\n return namespace.metadata.name\n }\n\n if (core.v1.Namespace.isInstance(namespace)) {\n return namespace.metadata.name\n }\n\n return output(namespace)\n}\n\nexport function mapNamespaceNameToSelector(\n namespace: Input<string>,\n): types.input.meta.v1.LabelSelector {\n return {\n matchLabels: {\n \"kubernetes.io/metadata.name\": namespace,\n },\n }\n}\n\nexport type ResourceId = {\n name: Input<string>\n namespace?: Input<string | undefined>\n}\n\nexport function resourceIdToString(id: Input<ResourceId>): Output<string> {\n return output(id).apply(metadata => {\n return metadata.namespace ? `${metadata.namespace}/${metadata.name}` : metadata.name\n })\n}\n\nexport function getAppName(resourceId: Unwrap<ResourceId>): string {\n if (resourceId.namespace !== resourceId.name) {\n return `${resourceId.namespace ?? \"default\"}-${resourceId.name}`\n }\n\n return resourceId.name\n}\n\nexport function getAppDisplayName(resourceId: Unwrap<ResourceId>): string {\n if (resourceId.namespace !== resourceId.name) {\n return `${resourceId.namespace ?? \"default\"}/${resourceId.name}`\n }\n\n return resourceId.name\n}\n\nexport function withPatchName(\n resourceType: string,\n resource: Input<k8s.Resource>,\n cluster: Input<k8s.Cluster>,\n): Output<string> {\n return output({ resource, cluster }).apply(({ resource, cluster }) => {\n if (resource.clusterId !== cluster.id) {\n throw new Error(\n `Cluster mismatch when patching ${resourceType} \"${resource.metadata.name}\": \"${resource.clusterId}\" != \"${cluster.id}\"`,\n )\n }\n\n return resource.metadata.name\n })\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AACF;AAEA,IAAM,oBAAN,cAAgC,UAAU;AAAA,EACxC,YACE,MACA,IACA,SACA,MACA;AACA,UAAM,YAAYA,QAAO,EAAE,EAAE,MAAM,OAAM,aAAY;AACnD,aAAOE,MAAK,GAAG,UAAU;AAAA;AAAA,QAEvB;AAAA,QACA;AAAA,QACA;AAAA,UACE,GAAG;AAAA,UACH,QAAQ;AAAA,UACR,UAAU,MAAM,YAAY,OAAO;AAAA,QACrC;AAAA,MACF;AAAA,IACF,CAAC;AAED;AAAA,MACE;AAAA,MACA;AAAA,MACA,EAAE,IAAI,QAAQ;AAAA,MACd;AAAA,MACAF,QAAO,OAAO;AAAA,MACd,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,IACZ;AAAA,EACF;AACF;","names":["core","output","cluster","provider","resource","output","args","core"]}
|
@@ -3,7 +3,7 @@ import {
|
|
3
3
|
getProvider,
|
4
4
|
mapMetadata,
|
5
5
|
resourceIdToString
|
6
|
-
} from "./chunk-
|
6
|
+
} from "./chunk-HTQP2NB4.js";
|
7
7
|
|
8
8
|
// src/service.ts
|
9
9
|
import { core } from "@pulumi/kubernetes";
|
@@ -95,14 +95,14 @@ var Service = class extends ComponentResource {
|
|
95
95
|
*/
|
96
96
|
get endpoints() {
|
97
97
|
return output({
|
98
|
-
|
98
|
+
cluster: this.cluster,
|
99
99
|
metadata: this.metadata,
|
100
100
|
spec: this.spec,
|
101
101
|
status: this.status
|
102
|
-
}).apply(({
|
102
|
+
}).apply(({ cluster, metadata, spec, status }) => {
|
103
103
|
const endpointMetadata = {
|
104
104
|
k8sService: {
|
105
|
-
clusterId,
|
105
|
+
clusterId: cluster.id,
|
106
106
|
name: metadata.name,
|
107
107
|
namespace: metadata.namespace,
|
108
108
|
selector: spec.selector,
|
@@ -125,8 +125,8 @@ var Service = class extends ComponentResource {
|
|
125
125
|
metadata: endpointMetadata
|
126
126
|
});
|
127
127
|
}
|
128
|
-
const nodePortEndpoints = spec.type === "NodePort" ?
|
129
|
-
...
|
128
|
+
const nodePortEndpoints = spec.type === "NodePort" ? cluster.endpoints.map((endpoint) => ({
|
129
|
+
...endpoint,
|
130
130
|
port: spec.ports[0].nodePort,
|
131
131
|
protocol: spec.ports[0].protocol?.toLowerCase(),
|
132
132
|
metadata: endpointMetadata
|
@@ -344,4 +344,4 @@ export {
|
|
344
344
|
getServiceType,
|
345
345
|
HttpRoute
|
346
346
|
};
|
347
|
-
//# sourceMappingURL=chunk-
|
347
|
+
//# sourceMappingURL=chunk-J6O3TE56.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/service.ts","../src/gateway/http-route.ts","../src/gateway/backend.ts"],"sourcesContent":["import type { k8s, network } from \"@highstate/library\"\nimport { core, types } from \"@pulumi/kubernetes\"\nimport {\n ComponentResource,\n normalize,\n output,\n Output,\n type ComponentResourceOptions,\n type Input,\n type Inputs,\n} from \"@highstate/pulumi\"\nimport { omit, uniqueBy } from \"remeda\"\nimport { deepmerge } from \"deepmerge-ts\"\nimport { filterEndpoints, l4EndpointToString, parseL3Endpoint } from \"@highstate/common\"\nimport {\n commonExtraArgs,\n mapMetadata,\n resourceIdToString,\n type CommonArgs,\n type ResourceId,\n type SelectorLike,\n} from \"./shared\"\n\nexport type ServiceArgs = CommonArgs & {\n /**\n * The port to expose the service on.\n */\n port?: Input<types.input.core.v1.ServicePort>\n\n /**\n * Whether the service should be exposed by `NodePort` or `LoadBalancer`.\n *\n * The type of the service will be determined automatically based on the cluster.\n */\n external?: boolean\n} & types.input.core.v1.ServiceSpec\n\nconst serviceExtraArgs = [...commonExtraArgs, \"port\", \"ports\", \"external\"] as const\n\nexport type ServiceEndpointMetadata = {\n clusterId: string\n name: string\n namespace: string\n selector: SelectorLike\n targetPort: string | number\n}\n\n/**\n * Checks if the endpoint has service metadata.\n *\n * Alters the type of the endpoint to include the service metadata if it exists.\n *\n * @param endpoint The endpoint to check.\n * @returns True if the endpoint has service metadata, false otherwise.\n */\nexport function hasServiceMetadata(\n endpoint: network.L3Endpoint,\n): endpoint is network.L3Endpoint & { metadata: { k8sService: ServiceEndpointMetadata } } {\n return endpoint.metadata?.k8sService !== undefined\n}\n\n/**\n * Returns the service metadata of the endpoint.\n *\n * @param endpoint The endpoint to get the service metadata from.\n * @returns The service metadata of the endpoint, or undefined if it doesn't exist.\n */\nexport function getServiceMetadata(\n endpoint: network.L3Endpoint,\n): ServiceEndpointMetadata | undefined {\n return endpoint.metadata?.k8sService as ServiceEndpointMetadata\n}\n\n/**\n * Adds service metadata to the endpoint.\n *\n * @param endpoint The endpoint to add the metadata to.\n * @param metadata The metadata to add.\n * @returns The endpoint with the added metadata.\n */\nexport function withServiceMetadata<TEdnpoint extends network.L34Endpoint>(\n endpoint: TEdnpoint,\n metadata: ServiceEndpointMetadata,\n): TEdnpoint & { metadata: { k8sService: ServiceEndpointMetadata } } {\n return {\n ...endpoint,\n metadata: {\n ...endpoint.metadata,\n k8sService: metadata,\n },\n }\n}\n\n/**\n * Checks if the endpoint is from the given cluster.\n *\n * @param endpoint The endpoint to check.\n * @param cluster The cluster to check against.\n * @returns True if the endpoint is from the cluster, false otherwise.\n */\nexport function isFromCluster(\n endpoint: network.L3Endpoint,\n cluster: k8s.Cluster,\n): endpoint is network.L3Endpoint & { metadata: { k8sService: ServiceEndpointMetadata } } {\n return getServiceMetadata(endpoint)?.clusterId === cluster.id\n}\n\nexport abstract class Service extends ComponentResource {\n protected constructor(\n type: string,\n name: string,\n args: Inputs,\n opts: ComponentResourceOptions,\n\n /**\n * The cluster info associated with the service.\n */\n readonly cluster: Output<k8s.Cluster>,\n\n /**\n * The metadata of the underlying Kubernetes service.\n */\n readonly metadata: Output<types.output.meta.v1.ObjectMeta>,\n\n /**\n * The spec of the underlying Kubernetes service.\n */\n readonly spec: Output<types.output.core.v1.ServiceSpec>,\n\n /**\n * The status of the underlying Kubernetes service.\n */\n readonly status: Output<types.output.core.v1.ServiceStatus>,\n ) {\n super(type, name, args, opts)\n }\n\n /**\n * The Highstate service entity.\n */\n get entity(): Output<k8s.Service> {\n return output({\n type: \"k8s.service\",\n clusterId: this.cluster.id,\n metadata: this.metadata,\n endpoints: this.endpoints,\n })\n }\n\n static create(name: string, args: ServiceArgs, opts: ComponentResourceOptions): Service {\n return new CreatedService(name, args, opts)\n }\n\n static wrap(\n name: string,\n service: Input<core.v1.Service>,\n cluster: Input<k8s.Cluster>,\n opts: ComponentResourceOptions,\n ): Service {\n return new WrappedService(name, service, cluster, opts)\n }\n\n static external(\n name: string,\n id: ResourceId,\n cluster: Input<k8s.Cluster>,\n opts: ComponentResourceOptions,\n ): Service {\n return new ExternalService(name, id, cluster, opts)\n }\n\n static of(\n name: string,\n entity: Input<k8s.Service>,\n cluster: Input<k8s.Cluster>,\n opts: ComponentResourceOptions,\n ): Service {\n return new ExternalService(\n name,\n output(entity).metadata,\n output({ cluster, entity }).apply(({ cluster, entity }) => {\n if (cluster.id !== entity.clusterId) {\n throw new Error(\n `Cluster mismatch when wrapping service \"${name}\": \"${cluster.id}\" != \"${entity.clusterId}\"`,\n )\n }\n\n return cluster\n }),\n opts,\n )\n }\n\n /**\n * Returns the endpoints of the service applying the given filter.\n *\n * If no filter is specified, the default behavior of `filterEndpoints` is used.\n *\n * @param filter If specified, the endpoints are filtered based on the given filter.\n * @returns The endpoints of the service.\n */\n filterEndpoints(filter?: network.EndpointFilter): Output<network.L4Endpoint[]> {\n return output({ endpoints: this.endpoints }).apply(({ endpoints }) => {\n return filterEndpoints(endpoints, filter)\n })\n }\n\n /**\n * Returns the endpoints of the service including both internal and external endpoints.\n */\n get endpoints(): Output<network.L4Endpoint[]> {\n return output({\n cluster: this.cluster,\n metadata: this.metadata,\n spec: this.spec,\n status: this.status,\n }).apply(({ cluster, metadata, spec, status }) => {\n const endpointMetadata = {\n k8sService: {\n clusterId: cluster.id,\n name: metadata.name,\n namespace: metadata.namespace,\n selector: spec.selector,\n targetPort: spec.ports[0].targetPort ?? spec.ports[0].port,\n } satisfies ServiceEndpointMetadata,\n }\n\n const clusterIpEndpoints = spec.clusterIPs?.map(ip => ({\n ...parseL3Endpoint(ip),\n port: spec.ports[0].port,\n protocol: spec.ports[0].protocol?.toLowerCase() as network.L4Protocol,\n metadata: endpointMetadata,\n }))\n\n if (clusterIpEndpoints.length > 0) {\n clusterIpEndpoints.unshift({\n type: \"hostname\",\n visibility: \"internal\",\n hostname: `${metadata.name}.${metadata.namespace}.svc.cluster.local`,\n port: spec.ports[0].port,\n protocol: spec.ports[0].protocol?.toLowerCase() as network.L4Protocol,\n metadata: endpointMetadata,\n })\n }\n\n const nodePortEndpoints =\n spec.type === \"NodePort\"\n ? cluster.endpoints.map(endpoint => ({\n ...(endpoint as network.L3Endpoint),\n port: spec.ports[0].nodePort,\n protocol: spec.ports[0].protocol?.toLowerCase() as network.L4Protocol,\n metadata: endpointMetadata,\n }))\n : []\n\n const loadBalancerEndpoints =\n spec.type === \"LoadBalancer\"\n ? status.loadBalancer?.ingress?.map(endpoint => ({\n ...parseL3Endpoint(endpoint.ip ?? endpoint.hostname),\n port: spec.ports[0].port,\n protocol: spec.ports[0].protocol?.toLowerCase() as network.L4Protocol,\n metadata: endpointMetadata,\n }))\n : []\n\n return uniqueBy(\n [\n ...(clusterIpEndpoints ?? []),\n ...(loadBalancerEndpoints ?? []),\n ...(nodePortEndpoints ?? []),\n ],\n endpoint => l4EndpointToString(endpoint),\n )\n })\n }\n}\n\nclass CreatedService extends Service {\n constructor(name: string, args: ServiceArgs, opts: ComponentResourceOptions) {\n const service = output(args).apply(args => {\n return new core.v1.Service(\n name,\n {\n metadata: mapMetadata(args, name),\n spec: deepmerge(\n {\n ports: normalize(args.port, args.ports),\n\n externalIPs: args.external\n ? (args.externalIPs ?? args.cluster.externalIps)\n : args.cluster.externalIps,\n\n type: getServiceType(args, args.cluster),\n },\n omit(args, serviceExtraArgs),\n ),\n },\n { parent: this, ...opts },\n )\n })\n\n super(\n \"highstate:k8s:Service\",\n name,\n args,\n opts,\n\n output(args.cluster),\n service.metadata,\n service.spec,\n service.status,\n )\n }\n}\n\nclass WrappedService extends Service {\n constructor(\n name: string,\n service: Input<core.v1.Service>,\n cluster: Input<k8s.Cluster>,\n opts: ComponentResourceOptions,\n ) {\n super(\n \"highstate:k8s:WrappedService\",\n name,\n { service, clusterInfo: cluster },\n opts,\n\n output(cluster),\n output(service).metadata,\n output(service).spec,\n output(service).status,\n )\n }\n}\n\nclass ExternalService extends Service {\n constructor(\n name: string,\n id: Input<ResourceId>,\n cluster: Input<k8s.Cluster>,\n opts: ComponentResourceOptions,\n ) {\n const service = output(id).apply(id => {\n return core.v1.Service.get(\n //\n name,\n resourceIdToString(id),\n { ...opts, parent: this },\n )\n })\n\n super(\n \"highstate:k8s:ExternalService\",\n name,\n { id, cluster },\n opts,\n\n output(cluster),\n service.metadata,\n service.spec,\n service.status,\n )\n }\n}\n\nexport function mapContainerPortToServicePort(\n port: types.input.core.v1.ContainerPort,\n): types.input.core.v1.ServicePort {\n return {\n name: port.name,\n port: port.containerPort,\n targetPort: port.containerPort,\n protocol: port.protocol,\n }\n}\n\nexport function mapServiceToLabelSelector(\n service: core.v1.Service,\n): types.input.meta.v1.LabelSelector {\n return {\n matchLabels: service.spec.selector,\n }\n}\n\nexport function getServiceType(\n service: Pick<ServiceArgs, \"type\" | \"external\"> | undefined,\n cluster: k8s.Cluster,\n): Input<string> {\n if (service?.type) {\n return service.type\n }\n\n if (!service?.external) {\n return \"ClusterIP\"\n }\n\n return cluster.quirks?.externalServiceType === \"LoadBalancer\" ? \"LoadBalancer\" : \"NodePort\"\n}\n","import {\n ComponentResource,\n normalize,\n output,\n Output,\n type ComponentResourceOptions,\n type Input,\n type InputArray,\n} from \"@highstate/pulumi\"\nimport { gateway, types } from \"@highstate/gateway-api\"\nimport { map, pipe } from \"remeda\"\nimport { getProvider, mapMetadata, type CommonArgs } from \"../shared\"\nimport { resolveBackendRef, type BackendRef } from \"./backend\"\n\nexport type HttpRouteArgs = Omit<CommonArgs, \"namespace\"> & {\n /**\n * The gateway to associate with the route.\n */\n gateway: Input<gateway.v1.Gateway>\n\n /**\n * The alias for `hostnames: [hostname]`.\n */\n hostname?: Input<string>\n\n /**\n * The rule of the route.\n */\n rule?: Input<HttpRouteRuleArgs>\n\n /**\n * The rules of the route.\n */\n rules?: InputArray<HttpRouteRuleArgs>\n} & Omit<Partial<types.input.gateway.v1.HTTPRouteSpec>, \"rules\">\n\nexport type HttpRouteRuleArgs = Omit<\n types.input.gateway.v1.HTTPRouteSpecRules,\n \"matches\" | \"filters\" | \"backendRefs\"\n> & {\n /**\n * The conditions of the rule.\n * Can be specified as string to match on the path.\n */\n matches?: InputArray<HttpRouteRuleMatchOptions>\n\n /**\n * The condition of the rule.\n * Can be specified as string to match on the path.\n */\n match?: Input<HttpRouteRuleMatchOptions>\n\n /**\n * The filters of the rule.\n */\n filters?: InputArray<types.input.gateway.v1.HTTPRouteSpecRulesFilters>\n\n /**\n * The filter of the rule.\n */\n filter?: Input<types.input.gateway.v1.HTTPRouteSpecRulesFilters>\n\n /**\n * The service to route to.\n */\n backend?: Input<BackendRef>\n}\n\nexport type HttpRouteRuleMatchOptions = types.input.gateway.v1.HTTPRouteSpecRulesMatches | string\n\nexport class HttpRoute extends ComponentResource {\n /**\n * The underlying Kubernetes resource.\n */\n public readonly route: Output<gateway.v1.HTTPRoute>\n\n constructor(name: string, args: HttpRouteArgs, opts?: ComponentResourceOptions) {\n super(\"highstate:k8s:HttpRoute\", name, args, opts)\n\n this.route = output({\n args,\n gatewayNamespace: output(args.gateway).metadata.namespace,\n }).apply(async ({ args, gatewayNamespace }) => {\n return new gateway.v1.HTTPRoute(\n name,\n {\n metadata: mapMetadata(\n {\n ...args,\n namespace: gatewayNamespace as string,\n },\n name,\n ),\n spec: {\n hostnames: normalize(args.hostname, args.hostnames),\n\n parentRefs: [\n {\n name: args.gateway.metadata.name as Output<string>,\n },\n ],\n\n rules: normalize(args.rule, args.rules).map(rule => ({\n timeouts: rule.timeouts,\n\n matches: pipe(\n normalize(rule.match, rule.matches),\n map(mapHttpRouteRuleMatch),\n addDefaultPathMatch,\n ),\n\n filters: normalize(rule.filter, rule.filters),\n backendRefs: rule.backend ? [resolveBackendRef(rule.backend)] : undefined,\n })),\n } satisfies types.input.gateway.v1.HTTPRouteSpec,\n },\n {\n ...opts,\n parent: this,\n provider: await getProvider(args.cluster),\n },\n )\n })\n }\n}\n\nfunction addDefaultPathMatch(\n matches: types.input.gateway.v1.HTTPRouteSpecRulesMatches[],\n): types.input.gateway.v1.HTTPRouteSpecRulesMatches[] {\n return matches.length ? matches : [{ path: { type: \"PathPrefix\", value: \"/\" } }]\n}\n\nexport function mapHttpRouteRuleMatch(\n match: HttpRouteRuleMatchOptions,\n): types.input.gateway.v1.HTTPRouteSpecRulesMatches {\n if (typeof match === \"string\") {\n return { path: { type: \"PathPrefix\", value: match } }\n }\n\n return match\n}\n","import { core } from \"@pulumi/kubernetes\"\nimport { type Input, output, Output, type Unwrap } from \"@highstate/pulumi\"\nimport { Service } from \"../service\"\n\nexport interface FullBackendRef {\n /**\n * The name of the resource being referenced.\n */\n name: Input<string>\n\n /**\n * The namespace of the resource being referenced.\n * May be undefined if the resource is not in a namespace.\n */\n namespace?: Input<string | undefined>\n\n /**\n * The port of the resource being referenced.\n */\n port: Input<number>\n}\n\nexport interface ServiceBackendRef {\n /**\n * The name of the service being referenced.\n */\n service: Input<core.v1.Service>\n\n /**\n * The port of the service being referenced.\n */\n port: Input<number>\n}\n\nexport type BackendRef = FullBackendRef | ServiceBackendRef | Service\n\nexport function resolveBackendRef(ref: BackendRef): Output<Unwrap<FullBackendRef>> {\n if (Service.isInstance(ref)) {\n return output({\n name: ref.metadata.name,\n namespace: ref.metadata.namespace,\n port: ref.spec.ports[0].port,\n })\n }\n\n if (\"service\" in ref) {\n const service = output(ref.service)\n\n return output({\n name: service.metadata.name,\n namespace: service.metadata.namespace,\n port: ref.port,\n })\n }\n\n return output({\n name: ref.name,\n namespace: ref.namespace,\n port: ref.port,\n })\n}\n"],"mappings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7B,WAAO,EAAE,MAAM,EAAE,MAAM,cAAc,OAAO,MAAM,EAAE;AAAA,EACtD;AAEA,SAAO;AACT;","names":["cluster","entity","args","id","ComponentResource","normalize","output","output","output","ComponentResource","output","args","normalize"]}
|
@@ -2,11 +2,11 @@ import {
|
|
2
2
|
HttpRoute,
|
3
3
|
Service,
|
4
4
|
getServiceType
|
5
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-J6O3TE56.js";
|
6
6
|
import {
|
7
7
|
getProvider,
|
8
8
|
mapNamespaceLikeToNamespaceName
|
9
|
-
} from "./chunk-
|
9
|
+
} from "./chunk-HTQP2NB4.js";
|
10
10
|
|
11
11
|
// src/helm.ts
|
12
12
|
import { resolve } from "node:path";
|
@@ -211,4 +211,4 @@ export {
|
|
211
211
|
getChartServiceOutput,
|
212
212
|
getChartService
|
213
213
|
};
|
214
|
-
//# sourceMappingURL=chunk-
|
214
|
+
//# sourceMappingURL=chunk-JBGQQVTZ.js.map
|
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
isFromCluster,
|
6
6
|
mapContainerPortToServicePort,
|
7
7
|
mapServiceToLabelSelector
|
8
|
-
} from "./chunk-
|
8
|
+
} from "./chunk-J6O3TE56.js";
|
9
9
|
import {
|
10
10
|
commonExtraArgs,
|
11
11
|
getProvider,
|
@@ -15,7 +15,7 @@ import {
|
|
15
15
|
mapSelectorLikeToSelector,
|
16
16
|
resourceIdToString,
|
17
17
|
withPatchName
|
18
|
-
} from "./chunk-
|
18
|
+
} from "./chunk-HTQP2NB4.js";
|
19
19
|
|
20
20
|
// src/pvc.ts
|
21
21
|
import { core } from "@pulumi/kubernetes";
|
@@ -1074,7 +1074,7 @@ var ExposableWorkload = class extends Workload {
|
|
1074
1074
|
static createOrPatchGeneric(name, args, opts) {
|
1075
1075
|
return output5(args).apply(async (args2) => {
|
1076
1076
|
if (args2.existing?.type === "k8s.deployment") {
|
1077
|
-
const { Deployment } = await import("./deployment-
|
1077
|
+
const { Deployment } = await import("./deployment-TFCMSEGW.js");
|
1078
1078
|
return Deployment.patch(
|
1079
1079
|
name,
|
1080
1080
|
{
|
@@ -1086,7 +1086,7 @@ var ExposableWorkload = class extends Workload {
|
|
1086
1086
|
);
|
1087
1087
|
}
|
1088
1088
|
if (args2.existing?.type === "k8s.stateful-set") {
|
1089
|
-
const { StatefulSet } = await import("./stateful-set-
|
1089
|
+
const { StatefulSet } = await import("./stateful-set-2OEPSK44.js");
|
1090
1090
|
return StatefulSet.patch(
|
1091
1091
|
name,
|
1092
1092
|
{
|
@@ -1098,11 +1098,11 @@ var ExposableWorkload = class extends Workload {
|
|
1098
1098
|
);
|
1099
1099
|
}
|
1100
1100
|
if (args2.type === "Deployment") {
|
1101
|
-
const { Deployment } = await import("./deployment-
|
1101
|
+
const { Deployment } = await import("./deployment-TFCMSEGW.js");
|
1102
1102
|
return Deployment.create(name, deepmerge2(args2, args2.deployment), opts);
|
1103
1103
|
}
|
1104
1104
|
if (args2.type === "StatefulSet") {
|
1105
|
-
const { StatefulSet } = await import("./stateful-set-
|
1105
|
+
const { StatefulSet } = await import("./stateful-set-2OEPSK44.js");
|
1106
1106
|
return StatefulSet.create(name, deepmerge2(args2, args2.statefulSet), opts);
|
1107
1107
|
}
|
1108
1108
|
throw new Error(`Unknown workload type: ${args2.type}`);
|
@@ -1120,4 +1120,4 @@ export {
|
|
1120
1120
|
Workload,
|
1121
1121
|
ExposableWorkload
|
1122
1122
|
};
|
1123
|
-
//# sourceMappingURL=chunk-
|
1123
|
+
//# sourceMappingURL=chunk-UNVUOHHB.js.map
|
@@ -2,13 +2,13 @@ import {
|
|
2
2
|
ExposableWorkload,
|
3
3
|
exposableWorkloadExtraArgs,
|
4
4
|
getExposableWorkloadComponents
|
5
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-UNVUOHHB.js";
|
6
6
|
import {
|
7
7
|
getProvider,
|
8
8
|
mapMetadata,
|
9
9
|
resourceIdToString,
|
10
10
|
withPatchName
|
11
|
-
} from "./chunk-
|
11
|
+
} from "./chunk-HTQP2NB4.js";
|
12
12
|
|
13
13
|
// src/deployment.ts
|
14
14
|
import { output } from "@highstate/pulumi";
|
@@ -180,4 +180,4 @@ var ExternalDeployment = class extends Deployment {
|
|
180
180
|
export {
|
181
181
|
Deployment
|
182
182
|
};
|
183
|
-
//# sourceMappingURL=chunk-
|
183
|
+
//# sourceMappingURL=chunk-YEH2UAPS.js.map
|
@@ -2,13 +2,13 @@ import {
|
|
2
2
|
ExposableWorkload,
|
3
3
|
exposableWorkloadExtraArgs,
|
4
4
|
getExposableWorkloadComponents
|
5
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-UNVUOHHB.js";
|
6
6
|
import {
|
7
7
|
getProvider,
|
8
8
|
mapMetadata,
|
9
9
|
resourceIdToString,
|
10
10
|
withPatchName
|
11
|
-
} from "./chunk-
|
11
|
+
} from "./chunk-HTQP2NB4.js";
|
12
12
|
|
13
13
|
// src/stateful-set.ts
|
14
14
|
import { output } from "@highstate/pulumi";
|
@@ -190,4 +190,4 @@ var ExternalStatefulSet = class extends StatefulSet {
|
|
190
190
|
export {
|
191
191
|
StatefulSet
|
192
192
|
};
|
193
|
-
//# sourceMappingURL=chunk-
|
193
|
+
//# sourceMappingURL=chunk-YTCZBMAL.js.map
|
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"sourceHashes": {
|
3
|
-
"./dist/index.js": "
|
3
|
+
"./dist/index.js": "676d803c94bf09ba36d1fcb8cfebd4ff76e92d8ec3ca225afeb95cee648632ce",
|
4
4
|
"./dist/units/access-point/index.js": "6aca16c67e51282ea15891fa4ec5e53aea1c128623ad3c13ca0e298a7a2ca4f5",
|
5
|
-
"./dist/units/cert-manager/index.js": "
|
5
|
+
"./dist/units/cert-manager/index.js": "785d4fa43428f6006f2ca5bead113ab567c5505b5c8e0fc744ddf6b4672a978d",
|
6
6
|
"./dist/units/cluster-patch/index.js": "4f56d6e882afcef37507aa56bdf501c2fccd0138b8f80ebe96d68a8a31cd59f8",
|
7
7
|
"./dist/units/cluster-dns/index.js": "63123d3024350dfa390a2ba7e496e5a88acb1ff02a4dba9b15d5358b1ee74a44",
|
8
|
-
"./dist/units/dns01-issuer/index.js": "
|
8
|
+
"./dist/units/dns01-issuer/index.js": "6154d4687a9328250f54407b8a0575092e210f7ae136dbff23f7d09c5472dc1f",
|
9
9
|
"./dist/units/existing-cluster/index.js": "a4e26cd710b4a3c992b064c31580ce294e58feda74f150dcd27662f3fe737f77",
|
10
|
-
"./dist/units/gateway-api/index.js": "
|
10
|
+
"./dist/units/gateway-api/index.js": "2d4999e9a7d5a091e3d46fbc0318b9d6e1348aa8b7fb0648daec6c5f804a995b"
|
11
11
|
}
|
12
12
|
}
|
package/dist/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import {
|
2
2
|
StatefulSet
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-YTCZBMAL.js";
|
4
4
|
import {
|
5
5
|
Deployment
|
6
|
-
} from "./chunk-
|
6
|
+
} from "./chunk-YEH2UAPS.js";
|
7
7
|
import {
|
8
8
|
ExposableWorkload,
|
9
9
|
NetworkPolicy,
|
@@ -11,14 +11,14 @@ import {
|
|
11
11
|
Secret,
|
12
12
|
Workload,
|
13
13
|
getWorkloadComponents
|
14
|
-
} from "./chunk-
|
14
|
+
} from "./chunk-UNVUOHHB.js";
|
15
15
|
import {
|
16
16
|
Chart,
|
17
17
|
RenderedChart,
|
18
18
|
getChartService,
|
19
19
|
getChartServiceOutput,
|
20
20
|
resolveHelmChart
|
21
|
-
} from "./chunk-
|
21
|
+
} from "./chunk-JBGQQVTZ.js";
|
22
22
|
import {
|
23
23
|
HttpRoute,
|
24
24
|
Service,
|
@@ -28,7 +28,7 @@ import {
|
|
28
28
|
mapContainerPortToServicePort,
|
29
29
|
mapServiceToLabelSelector,
|
30
30
|
withServiceMetadata
|
31
|
-
} from "./chunk-
|
31
|
+
} from "./chunk-J6O3TE56.js";
|
32
32
|
import {
|
33
33
|
createK8sTerminal,
|
34
34
|
detectExternalIps
|
@@ -43,7 +43,7 @@ import {
|
|
43
43
|
mapNamespaceLikeToNamespaceName,
|
44
44
|
mapNamespaceNameToSelector,
|
45
45
|
mapSelectorLikeToSelector
|
46
|
-
} from "./chunk-
|
46
|
+
} from "./chunk-HTQP2NB4.js";
|
47
47
|
|
48
48
|
// src/access-point.ts
|
49
49
|
import { DnsRecordSet, filterEndpoints, l3EndpointToString } from "@highstate/common";
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import {
|
2
2
|
Chart
|
3
|
-
} from "../../chunk-
|
4
|
-
import "../../chunk-
|
3
|
+
} from "../../chunk-JBGQQVTZ.js";
|
4
|
+
import "../../chunk-J6O3TE56.js";
|
5
5
|
import {
|
6
6
|
Namespace
|
7
|
-
} from "../../chunk-
|
7
|
+
} from "../../chunk-HTQP2NB4.js";
|
8
8
|
|
9
9
|
// src/units/cert-manager/index.ts
|
10
10
|
import { k8s } from "@highstate/library";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@highstate/k8s",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.8",
|
4
4
|
"type": "module",
|
5
5
|
"files": [
|
6
6
|
"dist",
|
@@ -28,12 +28,12 @@
|
|
28
28
|
"generate-crds": "./scripts/generate-crds.sh"
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@highstate/cert-manager": "^0.9.
|
32
|
-
"@highstate/common": "^0.9.
|
33
|
-
"@highstate/contract": "^0.9.
|
34
|
-
"@highstate/gateway-api": "^0.9.
|
35
|
-
"@highstate/library": "^0.9.
|
36
|
-
"@highstate/pulumi": "^0.9.
|
31
|
+
"@highstate/cert-manager": "^0.9.8",
|
32
|
+
"@highstate/common": "^0.9.8",
|
33
|
+
"@highstate/contract": "^0.9.8",
|
34
|
+
"@highstate/gateway-api": "^0.9.8",
|
35
|
+
"@highstate/library": "^0.9.8",
|
36
|
+
"@highstate/pulumi": "^0.9.8",
|
37
37
|
"@kubernetes/client-node": "^1.1.0",
|
38
38
|
"@pulumi/command": "^1.0.2",
|
39
39
|
"@pulumi/kubernetes": "^4.18.0",
|
@@ -46,7 +46,7 @@
|
|
46
46
|
"remeda": "^2.21.0"
|
47
47
|
},
|
48
48
|
"devDependencies": {
|
49
|
-
"@highstate/cli": "^0.9.
|
49
|
+
"@highstate/cli": "^0.9.8"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "036db4d9937ff30edf15f143482c5702e5b7a7fb"
|
52
52
|
}
|
package/src/namespace.ts
CHANGED
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
type ComponentResourceOptions,
|
8
8
|
type Input,
|
9
9
|
type Inputs,
|
10
|
+
type Unwrap,
|
10
11
|
} from "@pulumi/pulumi"
|
11
12
|
import { getProvider, mapMetadata, type CommonArgs } from "./shared"
|
12
13
|
|
@@ -149,13 +150,26 @@ export abstract class Namespace extends ComponentResource {
|
|
149
150
|
}
|
150
151
|
}
|
151
152
|
|
153
|
+
function mapNamespaceMetadata(
|
154
|
+
args: Unwrap<NamespaceArgs>,
|
155
|
+
name: string,
|
156
|
+
): types.input.meta.v1.ObjectMeta {
|
157
|
+
const labels: Record<string, string> = args.metadata?.labels ?? {}
|
158
|
+
|
159
|
+
if (args.privileged) {
|
160
|
+
labels["pod-security.kubernetes.io/enforce"] = "privileged"
|
161
|
+
}
|
162
|
+
|
163
|
+
return { ...mapMetadata(args, name), labels }
|
164
|
+
}
|
165
|
+
|
152
166
|
class CreatedNamespace extends Namespace {
|
153
167
|
constructor(name: string, args: NamespaceArgs, opts?: ComponentResourceOptions) {
|
154
168
|
const namespace = output(args).apply(async args => {
|
155
169
|
return new core.v1.Namespace(
|
156
170
|
name,
|
157
171
|
{
|
158
|
-
metadata:
|
172
|
+
metadata: mapNamespaceMetadata(args, name),
|
159
173
|
},
|
160
174
|
{
|
161
175
|
...opts,
|
@@ -184,7 +198,7 @@ class NamespacePatch extends Namespace {
|
|
184
198
|
return new core.v1.NamespacePatch(
|
185
199
|
name,
|
186
200
|
{
|
187
|
-
metadata:
|
201
|
+
metadata: mapNamespaceMetadata(args, name),
|
188
202
|
},
|
189
203
|
{
|
190
204
|
...opts,
|
package/src/service.ts
CHANGED
@@ -210,19 +210,19 @@ export abstract class Service extends ComponentResource {
|
|
210
210
|
*/
|
211
211
|
get endpoints(): Output<network.L4Endpoint[]> {
|
212
212
|
return output({
|
213
|
-
|
213
|
+
cluster: this.cluster,
|
214
214
|
metadata: this.metadata,
|
215
215
|
spec: this.spec,
|
216
216
|
status: this.status,
|
217
|
-
}).apply(({
|
217
|
+
}).apply(({ cluster, metadata, spec, status }) => {
|
218
218
|
const endpointMetadata = {
|
219
219
|
k8sService: {
|
220
|
-
clusterId,
|
220
|
+
clusterId: cluster.id,
|
221
221
|
name: metadata.name,
|
222
222
|
namespace: metadata.namespace,
|
223
223
|
selector: spec.selector,
|
224
224
|
targetPort: spec.ports[0].targetPort ?? spec.ports[0].port,
|
225
|
-
},
|
225
|
+
} satisfies ServiceEndpointMetadata,
|
226
226
|
}
|
227
227
|
|
228
228
|
const clusterIpEndpoints = spec.clusterIPs?.map(ip => ({
|
@@ -245,8 +245,8 @@ export abstract class Service extends ComponentResource {
|
|
245
245
|
|
246
246
|
const nodePortEndpoints =
|
247
247
|
spec.type === "NodePort"
|
248
|
-
?
|
249
|
-
...
|
248
|
+
? cluster.endpoints.map(endpoint => ({
|
249
|
+
...(endpoint as network.L3Endpoint),
|
250
250
|
port: spec.ports[0].nodePort,
|
251
251
|
protocol: spec.ports[0].protocol?.toLowerCase() as network.L4Protocol,
|
252
252
|
metadata: endpointMetadata,
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/namespace.ts","../src/shared.ts"],"sourcesContent":["import type { k8s } from \"@highstate/library\"\nimport { core, type types } from \"@pulumi/kubernetes\"\nimport {\n ComponentResource,\n output,\n Output,\n type ComponentResourceOptions,\n type Input,\n type Inputs,\n} from \"@pulumi/pulumi\"\nimport { getProvider, mapMetadata, type CommonArgs } from \"./shared\"\n\nexport type NamespaceArgs = Omit<CommonArgs, \"namespace\"> & {\n /**\n * Whether to apply \"pod-security.kubernetes.io/enforce=privileged\" label to the namespace.\n */\n privileged?: boolean\n}\n\nexport type CreateOrPatchNamespaceArgs = NamespaceArgs & {\n /**\n * The resource to use to determine the name of the namespace.\n *\n * If not provided, the namespace will be created, otherwise it will be retrieved/patched.\n */\n resource: Input<k8s.Resource> | undefined\n}\n\nexport abstract class Namespace extends ComponentResource {\n protected constructor(\n type: string,\n name: string,\n args: Inputs,\n opts: ComponentResourceOptions | undefined,\n\n /**\n * The cluster where the namespace is created.\n */\n readonly cluster: Output<k8s.Cluster>,\n\n /*\n * The metadata of the underlying Kubernetes namespace.\n */\n readonly metadata: Output<types.output.meta.v1.ObjectMeta>,\n\n /**\n * The spec of the underlying Kubernetes namespace.\n */\n readonly spec: Output<types.output.core.v1.NamespaceSpec>,\n\n /**\n * The status of the underlying Kubernetes namespace.\n */\n readonly status: Output<types.output.core.v1.NamespaceStatus>,\n ) {\n super(type, name, args, opts)\n }\n\n /**\n * Creates a new namespace.\n */\n static create(name: string, args: NamespaceArgs, opts?: ComponentResourceOptions): Namespace {\n return new CreatedNamespace(name, args, opts)\n }\n\n /**\n * Creates a new namespace or patches an existing one.\n *\n * Will throw an error if the namespace does not exist when `args.resource` is provided.\n */\n static createOrPatch(\n name: string,\n args: CreateOrPatchNamespaceArgs,\n opts?: ComponentResourceOptions,\n ): Namespace {\n if (!args.resource) {\n return new CreatedNamespace(name, args, opts)\n }\n\n return new NamespacePatch(\n name,\n {\n ...args,\n name: output(args).apply(args => {\n if (args.resource!.clusterId !== args.cluster.id) {\n throw new Error(\n `Cluster mismatch when patching namespace \"${name}\": \"${args.resource!.clusterId}\" != \"${args.cluster.id}\"`,\n )\n }\n\n return args.resource!.metadata.namespace\n }),\n },\n opts,\n )\n }\n\n /**\n * Creates a new namespace or gets an existing one.\n *\n * Will throw an error if the namespace does not exist when `args.resource` is provided.\n */\n static createOrGet(\n name: string,\n args: CreateOrPatchNamespaceArgs,\n opts?: ComponentResourceOptions,\n ): Namespace {\n if (!args.resource) {\n return new CreatedNamespace(name, args, opts)\n }\n\n return new ExternalNamespace(\n name,\n output(args).apply(args => {\n if (args.resource!.clusterId !== args.cluster.id) {\n throw new Error(\n `Cluster mismatch when receiving namespace \"${name}\": \"${args.resource!.clusterId}\" != \"${args.cluster.id}\"`,\n )\n }\n\n return args.resource!.metadata.namespace\n }),\n args.cluster,\n opts,\n )\n }\n\n /**\n * Patches an existing namespace.\n *\n * Will throw an error if the namespace does not exist.\n */\n static patch(name: string, args: NamespaceArgs, opts?: ComponentResourceOptions): Namespace {\n return new NamespacePatch(name, args, opts)\n }\n\n /**\n * Gets an existing namespace.\n *\n * Will throw an error if the namespace does not exist.\n */\n static get(\n name: string,\n id: Input<string>,\n cluster: Input<k8s.Cluster>,\n opts?: ComponentResourceOptions,\n ): Namespace {\n return new ExternalNamespace(name, id, cluster, opts)\n }\n}\n\nclass CreatedNamespace extends Namespace {\n constructor(name: string, args: NamespaceArgs, opts?: ComponentResourceOptions) {\n const namespace = output(args).apply(async args => {\n return new core.v1.Namespace(\n name,\n {\n metadata: mapMetadata(args, name),\n },\n {\n ...opts,\n parent: this,\n provider: await getProvider(args.cluster),\n },\n )\n })\n\n super(\n \"highstate:k8s:Namespace\",\n name,\n args,\n opts,\n output(args.cluster),\n namespace.metadata,\n namespace.spec,\n namespace.status,\n )\n }\n}\n\nclass NamespacePatch extends Namespace {\n constructor(name: string, args: NamespaceArgs, opts?: ComponentResourceOptions) {\n const namespace = output(args).apply(async args => {\n return new core.v1.NamespacePatch(\n name,\n {\n metadata: mapMetadata(args, name),\n },\n {\n ...opts,\n parent: this,\n provider: await getProvider(args.cluster),\n },\n )\n })\n\n super(\n \"highstate:k8s:NamespacePatch\",\n name,\n args,\n opts,\n output(args.cluster),\n namespace.metadata,\n namespace.spec,\n namespace.status,\n )\n }\n}\n\nclass ExternalNamespace extends Namespace {\n constructor(\n name: string,\n id: Input<string>,\n cluster: Input<k8s.Cluster>,\n opts?: ComponentResourceOptions,\n ) {\n const namespace = output(id).apply(async realName => {\n return core.v1.Namespace.get(\n //\n name,\n realName,\n {\n ...opts,\n parent: this,\n provider: await getProvider(cluster),\n },\n )\n })\n\n super(\n \"highstate:k8s:ExternalNamespace\",\n name,\n { id, cluster },\n opts,\n output(cluster),\n namespace.metadata,\n namespace.spec,\n namespace.status,\n )\n }\n}\n","import type { PartialKeys } from \"@highstate/contract\"\nimport type { k8s } from \"@highstate/library\"\nimport { Output, output, toPromise, type Input, type Unwrap } from \"@highstate/pulumi\"\nimport { core, Provider, types } from \"@pulumi/kubernetes\"\nimport { Namespace } from \"./namespace\"\n\nconst providers = new Map<string, Provider>()\n\nexport function getProvider(cluster: Input<k8s.Cluster>): Promise<Provider> {\n const provider = output(cluster).apply(cluster => {\n const existingProvider = providers.get(cluster.id)\n if (existingProvider) {\n return existingProvider\n }\n\n const provider = new Provider(`${cluster.name}-${cluster.id}`, {\n kubeconfig: cluster.kubeconfig,\n })\n providers.set(cluster.id, provider)\n\n return provider\n })\n\n return toPromise(provider)\n}\n\nexport type NamespaceLike = core.v1.Namespace | Namespace | string\n\nexport type CommonArgs = {\n /**\n * The name of the resource.\n */\n name?: Input<string>\n\n /**\n * The namespace to create the resource in.\n */\n namespace: Input<NamespaceLike | undefined>\n\n /**\n * The cluster to create the resource in.\n */\n cluster: Input<k8s.Cluster>\n\n /**\n * The metadata to apply to the resource.\n */\n metadata?: Input<types.input.meta.v1.ObjectMeta>\n}\n\nexport const commonExtraArgs = [\"name\", \"namespace\", \"cluster\", \"metadata\"] as const\n\nexport function mapMetadata(\n args: PartialKeys<Unwrap<CommonArgs>, \"namespace\" | \"cluster\">,\n fallbackName?: string,\n): types.input.meta.v1.ObjectMeta {\n return {\n ...args.metadata,\n name: args.name ?? args.metadata?.name ?? fallbackName,\n namespace: args.namespace ? mapNamespaceLikeToNamespaceName(args.namespace) : undefined,\n }\n}\n\nexport type SelectorLike = types.input.meta.v1.LabelSelector | Record<string, Input<string>>\n\nexport function mapSelectorLikeToSelector(\n selector: SelectorLike,\n): types.input.meta.v1.LabelSelector {\n if (\"matchLabels\" in selector || \"matchExpressions\" in selector) {\n return selector\n }\n\n return {\n matchLabels: selector as Record<string, Input<string>>,\n }\n}\n\nexport function mapNamespaceLikeToNamespaceName(namespace: NamespaceLike): Output<string> {\n if (Namespace.isInstance(namespace)) {\n return namespace.metadata.name\n }\n\n if (core.v1.Namespace.isInstance(namespace)) {\n return namespace.metadata.name\n }\n\n return output(namespace)\n}\n\nexport function mapNamespaceNameToSelector(\n namespace: Input<string>,\n): types.input.meta.v1.LabelSelector {\n return {\n matchLabels: {\n \"kubernetes.io/metadata.name\": namespace,\n },\n }\n}\n\nexport type ResourceId = {\n name: Input<string>\n namespace?: Input<string | undefined>\n}\n\nexport function resourceIdToString(id: Input<ResourceId>): Output<string> {\n return output(id).apply(metadata => {\n return metadata.namespace ? `${metadata.namespace}/${metadata.name}` : metadata.name\n })\n}\n\nexport function getAppName(resourceId: Unwrap<ResourceId>): string {\n if (resourceId.namespace !== resourceId.name) {\n return `${resourceId.namespace ?? \"default\"}-${resourceId.name}`\n }\n\n return resourceId.name\n}\n\nexport function getAppDisplayName(resourceId: Unwrap<ResourceId>): string {\n if (resourceId.namespace !== resourceId.name) {\n return `${resourceId.namespace ?? \"default\"}/${resourceId.name}`\n }\n\n return resourceId.name\n}\n\nexport function withPatchName(\n resourceType: string,\n resource: Input<k8s.Resource>,\n cluster: Input<k8s.Cluster>,\n): Output<string> {\n return output({ resource, cluster }).apply(({ resource, cluster }) => {\n if (resource.clusterId !== cluster.id) {\n throw new Error(\n `Cluster mismatch when patching ${resourceType} \"${resource.metadata.name}\": \"${resource.clusterId}\" != \"${cluster.id}\"`,\n )\n }\n\n return resource.metadata.name\n })\n}\n"],"mappings":";AACA,SAAS,QAAAA,aAAwB;AACjC;AAAA,EACE;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Y,OAAO;AAAA,QACrC;AAAA,MACF;AAAA,IACF,CAAC;AAED;AAAA,MACE;AAAA,MACA;AAAA,MACA,EAAE,IAAI,QAAQ;AAAA,MACd;AAAA,MACAF,QAAO,OAAO;AAAA,MACd,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,IACZ;AAAA,EACF;AACF;","names":["core","output","cluster","provider","resource","output","args","core"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/service.ts","../src/gateway/http-route.ts","../src/gateway/backend.ts"],"sourcesContent":["import type { k8s, network } from \"@highstate/library\"\nimport { core, types } from \"@pulumi/kubernetes\"\nimport {\n ComponentResource,\n normalize,\n output,\n Output,\n type ComponentResourceOptions,\n type Input,\n type Inputs,\n} from \"@highstate/pulumi\"\nimport { omit, uniqueBy } from \"remeda\"\nimport { deepmerge } from \"deepmerge-ts\"\nimport { filterEndpoints, l4EndpointToString, parseL3Endpoint } from \"@highstate/common\"\nimport {\n commonExtraArgs,\n mapMetadata,\n resourceIdToString,\n type CommonArgs,\n type ResourceId,\n type SelectorLike,\n} from \"./shared\"\n\nexport type ServiceArgs = CommonArgs & {\n /**\n * The port to expose the service on.\n */\n port?: Input<types.input.core.v1.ServicePort>\n\n /**\n * Whether the service should be exposed by `NodePort` or `LoadBalancer`.\n *\n * The type of the service will be determined automatically based on the cluster.\n */\n external?: boolean\n} & types.input.core.v1.ServiceSpec\n\nconst serviceExtraArgs = [...commonExtraArgs, \"port\", \"ports\", \"external\"] as const\n\nexport type ServiceEndpointMetadata = {\n clusterId: string\n name: string\n namespace: string\n selector: SelectorLike\n targetPort: string | number\n}\n\n/**\n * Checks if the endpoint has service metadata.\n *\n * Alters the type of the endpoint to include the service metadata if it exists.\n *\n * @param endpoint The endpoint to check.\n * @returns True if the endpoint has service metadata, false otherwise.\n */\nexport function hasServiceMetadata(\n endpoint: network.L3Endpoint,\n): endpoint is network.L3Endpoint & { metadata: { k8sService: ServiceEndpointMetadata } } {\n return endpoint.metadata?.k8sService !== undefined\n}\n\n/**\n * Returns the service metadata of the endpoint.\n *\n * @param endpoint The endpoint to get the service metadata from.\n * @returns The service metadata of the endpoint, or undefined if it doesn't exist.\n */\nexport function getServiceMetadata(\n endpoint: network.L3Endpoint,\n): ServiceEndpointMetadata | undefined {\n return endpoint.metadata?.k8sService as ServiceEndpointMetadata\n}\n\n/**\n * Adds service metadata to the endpoint.\n *\n * @param endpoint The endpoint to add the metadata to.\n * @param metadata The metadata to add.\n * @returns The endpoint with the added metadata.\n */\nexport function withServiceMetadata<TEdnpoint extends network.L34Endpoint>(\n endpoint: TEdnpoint,\n metadata: ServiceEndpointMetadata,\n): TEdnpoint & { metadata: { k8sService: ServiceEndpointMetadata } } {\n return {\n ...endpoint,\n metadata: {\n ...endpoint.metadata,\n k8sService: metadata,\n },\n }\n}\n\n/**\n * Checks if the endpoint is from the given cluster.\n *\n * @param endpoint The endpoint to check.\n * @param cluster The cluster to check against.\n * @returns True if the endpoint is from the cluster, false otherwise.\n */\nexport function isFromCluster(\n endpoint: network.L3Endpoint,\n cluster: k8s.Cluster,\n): endpoint is network.L3Endpoint & { metadata: { k8sService: ServiceEndpointMetadata } } {\n return getServiceMetadata(endpoint)?.clusterId === cluster.id\n}\n\nexport abstract class Service extends ComponentResource {\n protected constructor(\n type: string,\n name: string,\n args: Inputs,\n opts: ComponentResourceOptions,\n\n /**\n * The cluster info associated with the service.\n */\n readonly cluster: Output<k8s.Cluster>,\n\n /**\n * The metadata of the underlying Kubernetes service.\n */\n readonly metadata: Output<types.output.meta.v1.ObjectMeta>,\n\n /**\n * The spec of the underlying Kubernetes service.\n */\n readonly spec: Output<types.output.core.v1.ServiceSpec>,\n\n /**\n * The status of the underlying Kubernetes service.\n */\n readonly status: Output<types.output.core.v1.ServiceStatus>,\n ) {\n super(type, name, args, opts)\n }\n\n /**\n * The Highstate service entity.\n */\n get entity(): Output<k8s.Service> {\n return output({\n type: \"k8s.service\",\n clusterId: this.cluster.id,\n metadata: this.metadata,\n endpoints: this.endpoints,\n })\n }\n\n static create(name: string, args: ServiceArgs, opts: ComponentResourceOptions): Service {\n return new CreatedService(name, args, opts)\n }\n\n static wrap(\n name: string,\n service: Input<core.v1.Service>,\n cluster: Input<k8s.Cluster>,\n opts: ComponentResourceOptions,\n ): Service {\n return new WrappedService(name, service, cluster, opts)\n }\n\n static external(\n name: string,\n id: ResourceId,\n cluster: Input<k8s.Cluster>,\n opts: ComponentResourceOptions,\n ): Service {\n return new ExternalService(name, id, cluster, opts)\n }\n\n static of(\n name: string,\n entity: Input<k8s.Service>,\n cluster: Input<k8s.Cluster>,\n opts: ComponentResourceOptions,\n ): Service {\n return new ExternalService(\n name,\n output(entity).metadata,\n output({ cluster, entity }).apply(({ cluster, entity }) => {\n if (cluster.id !== entity.clusterId) {\n throw new Error(\n `Cluster mismatch when wrapping service \"${name}\": \"${cluster.id}\" != \"${entity.clusterId}\"`,\n )\n }\n\n return cluster\n }),\n opts,\n )\n }\n\n /**\n * Returns the endpoints of the service applying the given filter.\n *\n * If no filter is specified, the default behavior of `filterEndpoints` is used.\n *\n * @param filter If specified, the endpoints are filtered based on the given filter.\n * @returns The endpoints of the service.\n */\n filterEndpoints(filter?: network.EndpointFilter): Output<network.L4Endpoint[]> {\n return output({ endpoints: this.endpoints }).apply(({ endpoints }) => {\n return filterEndpoints(endpoints, filter)\n })\n }\n\n /**\n * Returns the endpoints of the service including both internal and external endpoints.\n */\n get endpoints(): Output<network.L4Endpoint[]> {\n return output({\n clusterId: this.cluster.id,\n metadata: this.metadata,\n spec: this.spec,\n status: this.status,\n }).apply(({ clusterId, metadata, spec, status }) => {\n const endpointMetadata = {\n k8sService: {\n clusterId,\n name: metadata.name,\n namespace: metadata.namespace,\n selector: spec.selector,\n targetPort: spec.ports[0].targetPort ?? spec.ports[0].port,\n },\n }\n\n const clusterIpEndpoints = spec.clusterIPs?.map(ip => ({\n ...parseL3Endpoint(ip),\n port: spec.ports[0].port,\n protocol: spec.ports[0].protocol?.toLowerCase() as network.L4Protocol,\n metadata: endpointMetadata,\n }))\n\n if (clusterIpEndpoints.length > 0) {\n clusterIpEndpoints.unshift({\n type: \"hostname\",\n visibility: \"internal\",\n hostname: `${metadata.name}.${metadata.namespace}.svc.cluster.local`,\n port: spec.ports[0].port,\n protocol: spec.ports[0].protocol?.toLowerCase() as network.L4Protocol,\n metadata: endpointMetadata,\n })\n }\n\n const nodePortEndpoints =\n spec.type === \"NodePort\"\n ? spec.externalIPs?.map(ip => ({\n ...parseL3Endpoint(ip),\n port: spec.ports[0].nodePort,\n protocol: spec.ports[0].protocol?.toLowerCase() as network.L4Protocol,\n metadata: endpointMetadata,\n }))\n : []\n\n const loadBalancerEndpoints =\n spec.type === \"LoadBalancer\"\n ? status.loadBalancer?.ingress?.map(endpoint => ({\n ...parseL3Endpoint(endpoint.ip ?? endpoint.hostname),\n port: spec.ports[0].port,\n protocol: spec.ports[0].protocol?.toLowerCase() as network.L4Protocol,\n metadata: endpointMetadata,\n }))\n : []\n\n return uniqueBy(\n [\n ...(clusterIpEndpoints ?? []),\n ...(loadBalancerEndpoints ?? []),\n ...(nodePortEndpoints ?? []),\n ],\n endpoint => l4EndpointToString(endpoint),\n )\n })\n }\n}\n\nclass CreatedService extends Service {\n constructor(name: string, args: ServiceArgs, opts: ComponentResourceOptions) {\n const service = output(args).apply(args => {\n return new core.v1.Service(\n name,\n {\n metadata: mapMetadata(args, name),\n spec: deepmerge(\n {\n ports: normalize(args.port, args.ports),\n\n externalIPs: args.external\n ? (args.externalIPs ?? args.cluster.externalIps)\n : args.cluster.externalIps,\n\n type: getServiceType(args, args.cluster),\n },\n omit(args, serviceExtraArgs),\n ),\n },\n { parent: this, ...opts },\n )\n })\n\n super(\n \"highstate:k8s:Service\",\n name,\n args,\n opts,\n\n output(args.cluster),\n service.metadata,\n service.spec,\n service.status,\n )\n }\n}\n\nclass WrappedService extends Service {\n constructor(\n name: string,\n service: Input<core.v1.Service>,\n cluster: Input<k8s.Cluster>,\n opts: ComponentResourceOptions,\n ) {\n super(\n \"highstate:k8s:WrappedService\",\n name,\n { service, clusterInfo: cluster },\n opts,\n\n output(cluster),\n output(service).metadata,\n output(service).spec,\n output(service).status,\n )\n }\n}\n\nclass ExternalService extends Service {\n constructor(\n name: string,\n id: Input<ResourceId>,\n cluster: Input<k8s.Cluster>,\n opts: ComponentResourceOptions,\n ) {\n const service = output(id).apply(id => {\n return core.v1.Service.get(\n //\n name,\n resourceIdToString(id),\n { ...opts, parent: this },\n )\n })\n\n super(\n \"highstate:k8s:ExternalService\",\n name,\n { id, cluster },\n opts,\n\n output(cluster),\n service.metadata,\n service.spec,\n service.status,\n )\n }\n}\n\nexport function mapContainerPortToServicePort(\n port: types.input.core.v1.ContainerPort,\n): types.input.core.v1.ServicePort {\n return {\n name: port.name,\n port: port.containerPort,\n targetPort: port.containerPort,\n protocol: port.protocol,\n }\n}\n\nexport function mapServiceToLabelSelector(\n service: core.v1.Service,\n): types.input.meta.v1.LabelSelector {\n return {\n matchLabels: service.spec.selector,\n }\n}\n\nexport function getServiceType(\n service: Pick<ServiceArgs, \"type\" | \"external\"> | undefined,\n cluster: k8s.Cluster,\n): Input<string> {\n if (service?.type) {\n return service.type\n }\n\n if (!service?.external) {\n return \"ClusterIP\"\n }\n\n return cluster.quirks?.externalServiceType === \"LoadBalancer\" ? \"LoadBalancer\" : \"NodePort\"\n}\n","import {\n ComponentResource,\n normalize,\n output,\n Output,\n type ComponentResourceOptions,\n type Input,\n type InputArray,\n} from \"@highstate/pulumi\"\nimport { gateway, types } from \"@highstate/gateway-api\"\nimport { map, pipe } from \"remeda\"\nimport { getProvider, mapMetadata, type CommonArgs } from \"../shared\"\nimport { resolveBackendRef, type BackendRef } from \"./backend\"\n\nexport type HttpRouteArgs = Omit<CommonArgs, \"namespace\"> & {\n /**\n * The gateway to associate with the route.\n */\n gateway: Input<gateway.v1.Gateway>\n\n /**\n * The alias for `hostnames: [hostname]`.\n */\n hostname?: Input<string>\n\n /**\n * The rule of the route.\n */\n rule?: Input<HttpRouteRuleArgs>\n\n /**\n * The rules of the route.\n */\n rules?: InputArray<HttpRouteRuleArgs>\n} & Omit<Partial<types.input.gateway.v1.HTTPRouteSpec>, \"rules\">\n\nexport type HttpRouteRuleArgs = Omit<\n types.input.gateway.v1.HTTPRouteSpecRules,\n \"matches\" | \"filters\" | \"backendRefs\"\n> & {\n /**\n * The conditions of the rule.\n * Can be specified as string to match on the path.\n */\n matches?: InputArray<HttpRouteRuleMatchOptions>\n\n /**\n * The condition of the rule.\n * Can be specified as string to match on the path.\n */\n match?: Input<HttpRouteRuleMatchOptions>\n\n /**\n * The filters of the rule.\n */\n filters?: InputArray<types.input.gateway.v1.HTTPRouteSpecRulesFilters>\n\n /**\n * The filter of the rule.\n */\n filter?: Input<types.input.gateway.v1.HTTPRouteSpecRulesFilters>\n\n /**\n * The service to route to.\n */\n backend?: Input<BackendRef>\n}\n\nexport type HttpRouteRuleMatchOptions = types.input.gateway.v1.HTTPRouteSpecRulesMatches | string\n\nexport class HttpRoute extends ComponentResource {\n /**\n * The underlying Kubernetes resource.\n */\n public readonly route: Output<gateway.v1.HTTPRoute>\n\n constructor(name: string, args: HttpRouteArgs, opts?: ComponentResourceOptions) {\n super(\"highstate:k8s:HttpRoute\", name, args, opts)\n\n this.route = output({\n args,\n gatewayNamespace: output(args.gateway).metadata.namespace,\n }).apply(async ({ args, gatewayNamespace }) => {\n return new gateway.v1.HTTPRoute(\n name,\n {\n metadata: mapMetadata(\n {\n ...args,\n namespace: gatewayNamespace as string,\n },\n name,\n ),\n spec: {\n hostnames: normalize(args.hostname, args.hostnames),\n\n parentRefs: [\n {\n name: args.gateway.metadata.name as Output<string>,\n },\n ],\n\n rules: normalize(args.rule, args.rules).map(rule => ({\n timeouts: rule.timeouts,\n\n matches: pipe(\n normalize(rule.match, rule.matches),\n map(mapHttpRouteRuleMatch),\n addDefaultPathMatch,\n ),\n\n filters: normalize(rule.filter, rule.filters),\n backendRefs: rule.backend ? [resolveBackendRef(rule.backend)] : undefined,\n })),\n } satisfies types.input.gateway.v1.HTTPRouteSpec,\n },\n {\n ...opts,\n parent: this,\n provider: await getProvider(args.cluster),\n },\n )\n })\n }\n}\n\nfunction addDefaultPathMatch(\n matches: types.input.gateway.v1.HTTPRouteSpecRulesMatches[],\n): types.input.gateway.v1.HTTPRouteSpecRulesMatches[] {\n return matches.length ? matches : [{ path: { type: \"PathPrefix\", value: \"/\" } }]\n}\n\nexport function mapHttpRouteRuleMatch(\n match: HttpRouteRuleMatchOptions,\n): types.input.gateway.v1.HTTPRouteSpecRulesMatches {\n if (typeof match === \"string\") {\n return { path: { type: \"PathPrefix\", value: match } }\n }\n\n return match\n}\n","import { core } from \"@pulumi/kubernetes\"\nimport { type Input, output, Output, type Unwrap } from \"@highstate/pulumi\"\nimport { Service } from \"../service\"\n\nexport interface FullBackendRef {\n /**\n * The name of the resource being referenced.\n */\n name: Input<string>\n\n /**\n * The namespace of the resource being referenced.\n * May be undefined if the resource is not in a namespace.\n */\n namespace?: Input<string | undefined>\n\n /**\n * The port of the resource being referenced.\n */\n port: Input<number>\n}\n\nexport interface ServiceBackendRef {\n /**\n * The name of the service being referenced.\n */\n service: Input<core.v1.Service>\n\n /**\n * The port of the service being referenced.\n */\n port: Input<number>\n}\n\nexport type BackendRef = FullBackendRef | ServiceBackendRef | Service\n\nexport function resolveBackendRef(ref: BackendRef): Output<Unwrap<FullBackendRef>> {\n if (Service.isInstance(ref)) {\n return output({\n name: ref.metadata.name,\n namespace: ref.metadata.namespace,\n port: ref.spec.ports[0].port,\n })\n }\n\n if (\"service\" in ref) {\n const service = output(ref.service)\n\n return output({\n name: service.metadata.name,\n namespace: service.metadata.namespace,\n port: ref.port,\n })\n }\n\n return output({\n name: ref.name,\n namespace: ref.namespace,\n port: ref.port,\n })\n}\n"],"mappings":";;;;;;;;AACA,SAAS,YAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP,SAAS,MAAM,gBAAgB;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ity","args","id","ComponentResource","normalize","output","output","output","ComponentResource","output","args","normalize"]}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|