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 committed Oct 17, 2024
1 parent fe14e57 commit c1ab59c
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bci_build/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,8 @@ def generate_disk_size_constraints(size_gb: int) -> str:
from .ruby import RUBY_CONTAINERS # noqa: E402
from .rust import RUST_CONTAINERS # noqa: E402
from .spack import SPACK_CONTAINERS # noqa: E402
from .keadhcp import KEA_DHCP_CONTAINERS # noqa: E402


ALL_CONTAINER_IMAGE_NAMES: dict[str, BaseContainerImage] = {
f"{bci.uid}-{bci.os_version.pretty_print.lower()}": bci
Expand Down Expand Up @@ -1517,6 +1519,7 @@ def generate_disk_size_constraints(size_gb: int) -> str:
*TOMCAT_CONTAINERS,
*GCC_CONTAINERS,
*SPACK_CONTAINERS,
*KEA_DHCP_CONTAINERS,
)
}

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

from bci_build.os_version import ALL_NONBASE_OS_VERSIONS
from bci_build.os_version import CAN_BE_LATEST_OS_VERSION
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 = []

for os_version in ALL_NONBASE_OS_VERSIONS:
KEA_DHCP_CONTAINERS.append(
ApplicationStackContainer(
name="kea",
os_version=os_version,
tag_version=get_pkg_version("keadhcp", os_version),
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
pretty_name="Kea DHCP Server Container",
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}",
},
)
)
33 changes: 33 additions & 0 deletions src/bci_build/package/keadhcp/README.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# KEA DHCP Container

This is an openSUSE Base Container Image for DHCP server

## How to use this container image

The container image expects dhcp configuration file in the path /etc/kea.
To run dhcp4 for the configuration provided in the directory /etc/kea

```ShellSession
podman container runlabel run \
{{ image.pretty_reference }}
```
To run dhcp6 for the configuration provided in the directory /etc/kea

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

Dhcp configuration file can also be provided in the current directory.
To run dhcp4 for the configuration provided in the current directory

```ShellSession
podman container runlabel runcwd \
{{ image.pretty_reference }}
```
To run dhcp6 for the configuration provided in the current directory

```ShellSession
podman container runlabel runcwd_dhcp6 \
{{ image.pretty_reference }}
```
6 changes: 6 additions & 0 deletions src/bci_build/package/package_versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,11 @@
"6": "0.21.2",
"7": "0.21.2",
"Tumbleweed": "0.22.1"
},
"keadhcp":{
"6": "2.6.1",
"7": "2.6.1",
"Tumbleweed": "2.6.1",
"version_format": "minor"
}
}

0 comments on commit c1ab59c

Please sign in to comment.