Skip to content

Commit

Permalink
BCI images added for KEA DHCP
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmadhankumar authored and Madhankumar committed Nov 14, 2024
1 parent f38a17d commit 6c090a6
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 6 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 @@ -1456,6 +1456,7 @@ def generate_disk_size_constraints(size_gb: int) -> str:
from .basecontainers import MINIMAL_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 @@ -1516,6 +1517,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' %}
17 changes: 11 additions & 6 deletions src/bci_build/package/package_versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,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 All @@ -28,21 +33,21 @@
"version_format": "minor"
},
"pcp": {
"5": "5.2.5",
"5": "6.2.0",
"6": "6.2.0",
"7": "6.2.0",
"Tumbleweed": "6.2.1"
},
"python-kiwi": {
"16.0": "10.1.10",
"16.0": "10.1.16",
"5": "9.24.43",
"6": "9.24.43",
"7": "9.24.43",
"Tumbleweed": "10.1.15"
"Tumbleweed": "10.1.18"
},
"spack": {
"6": "0.21.2",
"7": "0.21.2",
"Tumbleweed": "0.22.1"
"6": "0.21.3",
"7": "0.21.3",
"Tumbleweed": "0.22.2"
}
}

0 comments on commit 6c090a6

Please sign in to comment.