-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
32 lines (24 loc) · 931 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as pulumi from "@pulumi/pulumi";
import {createHetznerK3S} from "./create/Hetzner";
import {getStack, Output} from "@pulumi/pulumi";
import {createOpenstackK3S} from "./create/Openstack";
const stack = getStack()
const config = new pulumi.Config();
const clusterName = "urban"
const mail = config.get("emailAddress")!!
if (!(stack == "hetzner" || stack == "openstack")) {
throw Error("invalid stack")
}
const result = getKubeConfigAndCluster(stack, clusterName, mail)
export const kubeconfig = result.kubeconfig
export const cluster = result.cluster
function getKubeConfigAndCluster(stack: string, clusterName: string, mail: string): { kubeconfig: Output<string>, cluster: Output<string>} {
if (stack == "hetzner"){
return createHetznerK3S(config, clusterName, mail)
}
else if (stack == "openstack") {
return createOpenstackK3S(config, clusterName, mail)
} else {
throw Error("invalid stack")
}
}