blob: eb200c93ba9dc5057e17b130beaa993b048e7bef [file] [log] [blame]
Sergiusz Bazanskicb5c3212019-05-19 03:10:17 +02001local factorio = import "factorio.libsonnet";
Serge Bazanskie7f4cc12021-06-12 21:55:40 +00002local kube = import "../../../kube/kube.libsonnet";
Sergiusz Bazanskicb5c3212019-05-19 03:10:17 +02003
Serge Bazanskie7f4cc12021-06-12 21:55:40 +00004// This deploys factorio instances and the modproxy in the `factorio`
5// Kubernetes namespace.
6//
7// Available factorio versions:
Serge Bazanski791ab6d2020-08-14 10:34:29 +00008// - 1.0.0-1
Dariusz Niemczykb3799c82021-06-12 23:02:58 +02009// - 1.1.34-1
Serge Bazanskie7f4cc12021-06-12 21:55:40 +000010// See: //third_party/factorio.
Sergiusz Bazanskicb5c3212019-05-19 03:10:17 +020011
12{
13 local prod = self,
14
Sergiusz Bazanski0581bbf2020-05-11 03:21:32 +020015 proxyImage:: "registry.k0.hswaw.net/games/factorio/modproxy:1589157915-eafe7be328477e8a6590c4210466ef12901f1b9a",
16
Sergiusz Bazanskicb5c3212019-05-19 03:10:17 +020017 namespace: kube.Namespace("factorio"),
18 instance(name, tag):: factorio {
19 cfg+: {
20 namespace: "factorio",
21 prefix: name + "-",
22 tag: tag,
Sergiusz Bazanski0581bbf2020-05-11 03:21:32 +020023 proxyImage: prod.proxyImage,
Sergiusz Bazanskicb5c3212019-05-19 03:10:17 +020024 }
25 },
26
Sergiusz Bazanski0581bbf2020-05-11 03:21:32 +020027 proxy: {
28 pvc: kube.PersistentVolumeClaim("proxy-cas") {
29 metadata+: {
30 namespace: "factorio",
31 },
32 spec+: {
33 storageClassName: "waw-hdd-redundant-3",
34 accessModes: [ "ReadWriteOnce" ],
35 resources: {
36 requests: {
37 storage: "32Gi",
38 },
39 },
40 },
41 },
42 deploy: kube.Deployment("proxy") {
43 metadata+: {
44 namespace: "factorio",
45 },
46 spec+: {
47 template+: {
48 spec+: {
49 volumes_: {
50 cas: kube.PersistentVolumeClaimVolume(prod.proxy.pvc),
51 },
52 containers_: {
53 proxy: kube.Container("proxy") {
54 image:prod.proxyImage,
55 command: [
56 "/games/factorio/modproxy/modproxy",
57 "-hspki_disable",
58 "-cas_directory", "/mnt/cas",
59 "-listen_address", "0.0.0.0:4200",
60 ],
61 volumeMounts_: {
62 cas: { mountPath: "/mnt/cas" },
63 },
64 ports_: {
65 client: { containerPort: 4200 },
66 },
67 },
68 },
69 },
70 },
71 },
72 },
73 svc: kube.Service("proxy") {
74 metadata+: {
75 namespace: "factorio",
76 },
77 target_pod:: prod.proxy.deploy.spec.template,
78 spec+: {
79 ports: [
80 { name: "client", port: 4200, targetPort: 4200, protocol: "TCP" },
81 ],
82 },
83 },
84 },
85
86 local mod = function(name, version) { name: name, version: version },
Dariusz Niemczykb3799c82021-06-12 23:02:58 +020087 pymods: prod.instance("pymods", "1.1.34-1") {
88 cfg+: {
89 mods: [
90 // Stdlib for mods
91 mod("stdlib", "1.4.6"),
92 // General QOL
93 // Better loaders
94 mod("LoaderRedux", "1.7.1"),
95 mod("LoaderReduxForFactorioExtendedPlus", "1.1.0"),
96 // Trains
97 mod("traintunnels", "0.0.11"),
98 mod("FARL", "4.1.2"),
99 // Move between buildings
100 mod("Squeak Through", "1.8.2"),
101 // Requirements calculator
102 mod("helmod", "0.12.5"),
103 // Compact loaders for easier and faster transportation
104 mod("deadlock-beltboxes-loaders", "2.4.2"),
105 // Better inserters
106 mod("bobinserters", "1.1.0"),
107 // Teleport to tags for easier movement with huge server
108 mod("TagToTeleport", "1.1.1"),
109 // Necessary for PYmods to get proper list of ingredients for the next step
110 mod("what-is-it-really-used-for", "1.6.0"),
111 // Resource monitor
112 mod("YARM", "0.8.203"),
113 // YEET
114 mod("RenaiTransportation", "0.8.6"),
115
116 // PYmods
117 mod("pypetroleumhandling", "2.0.6"),
118 mod("pyrawores", "2.2.7"),
119 mod("pyraworesgraphics", "1.0.9"),
120 mod("pycoalprocessing", "1.9.3"),
121 mod("pycoalprocessinggraphics", "1.0.9"),
122 // Resource overhaul
123 mod("rso-mod", "6.2.6")
124 ],
125 },
126 },
Sergiusz Bazanskicb5c3212019-05-19 03:10:17 +0200127}