blob: ef66003a61fb65b0b9b22f84d4036c407b65c13a [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: 'Kyocera_M5526cdw',
aliases: ['kyocera', 'a4_color', 'a4_color'],
ipp_url: 'https://$(BASIC_AUTH_SECRET)@printmaster.waw.hackerspace.pl:443/printers/Kyocera_M5526cdw',
}
]
}, ' '),
},
livenessProbe: {
httpGet: { path: '/health', port: 3199 },
initialDelaySeconds: 5,
periodSeconds: 5 * 60,
},
},
},
},
},
},
},
service: ns.Contain(kube.Service(cfg.name)) {
target:: top.deployment,
},
}