2024-08-30 17:47:35 +01:00
|
|
|
local base = import "base/base.jsonnet";
|
|
|
|
|
local images = import "values/images.jsonnet";
|
2024-09-05 16:40:47 +01:00
|
|
|
|
2024-08-13 17:30:59 +01:00
|
|
|
{
|
2024-09-05 16:40:47 +01:00
|
|
|
|
|
|
|
|
"pulsar" +: {
|
|
|
|
|
|
|
|
|
|
create:: function(engine)
|
|
|
|
|
|
2024-09-07 18:59:38 +01:00
|
|
|
// local confVolume = engine.volume("pulsar-conf").with_size("2G");
|
2024-09-05 18:17:47 +01:00
|
|
|
local dataVolume = engine.volume("pulsar-data").with_size("20G");
|
|
|
|
|
|
|
|
|
|
local container =
|
|
|
|
|
engine.container("pulsar")
|
|
|
|
|
.with_image(images.pulsar)
|
2024-09-07 18:59:38 +01:00
|
|
|
.with_command(["bin/pulsar", "standalone"])
|
|
|
|
|
// .with_command(["/bin/sh", "-c", "sleep 9999999"])
|
2024-09-05 18:17:47 +01:00
|
|
|
.with_environment({
|
2024-09-07 18:59:38 +01:00
|
|
|
"PULSAR_MEM": "-Xms600M -Xmx600M"
|
2024-09-05 18:17:47 +01:00
|
|
|
})
|
2024-09-07 18:59:38 +01:00
|
|
|
.with_limits("2.0", "1500M")
|
|
|
|
|
.with_reservations("1.0", "1500M")
|
|
|
|
|
// .with_volume_mount(confVolume, "/pulsar/conf")
|
2024-09-05 18:17:47 +01:00
|
|
|
.with_volume_mount(dataVolume, "/pulsar/data")
|
|
|
|
|
.with_port(6650, 6650, "bookie")
|
|
|
|
|
.with_port(8080, 8080, "http");
|
|
|
|
|
|
|
|
|
|
local adminContainer =
|
|
|
|
|
engine.container("init-pulsar")
|
|
|
|
|
.with_image(images.pulsar)
|
|
|
|
|
.with_command([
|
|
|
|
|
"sh",
|
|
|
|
|
"-c",
|
2024-09-07 18:59:38 +01:00
|
|
|
"while true; do pulsar-admin --admin-url http://pulsar:8080 tenants create tg ; pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/flow ; pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/request ; pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/response ; pulsar-admin --admin-url http://pulsar:8080 namespaces set-retention --size -1 --time 3m tg/response; sleep 20; done",
|
2024-09-05 18:17:47 +01:00
|
|
|
])
|
2024-09-07 18:59:38 +01:00
|
|
|
.with_limits("1", "400M")
|
|
|
|
|
.with_reservations("0.1", "400M");
|
2024-09-05 18:17:47 +01:00
|
|
|
|
|
|
|
|
local containerSet = engine.containers(
|
|
|
|
|
"pulsar",
|
|
|
|
|
[
|
2024-09-07 18:59:38 +01:00
|
|
|
container
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
local adminContainerSet = engine.containers(
|
|
|
|
|
"init-pulsar",
|
|
|
|
|
[
|
|
|
|
|
adminContainer
|
2024-09-05 18:17:47 +01:00
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
local service =
|
|
|
|
|
engine.service(containerSet)
|
2024-09-07 18:59:38 +01:00
|
|
|
.with_port(6650, 6650, "bookie")
|
|
|
|
|
.with_port(8080, 8080, "http");
|
2024-09-05 18:17:47 +01:00
|
|
|
|
|
|
|
|
engine.resources([
|
2024-09-07 18:59:38 +01:00
|
|
|
// confVolume,
|
2024-09-05 18:17:47 +01:00
|
|
|
dataVolume,
|
|
|
|
|
containerSet,
|
2024-09-07 18:59:38 +01:00
|
|
|
adminContainerSet,
|
2024-09-05 18:17:47 +01:00
|
|
|
service,
|
|
|
|
|
])
|
2024-09-05 16:40:47 +01:00
|
|
|
|
2024-08-13 17:30:59 +01:00
|
|
|
}
|
2024-09-05 16:40:47 +01:00
|
|
|
|
2024-08-13 17:30:59 +01:00
|
|
|
}
|
2024-09-05 16:40:47 +01:00
|
|
|
|