Closed k9withabone closed 2 months ago
An initial version of the library should be ready to be published once k9withabone/compose_spec_rs#1 is completed. Podlet can then switch to it as the other features (merging, interpolation, etc.) are not a requirement.
compose_spec
v0.1.0 has been published! Time to start working on the migration.
I'm a bit stuck on figuring out how a service Dependency
(from the depends_on
long syntax) should be converted to a systemd unit dependency. My thinking is currently this:
service_started
condition, suggesting to use, in the dependency's definition, Notify=healthy
under [Container]
for service_healthy
and Type=oneshort
under [Service]
for service_completed_successfully
.restart
is true
require that required
is also true
and add the service to PartOf=
. Otherwise, add the service to Requires=
or Wants=
depending on required
.After=
.Is it correct to use PartOf=
for restart
or should something like ReloadPropagatedFrom=
along with Requires=
or Wants=
be used instead? Also, maybe StopPropagatedFrom=
should always be used for a dependency?
I'm not sure who the best person to ask about this is, but @cdrage, since you worked on kompose, what do you think about this?
I'm a bit stuck on figuring out how a service
Dependency
(from thedepends_on
long syntax) should be converted to a systemd unit dependency. My thinking is currently this:
- Only support the
service_started
condition, suggesting to use, in the dependency's definition,Notify=healthy
under[Container]
forservice_healthy
andType=oneshort
under[Service]
forservice_completed_successfully
.- If
restart
istrue
require thatrequired
is alsotrue
and add the service toPartOf=
. Otherwise, add the service toRequires=
orWants=
depending onrequired
.- Add the service to
After=
.Is it correct to use
PartOf=
forrestart
or should something likeReloadPropagatedFrom=
along withRequires=
orWants=
be used instead? Also, maybeStopPropagatedFrom=
should always be used for a dependency?I'm not sure who the best person to ask about this is, but @cdrage, since you worked on kompose, what do you think about this?
To be honest, we never found an answer and did not incorporate it with Kompose :( See: https://kompose.io/conversion/
There's no equivalent for it within Kubernetes.
We instead just have to explain to others that your application should be built-in with retry methods / retrying if it cannot connect to something / timeout instead of having to implement depends_on in a hacky way.
Since I haven't been able to find help for this I'm going to go with what I outlined above (using PartOf=
) for now. It can always be changed later if someone has a better idea.
Actually, looking at the systemd.unit docs again, it seems I actually want BindsTo=
instead of PartOf=
.
I'm currently developing a new Rust library which does a better job of conforming to the compose-spec. The library can be found at k9withabone/compose_spec_rs. For podlet, it will replace the
docker-compose-types
library currently used.The new library will be completely documented, conform only to the compose-spec, fully parse and validate each part of compose files, and adhere to semantic versioning. That last part is especially important as I plan to turn all the conversion logic of podlet into a library so that it can be used to create a web version of podlet.
This issue is blocked until the
compose_spec
library is ready and published.