blob: e9b1d59c8f507b3e181cf30ceffff781175453fd [file] [log] [blame]
local kube = import '../../../kube/hscloud.libsonnet';
{
local speedtest = self,
local cfg = speedtest.cfg,
cfg:: {
namespace: "speedtest",
appName: "speedtest",
domain: "speedtest.hackerspace.pl",
image: "registry.k0.hswaw.net/q3k/speedetst:1601997887-f9d9c752ad8403c2b284bfeab23111b25f7e2214",
resources: {
requests: {
cpu: "25m",
memory: "50Mi",
},
limits: {
cpu: "100m",
memory: "200Mi",
},
},
},
namespace: kube.Namespace(cfg.namespace),
metadata(component):: {
namespace: cfg.namespace,
labels: {
"app.kubernetes.io/name": cfg.appName,
"app.kubernetes.io/managed-by": "kubecfg",
"app.kubernetes.io/component": component,
},
},
deployment: kube.Deployment("backend") {
metadata+: speedtest.metadata("backend"),
spec+: {
replicas: 1,
template+: {
spec+: {
containers_: {
nginx: kube.Container("backend") {
image: cfg.image,
ports_: {
http: { containerPort: 8080 },
},
resources: cfg.resources,
},
},
},
},
},
},
svc: kube.Service("public") {
metadata+: speedtest.metadata("public"),
target_pod:: speedtest.deployment.spec.template,
},
ingress: kube.SimpleIngress("public") {
hosts:: [cfg.domain],
target_service:: speedtest.svc,
metadata+: speedtest.metadata("public"),
},
}