Skip to content

Commit

Permalink
Merge pull request #1858 from SUSE/kea-dhcp
Browse files Browse the repository at this point in the history
BCI image added for KEA DHCP
  • Loading branch information
dcermak authored Nov 27, 2024
2 parents e8810fb + 2b5c33f commit 38722cd
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/bci_build/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,7 @@ def generate_disk_size_constraints(size_gb: int) -> str:
from .cosign import COSIGN_CONTAINERS # noqa: E402
from .gcc import GCC_CONTAINERS # noqa: E402
from .golang import GOLANG_CONTAINERS # noqa: E402
from .kea import KEA_DHCP_CONTAINERS # noqa: E402
from .kiwi import KIWI_CONTAINERS # noqa: E402
from .mariadb import MARIADB_CLIENT_CONTAINERS # noqa: E402
from .mariadb import MARIADB_CONTAINERS # noqa: E402
Expand Down Expand Up @@ -1524,6 +1525,7 @@ def generate_disk_size_constraints(size_gb: int) -> str:
*TOMCAT_CONTAINERS,
*GCC_CONTAINERS,
*SPACK_CONTAINERS,
*KEA_DHCP_CONTAINERS,
)
}

Expand Down
38 changes: 38 additions & 0 deletions src/bci_build/package/kea.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""KEA DHCP Server BCI container"""

from bci_build.os_version import OsVersion
from bci_build.package import ApplicationStackContainer
from bci_build.package.versions import get_pkg_version

_BASE_PODMAN_KEA_CMD = "podman run --replace -it --privileged --network=host"
_KEA_DHCP4_CONFIG_PATH = "/etc/kea/kea-dhcp4.conf"
_KEA_DHCP6_CONFIG_PATH = "/etc/kea/kea-dhcp6.conf"

KEA_DHCP_CONTAINERS = []
KEA_SUPPORTED_OS_VERSIONS = [
OsVersion.SP7,
OsVersion.TUMBLEWEED,
]

for os_version in KEA_SUPPORTED_OS_VERSIONS:
KEA_DHCP_CONTAINERS.append(
ApplicationStackContainer(
name="kea",
os_version=os_version,
version=get_pkg_version("kea", os_version),
license="MPL-2.0",
is_latest=True,
pretty_name="Kea DHCP Server",
package_list=["kea", "util-linux"],
custom_end="""
RUN mkdir -p /var/run/kea
""",
extra_labels={
"run": f"{_BASE_PODMAN_KEA_CMD} --name kea-dhcp4 -v /etc/kea:/etc/kea IMAGE kea-dhcp4 -c {_KEA_DHCP4_CONFIG_PATH}",
"runcwd": f"{_BASE_PODMAN_KEA_CMD} --name kea-dhcp4 -v .:/etc/kea IMAGE kea-dhcp4 -c {_KEA_DHCP4_CONFIG_PATH}",
"run_dhcp6": f"{_BASE_PODMAN_KEA_CMD} --name kea-dhcp6 -v /etc/kea:/etc/kea IMAGE kea-dhcp6 -c {_KEA_DHCP6_CONFIG_PATH}",
"runcwd_dhcp6": f"{_BASE_PODMAN_KEA_CMD} --name kea-dhcp6 -v .:/etc/kea IMAGE kea-dhcp6 -c {_KEA_DHCP6_CONFIG_PATH}",
},
exposes_ports=["67", "67/udp"],
)
)
44 changes: 44 additions & 0 deletions src/bci_build/package/kea/README.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# {{ image.pretty_name }} Container Image

{% include 'badges.j2' %}

Kea is an open-source DHCP server developed by the [Internet Systems
Consortium](https://www.isc.org/) and the successor of the now deprecated
DHCPd. The Kea distribution includes a DHCPv4 server, a DHCPv6 server, and a
Dynamic DNS (DDNS) server. Significant features include: support for IPv6 prefix
delegation, host reservations (which may be optionally stored in a separate back
end database), Preboot Execution Environment (PXE) boot, client classification,
shared networks, and high-availability (failover pairs). Kea can store leases
locally in a memfile, or in a PostgreSQL or MySQL database. Kea has a supported
API for writing optional extensions, using 'hooks'.

## How to use this Container Image


The container image expects configuration file in the directory `/etc/kea`.
Execute the following command to run DHCP using the configuration provided in the directory `/etc/kea`:

```ShellSession
podman container runlabel run \
{{ image.pretty_reference }}
```
To run a DHCP6 server using the configuration file supplied in the directory `/etc/kea`, execute the following command:

```ShellSession
podman container runlabel run_dhcp6 \
{{ image.pretty_reference }}
```

The Kea configuration file can also be provided in the current working directory.
To run a DHCP or a DHCP6 server using the configuration file in the current working directory, execute the following commands:

```ShellSession
$ # for DHCP
$ podman container runlabel runcwd \
{{ image.pretty_reference }}
$ # for DHCP6
$ podman container runlabel runcwd_dhcp6 \
{{ image.pretty_reference }}
```

{% include 'licensing_and_eula.j2' %}
5 changes: 5 additions & 0 deletions src/bci_build/package/package_versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"Tumbleweed": "3.16",
"version_format": "minor"
},
"kea": {
"7": "2.6",
"Tumbleweed": "2.6",
"version_format": "minor"
},
"mariadb": {
"5": "10.6",
"6": "10.11",
Expand Down

0 comments on commit 38722cd

Please sign in to comment.