Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NO-ISSUE: okd: Add step to embed all component images to final image #4376

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions okd/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
```bash
cd ~/microshift && sudo podman build --env WITH_FLANNEL=1 -f okd/src/microshift-okd-multi-build.Containerfile . -t microshift-okd
```
To embed all component images
```bash
cd ~/microshift && sudo podman build --env EMBED_CONTAINER_IMAGES=1 -f okd/src/microshift-okd-multi-build.Containerfile . -t microshift-okd
```
- build runnable container based on current source:
1. replace microshift assets images to OKD upstream images
1. will build microshift RPMs and repo based on current sources.
Expand Down
16 changes: 15 additions & 1 deletion okd/src/microshift-okd-multi-build.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ RUN dnf install -y centos-release-nfv-openvswitch && \
# once microshift is installed so better to disable it because it cause issue when required
# module is not enabled.
RUN ${REPO_CONFIG_SCRIPT} ${USHIFT_RPM_REPO_PATH} && \
dnf install -y microshift && \
dnf install -y microshift microshift-release-info && \
if [ "$WITH_FLANNEL" -eq 1 ]; then \
dnf install -y microshift-flannel; \
systemctl disable openvswitch; \
Expand All @@ -60,6 +60,20 @@ RUN ${REPO_CONFIG_SCRIPT} ${USHIFT_RPM_REPO_PATH} && \

RUN ${OKD_CONFIG_SCRIPT} && rm -rf ${OKD_CONFIG_SCRIPT}

# If the EMBED_CONTAINER_IMAGES environment variable is set to 1:
# 1. Temporarily configure user namespace UID and GID mappings by writing to /etc/subuid and /etc/subgid and clean it later
# - This allows the skopeo command to operate properly which requires user namespace support.
# - Without it following error occur during image build
# - FATA[0129] copying system image from manifest list:[...]unpacking failed (error: exit status 1; output: potentially insufficient UIDs or GIDs available[...]
# 2. Extract the list of image URLs from a JSON file (`release-$(uname -m).json`) while excluding the "lvms_operator" image.
# - `lvms_operator` image is excluded because it is not available upstream
RUN if [ "$EMBED_CONTAINER_IMAGES" -eq 1 ]; then \
echo "root:100000:65536" > /etc/subuid; \
echo "root:100000:65536" > /etc/subgid; \
jq -r '.images | to_entries | map(select(.key != "lvms_operator")) | .[].value' /usr/share/microshift/release/release-$(uname -m).json | xargs -n 1 -I {} skopeo copy docker://{} containers-storage:{}; \
rm -f /etc/subuid /etc/subgid; \
fi

# Create a systemd unit to recursively make the root filesystem subtree
# shared as required by OVN images
COPY ./packaging/imagemode/systemd/microshift-make-rshared.service /etc/systemd/system/microshift-make-rshared.service
Expand Down