-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from liquidmetal-dev/refactor_difference_images
refactor: split k8s kernel to seperate image
- Loading branch information
Showing
15 changed files
with
216 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Kernel for k8s (CH) - Build and publish | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
working-directory: kernel-k8s-ch | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Login to container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push | ||
run: | | ||
make build | ||
make push |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Kernel for k8s (FC) - Build and publish | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
working-directory: kernel-k8s-fc | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Login to container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push | ||
run: | | ||
make build | ||
make push |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
|
||
defaults: | ||
run: | ||
working-directory: kernel | ||
working-directory: kernel-fc | ||
|
||
jobs: | ||
build-and-publish: | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
FROM ubuntu:22.04 AS builder | ||
|
||
RUN apt-get update -y && \ | ||
apt-get install -y --no-install-recommends \ | ||
bc \ | ||
bison \ | ||
build-essential \ | ||
gcc \ | ||
flex \ | ||
git \ | ||
libelf-dev \ | ||
libncurses-dev \ | ||
libssl-dev \ | ||
ca-certificates \ | ||
kmod \ | ||
curl \ | ||
wget | ||
|
||
ENV SRC_DIR=/usr/src \ | ||
DIST_DIR=/dist \ | ||
LINUX_DIR=/usr/src/linux \ | ||
LINUX_REPO_URL=git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git | ||
|
||
|
||
ARG KERNEL_VERSION | ||
|
||
RUN mkdir -p ${SRC_DIR} ${DIST_DIR} && \ | ||
git clone --depth 1 --branch v${KERNEL_VERSION} ${LINUX_REPO_URL} ${LINUX_DIR} && \ | ||
cd ${LINUX_DIR} | ||
|
||
WORKDIR ${LINUX_DIR} | ||
|
||
ARG KERNEL_CONFIG | ||
|
||
RUN curl -L -o .config ${KERNEL_CONFIG} | ||
|
||
RUN make LOCALVERSION= olddefconfig | ||
RUN make LOCALVERSION= -j32 | ||
|
||
RUN cp vmlinux /boot/vmlinux && \ | ||
cp .config /boot/config-${KERNEL_VERSION} | ||
|
||
FROM scratch | ||
LABEL org.opencontainers.image.source=https://github.com/liquidmetal-dev/mikrolite-images | ||
COPY --from=builder /boot /boot |
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Kernel images | ||
|
||
This creates a kernel image suitable for using with Firecracker. | ||
|
||
A couple of things to note: | ||
|
||
- modules are disabled | ||
- The **microvm-kernel-ci-x86_64-6.1.config** file comes from the supported kernel configs published by Firecracker from [here](https://github.com/firecracker-microvm/firecracker/tree/main/resources/guest_configs). | ||
- The **microvm-kernel-ci-x86_64-6.1.config** is downloaded and shouldn't be modified in any way | ||
|
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM ubuntu:22.04 AS builder | ||
|
||
RUN apt-get update -y && \ | ||
apt-get install -y --no-install-recommends \ | ||
bc \ | ||
bison \ | ||
build-essential \ | ||
gcc \ | ||
flex \ | ||
git \ | ||
libelf-dev \ | ||
libncurses-dev \ | ||
libssl-dev \ | ||
ca-certificates \ | ||
kmod \ | ||
curl \ | ||
wget | ||
|
||
ENV SRC_DIR=/usr/src \ | ||
DIST_DIR=/dist \ | ||
LINUX_DIR=/usr/src/linux \ | ||
LINUX_REPO_URL=git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git | ||
|
||
|
||
ARG KERNEL_VERSION | ||
|
||
RUN mkdir -p ${SRC_DIR} ${DIST_DIR} && \ | ||
git clone --depth 1 --branch v${KERNEL_VERSION} ${LINUX_REPO_URL} ${LINUX_DIR} && \ | ||
cd ${LINUX_DIR} | ||
|
||
WORKDIR ${LINUX_DIR} | ||
|
||
ARG KERNEL_CONFIG | ||
|
||
RUN curl -L -o .config ${KERNEL_CONFIG} | ||
RUN make LOCALVERSION= olddefconfig | ||
COPY k8s_additions.config k8s_additions-fragment | ||
RUN ./scripts/kconfig/merge_config.sh .config k8s_additions-fragment | ||
RUN make LOCALVERSION= -j32 | ||
|
||
RUN mkdir output | ||
RUN cp arch/x86/boot/compressed/vmlinux.bin ./output/vmlinux.bin&& \ | ||
cp .config ./output/config-${KERNEL_VERSION}.0 | ||
|
||
FROM scratch | ||
LABEL org.opencontainers.image.source=https://github.com/liquidmetal-dev/mikrolite-images | ||
COPY --from=builder /usr/src/linux/output /boot |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
REGISTRY?=ghcr.io/liquidmetal-dev | ||
IMAGE?=cloudhypervisor-kernel-k8s | ||
IMAGE_NAME?=$(REGISTRY)/$(IMAGE) | ||
|
||
build: | ||
docker build \ | ||
-t $(IMAGE_NAME):6.2 \ | ||
--build-arg KERNEL_VERSION=6.2 \ | ||
--build-arg KERNEL_CONFIG=https://raw.githubusercontent.com/cloud-hypervisor/cloud-hypervisor/main/resources/linux-config-x86_64 \ | ||
. | ||
|
||
push: | ||
docker push $(IMAGE_NAME):6.2 |
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
REGISTRY?=ghcr.io/liquidmetal-dev | ||
IMAGE?=firecracker-kernel-k8s | ||
IMAGE_NAME?=$(REGISTRY)/$(IMAGE) | ||
|
||
build: | ||
docker build \ | ||
-t $(IMAGE_NAME):6.1 \ | ||
--build-arg KERNEL_VERSION=6.1 \ | ||
--build-arg KERNEL_CONFIG=https://raw.githubusercontent.com/firecracker-microvm/firecracker/main/resources/guest_configs/microvm-kernel-ci-x86_64-6.1.config \ | ||
. | ||
docker build \ | ||
-t $(IMAGE_NAME):5.10 \ | ||
--build-arg KERNEL_VERSION=5.10.199 \ | ||
--build-arg KERNEL_CONFIG=https://raw.githubusercontent.com/firecracker-microvm/firecracker/afe0e5f6469f2d804643be0cc0cef53c9d1c4f5d/resources/guest_configs/microvm-kernel-ci-x86_64-5.10.config \ | ||
. | ||
|
||
push: | ||
docker push $(IMAGE_NAME):6.1 | ||
docker push $(IMAGE_NAME):5.10 |
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
CONFIG_NETFILTER=y | ||
CONFIG_NETFILTER_ADVANCED=y | ||
CONFIG_NETFILTER_XT_TARGET_REDIRECT=y | ||
CONFIG_NETFILTER_XT_MATCH_COMMENT=y | ||
CONFIG_NETFILTER_XT_TARGET_MARK=y | ||
CONFIG_IP_SET=y | ||
CONFIG_NF_CONNTRACK=y | ||
CONFIG_NF_CONNTRACK_MARK=y | ||
CONFIG_NF_CONNTRACK_SECMARK=y | ||
CONFIG_NF_CONNTRACK_PROCFS=y | ||
CONFIG_NF_NAT=y | ||
CONFIG_NF_NAT_REDIRECT=y | ||
CONFIG_NF_NAT_MASQUERADE=y | ||
CONFIG_NETFILTER_XTABLES=y | ||
CONFIG_KEYS=y | ||
CONFIG_IP_NF_TARGET_MASQUERADE=y | ||
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y | ||
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y | ||
CONFIG_NETFILTER_XT_MATCH_IPVS=y | ||
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y | ||
CONFIG_IP_NF_NAT=y | ||
CONFIG_IP_VS=y | ||
CONFIG_BRIDGE=y |