blob: bed7e6a70617be9638a64a5d2cd2fa4fdd6e6b86 [file] [log] [blame]
local kube = import "../../kube/hscloud.libsonnet";
{
local top = self,
local cfg = self.cfg,
cfg:: {
name: 'printservant',
namespace: 'printservant',
image: 'registry.k0.hswaw.net/radex/printservant:20240207175956',
},
secretRefs:: {
basic_auth: { secretKeyRef: { name: cfg.name, key: 'basic_auth' } },
},
local ns = kube.Namespace(cfg.namespace),
deployment: ns.Contain(kube.Deployment(cfg.name)) {
spec+: {
replicas: 1,
template+: {
spec+: {
containers_: {
default: kube.Container("default") {
image: cfg.image,
ports_: {
http: { containerPort: 3199 },
},
env_: {
PRINTSERVANT_PORT: 3199,
PRINTSERVANT_MAX_SIZE_MB: 10,
BASIC_AUTH_SECRET: top.secretRefs.basic_auth, // quirk: must be first *alphabetically*
PRINTSERVANT_CONFIG: std.manifestJsonEx({
printers: [
{
name: 'DYMO_LabelWriter450',
aliases: ['dymo', 'label'],
ipp_url: 'https://$(BASIC_AUTH_SECRET)@printmaster.waw.hackerspace.pl:443/printers/DYMO_LabelWriter450',
},
{
name: 'Zebra_GK420T',
aliases: ['zebra', 'biglabel', '4x6'],
ipp_url: 'https://$(BASIC_AUTH_SECRET)@printmaster.waw.hackerspace.pl:443/printers/Zebra_GK420T',
},
{
name: 'Brother_MFC8380DN',
aliases: ['brother', 'franciszek', 'a4'],
ipp_url: 'https://$(BASIC_AUTH_SECRET)@printmaster.waw.hackerspace.pl:443/printers/Brother_MFC8380DN',
},
{
name: 'OKI_C332',
aliases: ['oki', 'okiƂ', 'a4_color'],
ipp_url: 'https://$(BASIC_AUTH_SECRET)@printmaster.waw.hackerspace.pl:443/printers/OKI_C332',
}
]
}, ' '),
},
livenessProbe: {
httpGet: { path: '/health', port: 3199 },
initialDelaySeconds: 5,
periodSeconds: 5 * 60,
},
},
},
},
},
},
},
service: ns.Contain(kube.Service(cfg.name)) {
target:: top.deployment,
},
}