-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.ts
73 lines (61 loc) · 1.84 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
import * as os from 'os'
import * as path from 'path'
import * as k8s from '@pulumi/kubernetes'
import { k8sProvider } from './cluster'
import { deploySourcegraphRoot, gcloudConfig } from './config'
const clusterAdmin = new k8s.rbac.v1.ClusterRoleBinding(
'cluster-admin-role-binding',
{
metadata: { name: `${os.userInfo().username}-cluster-admin-role-binding` },
roleRef: {
apiGroup: 'rbac.authorization.k8s.io',
kind: 'ClusterRole',
name: 'cluster-admin',
},
subjects: [
{
apiGroup: 'rbac.authorization.k8s.io',
kind: 'User',
name: gcloudConfig.username,
},
],
},
{ provider: k8sProvider }
)
const storageClass = new k8s.storage.v1.StorageClass(
'sourcegraph-storage-class',
{
metadata: {
name: 'sourcegraph',
labels: {
deploy: 'sourcegraph',
},
},
provisioner: 'kubernetes.io/gce-pd',
parameters: {
type: 'pd-ssd',
},
},
{ provider: k8sProvider }
)
const baseDeployment = new k8s.yaml.ConfigGroup(
'base',
{
files: `${path.posix.join(deploySourcegraphRoot, 'base')}/**/*.yaml`,
},
{
providers: { kubernetes: k8sProvider },
dependsOn: [clusterAdmin, storageClass],
}
)
const ingressNginx = new k8s.yaml.ConfigGroup(
'ingress-nginx',
{
files: `${path.posix.join(deploySourcegraphRoot, 'configure', 'ingress-nginx')}/**/*.yaml`,
},
{ providers: { kubernetes: k8sProvider }, dependsOn: clusterAdmin }
)
export const ingressIPs = ingressNginx
.getResource('v1/Service', 'ingress-nginx', 'ingress-nginx')
.apply(svc => svc.status.apply(status => status.loadBalancer.ingress.map(i => i.ip)))
export * from './cluster'