orangeqs.juice.orchestration.podman#

Podman utilities.

Module Contents#

Functions#

set_timezone_local

Set the timezone as ‘local’ for all podman containers.

render_container_service

Render the configuration for a podman container service.

render_build_service

Render the configuration for a podman build service.

render_services

Render the configurations of all podman container and build services.

enable_socket

Enable the podman systemd socket.

ensure_network_exists

Ensure that a podman network exists, creating it if necessary.

image_exists

Check whether an image with the given name exists locally.

pending_build_services

Filter the podman build services for which the image does not exist locally.

API#

orangeqs.juice.orchestration.podman.set_timezone_local() None#

Set the timezone as ‘local’ for all podman containers.

This ensures that the timezone inside the containers is the same as the host machine. We do this by setting the TZ environment variable to local for all containers. This is done by creating a podman systemd drop-in file that applies this setting globally.

See: https://man.archlinux.org/man/containers.conf.5.en

orangeqs.juice.orchestration.podman.render_container_service(container: orangeqs.juice.orchestration.settings.ContainerSettings, container_prefix: str, folder: pathlib.Path) str#

Render the configuration for a podman container service.

Overwrites the file if it already exists.

Parameters#

  • container (ContainerSettings): The container settings to render.

  • container_prefix (str): The prefix to use for the container service file.

  • folder (Path): The folder where the service file should be saved.

Returns#

  • (str): The name of the rendered podman container systemd service.

orangeqs.juice.orchestration.podman.render_build_service(build: orangeqs.juice.orchestration.settings.BuildSettings, build_prefix: str, folder: pathlib.Path) str#

Render the configuration for a podman build service.

Overwrites the file if it already exists.

Parameters#

  • build (BuildSettings): The build settings to render.

  • build_prefix (str): The prefix to use for the build service file.

  • folder (Path): The folder where the service file should be saved.

Returns#

  • (str): The name of the rendered podman build systemd service.

orangeqs.juice.orchestration.podman.render_services(settings: orangeqs.juice.orchestration.settings.OrchestrationSettings) tuple[list[str], list[str]]#

Render the configurations of all podman container and build services.

Overwrites the files if they already exist and removes old services that no longer exist in the configuration.

Parameters#

  • settings (JuiceSettings): The Juice settings containing the container configurations.

Returns#

  • (list[str]): A list of container service names of the rendered podman systemd files.

  • (list[str]): A list of build service names of the rendered podman systemd files.

orangeqs.juice.orchestration.podman.enable_socket() None#

Enable the podman systemd socket.

This enables a podman socket that is compatible with the Docker API.

orangeqs.juice.orchestration.podman.ensure_network_exists(name: str) bool#

Ensure that a podman network exists, creating it if necessary.

Parameters#

  • name (str): The name of the podman network.

Returns#

  • (bool): True if the network was created, False if it already exists.

orangeqs.juice.orchestration.podman.image_exists(name: str) bool#

Check whether an image with the given name exists locally.

Parameters#

  • name (str): The image name to check.

Returns#

  • (bool): True if the image exists locally, False otherwise.

orangeqs.juice.orchestration.podman.pending_build_services(build_services: list[str]) list[str]#

Filter the podman build services for which the image does not exist locally.

Parameters#

  • build_services (list[str]): A list of podman build service names to check.

Returns#

  • (list[str]): A list of podman build service names for which the image does not exist locally and needs to be built.