forked from hswaw/hscloud
Serge Bazanski
c684ca9b81
This moves all the proxy Kube resources to proxy.libsonnet. Effect is a zero diff against prod: $ kubecfg diff --diff-strategy=subset prod.jsonnet [...] namespaces factorio unchanged [...] deployments factorio.proxy unchanged [...] services factorio.proxy unchanged [...] persistentvolumeclaims factorio.proxy-cas unchanged Change-Id: I9c6281e836f7b78373aad21120340994e801f8b4
68 lines
2.1 KiB
Text
68 lines
2.1 KiB
Text
local kube = import "../../../kube/kube.libsonnet";
|
|
|
|
{
|
|
local proxy = self,
|
|
local cfg = proxy.cfg,
|
|
|
|
cfg:: {
|
|
image:: "registry.k0.hswaw.net/games/factorio/modproxy:1589157915-eafe7be328477e8a6590c4210466ef12901f1b9a",
|
|
namespace: error "namespace must be set",
|
|
},
|
|
|
|
pvc: kube.PersistentVolumeClaim("proxy-cas") {
|
|
metadata+: {
|
|
namespace: cfg.namespace,
|
|
},
|
|
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(proxy.pvc),
|
|
},
|
|
containers_: {
|
|
proxy: kube.Container("proxy") {
|
|
image: cfg.image,
|
|
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:: proxy.deploy.spec.template,
|
|
spec+: {
|
|
ports: [
|
|
{ name: "client", port: 4200, targetPort: 4200, protocol: "TCP" },
|
|
],
|
|
},
|
|
},
|
|
}
|