-
Notifications
You must be signed in to change notification settings - Fork 145
Expand file tree
/
Copy pathproxy.ts
More file actions
134 lines (132 loc) · 3.66 KB
/
Copy pathproxy.ts
File metadata and controls
134 lines (132 loc) · 3.66 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import * as pulumi from '@pulumi/pulumi';
import { CertManager } from '../utils/cert-manager';
import { Proxy } from '../utils/reverse-proxy';
import { App } from './app';
import { Environment } from './environment';
import { GraphQL } from './graphql';
import { Observability } from './observability';
import { OTELCollector } from './otel-collector';
import { type PublicGraphQLAPIGateway } from './public-graphql-api-gateway';
import { Usage } from './usage';
export function deployProxy({
graphql,
app,
usage,
environment,
observability,
publicGraphQLAPIGateway,
otelCollector,
}: {
observability: Observability;
environment: Environment;
graphql: GraphQL;
app: App;
usage: Usage;
publicGraphQLAPIGateway: PublicGraphQLAPIGateway;
otelCollector: OTELCollector;
}) {
const { tlsIssueName } = new CertManager().deployCertManagerAndIssuer();
const commonConfig = new pulumi.Config('common');
return new Proxy(tlsIssueName, {
address: commonConfig.get('staticIp'),
aksReservedIpResourceGroup: commonConfig.get('aksReservedIpResourceGroup'),
})
.deployProxy({
envoy: {
replicas: environment.podsConfig.envoy.replicas,
cpu: environment.podsConfig.envoy.cpuLimit,
memory: environment.podsConfig.envoy.memoryLimit,
timeouts: environment.podsConfig.envoy.timeouts,
},
tracing: observability.enabled
? { collectorService: observability.observability!.otlpCollectorService }
: undefined,
})
.registerService({ record: environment.appDns }, [
{
name: 'app',
path: '/',
service: app.service,
requestTimeout: '60s',
},
{
name: 'server',
path: '/server',
service: graphql.service,
requestTimeout: '60s',
},
{
name: 'registry-api-health',
path: '/registry/_health',
customRewrite: '/_health',
service: graphql.service,
},
{
name: 'registry-api',
path: '/registry',
customRewrite: '/graphql',
service: graphql.service,
requestTimeout: '60s',
retriable: true,
},
{
name: 'graphql-api',
path: '/graphql',
customRewrite: '/graphql',
service: graphql.service,
requestTimeout: '60s',
retriable: true,
},
{
name: 'graphql-api-subscriptions',
path: '/graphql/stream',
customRewrite: '/graphql',
service: graphql.service,
requestTimeout: 'infinity',
// we send a ping every 12 seconds
idleTimeout: '30s',
retriable: true,
},
{
name: 'auth',
path: '/auth-api',
customRewrite: '/auth-api',
service: graphql.service,
requestTimeout: '60s',
retriable: true,
},
{
name: 'usage',
path: '/usage',
service: usage.service,
retriable: true,
loadBalancerPolicy: 'WeightedLeastRequest',
},
])
.registerService({ record: environment.apiDns }, [
{
name: 'public-graphql-api',
path: '/graphql',
customRewrite: '/graphql',
service: publicGraphQLAPIGateway.service,
requestTimeout: '60s',
retriable: true,
},
{
name: 'otel-traces',
path: '/otel/v1/traces',
customRewrite: '/v1/traces',
service: otelCollector.service,
requestTimeout: '60s',
retriable: true,
},
{
name: 'scim-provisioning',
path: '/scim/v2',
customRewrite: '/scim/v2',
service: publicGraphQLAPIGateway.service,
requestTimeout: '60s',
retriable: true,
},
]);
}