feat(library): Add chronyd 4.8 - #288
Open
vTusharr wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Unikraft library image definition for unikraft.org/chronyd:4.8, packaging chronyd built from source (with HAVE_RECVMMSG removed) plus baked-in configuration and a small Python helper to query NTP sync status.
Changes:
- Introduces a new
chronyd/4.8image build (Dockerfile rootfs + Kraftfile) and static chrony configuration. - Documents build/run instructions and operational notes for running chronyd in a unikernel.
- Adds
test.pyto query the instance and fail until upstream synchronization is complete.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| library/chronyd/4.8/test.py | Adds a Python NTP query helper for validating chronyd responsiveness/sync. |
| library/chronyd/4.8/README.md | Documents how to build/run/query the chronyd unikernel and key notes. |
| library/chronyd/4.8/Kraftfile | Defines the Unikraft build template, kconfig, and runtime command for chronyd. |
| library/chronyd/4.8/Dockerfile | Builds chronyd from source and assembles a minimal scratch rootfs. |
| library/chronyd/4.8/conf/resolv.conf | Provides a static resolver configuration for DNS in the unikernel. |
| library/chronyd/4.8/conf/chrony.conf | Provides a baked-in chronyd configuration for upstream servers and client access. |
| library/chronyd/4.8/.dockerignore | Ignores Unikraft build outputs/config artifacts during image build context. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,40 @@ | |||
| # chrony built from source with HAVE_RECVMMSG removed | |||
| FROM alpine:3.24 AS build | |||
Comment on lines
+7
to
+8
| ADD https://chrony-project.org/releases/chrony-${CHRONY_VERSION}.tar.gz /chrony.tar.gz | ||
| RUN tar xzf /chrony.tar.gz && \ |
Comment on lines
+38
to
+39
| if stratum == 0: | ||
| sys.exit("answering but not synchronized yet, retry shortly") |
Comment on lines
+33
to
+36
| # musl loader (+ libc alias) and nettle, for SECHASH symmetric-key auth | ||
| COPY --from=build /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 | ||
| COPY --from=build /lib/ld-musl-x86_64.so.1 /lib/libc.musl-x86_64.so.1 | ||
| COPY --from=build /usr/lib/libnettle.so.8 /usr/lib/libnettle.so.8 |
Comment on lines
+15
to
+32
| def RequestTimefromNtp(addr="127.0.0.1", port=1123): | ||
| client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
| client.settimeout(5) | ||
| client.sendto(b"\x1b" + 47 * b"\0", (addr, port)) | ||
| data, _ = client.recvfrom(48) | ||
| t = struct.unpack("!12I", data)[10] - REF_TIME_1970 | ||
| stratum = data[1] | ||
| refid = ".".join(str(b) for b in data[12:16]) # selected upstream | ||
| return stratum, refid, time.ctime(t) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| host = sys.argv[1] if len(sys.argv) > 1 else "127.0.0.1" | ||
| port = int(sys.argv[2]) if len(sys.argv) > 2 else 1123 | ||
| try: | ||
| stratum, refid, served = RequestTimefromNtp(host, port) | ||
| except TimeoutError: | ||
| sys.exit(f"no reply from {host}:{port}") |
Add the definition for the `unikraft.org/chronyd:4.8` image, an NTP server running chrony in binary compatibility mode. Signed-off-by: Tushar Verma <tusharVermaiota@proton.me>
Add the build, push and runtime validation workflow for the `unikraft.org/chronyd:4.8` image, and list the image in the top-level README table. Validate the running instance with test.py, which queries the unikernel over NTP and exits non zero until chronyd has selected an upstream source. Signed-off-by: Tushar Verma <tusharVermaiota@proton.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the definition for the
unikraft.org/chronyd:4.8image, an NTP server running chrony in binary compatibility mode.Build chrony from source with
HAVE_RECVMMSGremoved fromconfig.h.Unikraft has no
recvmmsgsyscall and the stock Alpine binary has no runtimefallback, so it busy-loops on a socket it can never drain.
Bake the configuration into the image, since a unikernel has no shell to
generate one at startup.
Run chronyd with
-xso it never adjusts the guest clock, whose set and adjustsyscalls are stub, and adds test.py to query the running instance.