games/factorio: move jsonnet from //personal/q3k
We also remove the definition of two instances that are long since dead.
Change-Id: I0cd83321403053cb72837da1497842109eeacd2b
diff --git a/games/factorio/kube/prod.jsonnet b/games/factorio/kube/prod.jsonnet
new file mode 100644
index 0000000..d833fc3
--- /dev/null
+++ b/games/factorio/kube/prod.jsonnet
@@ -0,0 +1,87 @@
+local factorio = import "factorio.libsonnet";
+local kube = import "../../../kube/kube.libsonnet";
+
+// This deploys factorio instances and the modproxy in the `factorio`
+// Kubernetes namespace.
+//
+// Available factorio versions:
+// - 0.18.40-1
+// - 1.0.0-1
+// See: //third_party/factorio.
+
+{
+ local prod = self,
+
+ proxyImage:: "registry.k0.hswaw.net/games/factorio/modproxy:1589157915-eafe7be328477e8a6590c4210466ef12901f1b9a",
+
+ namespace: kube.Namespace("factorio"),
+ instance(name, tag):: factorio {
+ cfg+: {
+ namespace: "factorio",
+ prefix: name + "-",
+ tag: tag,
+ proxyImage: prod.proxyImage,
+ }
+ },
+
+ proxy: {
+ pvc: kube.PersistentVolumeClaim("proxy-cas") {
+ metadata+: {
+ namespace: "factorio",
+ },
+ spec+: {
+ storageClassName: "waw-hdd-redundant-3",
+ accessModes: [ "ReadWriteOnce" ],
+ resources: {
+ requests: {
+ storage: "32Gi",
+ },
+ },
+ },
+ },
+ deploy: kube.Deployment("proxy") {
+ metadata+: {
+ namespace: "factorio",
+ },
+ spec+: {
+ template+: {
+ spec+: {
+ volumes_: {
+ cas: kube.PersistentVolumeClaimVolume(prod.proxy.pvc),
+ },
+ containers_: {
+ proxy: kube.Container("proxy") {
+ image:prod.proxyImage,
+ command: [
+ "/games/factorio/modproxy/modproxy",
+ "-hspki_disable",
+ "-cas_directory", "/mnt/cas",
+ "-listen_address", "0.0.0.0:4200",
+ ],
+ volumeMounts_: {
+ cas: { mountPath: "/mnt/cas" },
+ },
+ ports_: {
+ client: { containerPort: 4200 },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ svc: kube.Service("proxy") {
+ metadata+: {
+ namespace: "factorio",
+ },
+ target_pod:: prod.proxy.deploy.spec.template,
+ spec+: {
+ ports: [
+ { name: "client", port: 4200, targetPort: 4200, protocol: "TCP" },
+ ],
+ },
+ },
+ },
+
+ local mod = function(name, version) { name: name, version: version },
+}