/
nginx.js
51 lines (47 loc) · 967 Bytes
/
nginx.js
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
import { Deployment } from "kubernetes-models/apps/v1/Deployment";
import { Service } from "kubernetes-models/v1/Service";
import env from "../env";
const params = env.component("nginx");
const metadata = { name: "nginx" };
const labels = { app: "nginx" };
const deployment = new Deployment({
metadata,
spec: {
replicas: params.replicas,
selector: {
matchLabels: labels
},
template: {
metadata: {
labels
},
spec: {
containers: [
{
image: `${params.imageRegistry}/nginx:${params.imageTag}`,
name: "nginx",
ports: [
{
containerPort: 80
}
]
}
]
}
}
}
});
const service = new Service({
metadata,
spec: {
selector: labels,
type: "ClusterIP",
ports: [
{
port: 80,
targetPort: 80
}
]
}
});
export default [deployment, service];