-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
93 lines (81 loc) · 2.14 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
import {EquinixCluster} from "./cluster";
const certManager = new k8s.helm.v3.Release("cert-manager", {
chart: "cert-manager",
version: "v1.15.3",
namespace: "cert-manager",
createNamespace: true,
repositoryOpts: {
repo: "https://charts.jetstack.io",
},
values: {
installCRDs: true,
},
});
const k8sProvider = new k8s.Provider("k8s", {
enableServerSideApply: true,
})
const capi = new k8s.yaml.ConfigFile("capi", {
file: "./manifests/capi.yaml",
}, {dependsOn: certManager, ignoreChanges: ["*"], provider: k8sProvider});
const capemNamespace = new k8s.core.v1.Namespace("capem", {
metadata: {
name: "cluster-api-provider-packet-system",
labels: {
"cluster.x-k8s.io/provider": "infrastructure-packet",
"control-plane": "controller-manager"
}
},
}, {
dependsOn: [
certManager,
capi,
],
});
const config = new pulumi.Config();
const originalSecret = new k8s.core.v1.Secret("api-credentials", {
metadata: {
name: "cluster-api-provider-packet-manager-api-credentials",
namespace: capemNamespace.metadata.name,
},
type: "Opaque",
stringData: {
"PACKET_API_KEY": config.require("metal-api-key"),
}
},
{
dependsOn: [
certManager,
capi,
],
}
);
const capem = new k8s.yaml.ConfigFile("capem", {
file: "./manifests/capem.yaml",
}, {
dependsOn: [
certManager,
capi,
capemNamespace,
originalSecret,
],
});
for (let i = 0; i < 0; i++) {
const equinixCluster = new EquinixCluster("equinixCluster" + i, {
name: "equinix-cluster-" + i,
sshKey: config.get("sshKey") || "",
projectID: config.require("projectID"),
metro: "FR",
os: "ubuntu_20_04",
machineType: "m3.small.x86",
namespace: "default",
kubernetesVersion: "v1.31.0"
}, {
dependsOn: [
certManager,
capi,
capem,
],
});
}