-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsysbox-pkgr-0.patch
242 lines (220 loc) · 9.45 KB
/
sysbox-pkgr-0.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
diff --git a/k8s/Makefile b/k8s/Makefile
index 4c7116f..fc39113 100644
--- a/k8s/Makefile
+++ b/k8s/Makefile
@@ -3,8 +3,8 @@
#
.PHONY: sysbox-deploy-k8s-image \
- fetch_sysbox_ce_bins \
- fetch_sysbox_ee_bins \
+ fetch-sysbox-ce-bins \
+ fetch-sysbox-ce-rpm-bins \
check-sysbox-artifacts \
check-crio-artifacts \
clean-sysbox-ce clean-crio clean
@@ -28,7 +28,8 @@ SYSBOX_BINS = sysbox-runc sysbox-mgr sysbox-fs
# SYSBOX_CE_VER_SEMVER = 0.6.3
# SYSBOX_CE_VER_FULL = 0.6.3-1
#
-SYSBOX_CE_VER = $(shell cat ../sources/sysbox/VERSION)
+SYSBOX_CE_VER_KARELLEN ?= $(shell cd ../../.. && git tag --points-at HEAD | sed 's/karellen-sysbox-//')
+SYSBOX_CE_VER ?= $(shell cat ../../VERSION)
SYSBOX_CE_VER_SEMVER = $(shell echo $(SYSBOX_CE_VER) | cut -d"-" -f1)
SYSBOX_CE_VER_FULL = $(shell echo $(SYSBOX_CE_VER) | sed '/-[0-9]/!s/.*/&-0/')
@@ -58,6 +59,11 @@ else ifeq ($(UNAME_M),armel)
SYS_ARCH := armel
endif
+ifeq ($(GITHUB_ACTIONS),true)
+ ARCH_TAG := -$(SYS_ARCH)
+else
+ ARCH_TAG := ""
+endif
#
# Sysbox artifacts for Ubuntu distro
#
@@ -79,6 +85,22 @@ fetch-sysbox-ce-bins:
cp $(TMPDIR)/sysbox-ce-generic/usr/bin/sysbox-* bin/sysbox-ce/generic/.
rm -rf $(TMPDIR)
+fetch-sysbox-ce-rpm-bins:
+ $(eval TMPDIR := $(shell mktemp -d))
+ @echo "TMPDIR = $(TMPDIR)"
+ set -e; for distro in $(shell curl -sL https://api.github.com/repos/karellen/karellen-sysbox/releases/tags/karellen-sysbox-$(SYSBOX_CE_VER_KARELLEN) | \
+ jq -r '.assets[] | .browser_download_url' | grep -E '/centos-stream-|/epel|/fedora|/amazonlinux' | grep $(UNAME_M)); do \
+ distro_dir=$$(basename $$distro | sed 's/-karellen-sysbox.*//'); \
+ echo $$distro_dir; \
+ mkdir -p $(TMPDIR)/sysbox-ce-$$distro_dir; \
+ curl -sL "$$distro" | rpm2cpio - | cpio -idmv -D $(TMPDIR)/sysbox-ce-$$distro_dir; \
+ mkdir -p bin/sysbox-ce/$$distro_dir; \
+ rm -rf bin/sysbox-ce/$$distro_dir/*; \
+ cp $(TMPDIR)/sysbox-ce-$$distro_dir/usr/bin/sysbox-* bin/sysbox-ce/$$distro_dir/. ; \
+ done
+ rm -rf $(TMPDIR)
+
+
#
# CRI-O artifacts (only built if not already present at ./bin/crio)
#
@@ -135,11 +157,21 @@ check-crio-artifacts:
all: sysbox-deploy-k8s-image
-sysbox-deploy-k8s-image: build-crio check-crio-artifacts fetch-sysbox-ce-bins check-sysbox-artifacts
- docker build -t ghcr.io/nestybox/sysbox-deploy-k8s:v$(SYSBOX_CE_VER_FULL)$(SYSBOX_DEPLOY_K8S_IMAGE_PATCH) \
+sysbox-deploy-k8s-image: build-crio check-crio-artifacts fetch-sysbox-ce-bins fetch-sysbox-ce-rpm-bins check-sysbox-artifacts
+ set -e; \
+ if [ -n "$${GITHUB_ACTIONS}" ] && [ -n "$$GITHUB_OUTPUT" ]; then \
+ echo "SYSBOX_CE_VER_FULL=$(SYSBOX_CE_VER_FULL)" >> "$$GITHUB_OUTPUT"; \
+ echo "SYSBOX_CE_VER_KARELLEN=$(SYSBOX_CE_VER_KARELLEN)" >> "$$GITHUB_OUTPUT"; \
+ echo "SYSBOX_DEPLOY_K8S_IMAGE_PATCH=$(SYSBOX_DEPLOY_K8S_IMAGE_PATCH)" >> "$$GITHUB_OUTPUT"; \
+ fi
+ docker build -t ghcr.io/karellen/sysbox-deploy-k8s:v$(SYSBOX_CE_VER_FULL)$(SYSBOX_DEPLOY_K8S_IMAGE_PATCH)$(ARCH_TAG) \
--build-arg sys_arch=$(SYS_ARCH) \
--build-arg sysbox_version=v$(SYSBOX_CE_VER_FULL) \
-f Dockerfile.sysbox-ce .
+ set -e; \
+ if [ -n "$${GITHUB_ACTIONS}" ]; then \
+ docker push ghcr.io/karellen/sysbox-deploy-k8s:v$(SYSBOX_CE_VER_FULL)$(SYSBOX_DEPLOY_K8S_IMAGE_PATCH)$(ARCH_TAG); \
+ fi
#
# Cleanup targets
diff --git a/k8s/manifests/daemonset/sysbox-cleanup-k8s.yaml b/k8s/manifests/daemonset/sysbox-cleanup-k8s.yaml
index f4b23bb..4387df2 100644
--- a/k8s/manifests/daemonset/sysbox-cleanup-k8s.yaml
+++ b/k8s/manifests/daemonset/sysbox-cleanup-k8s.yaml
@@ -18,7 +18,7 @@ spec:
sysbox-runtime: running
containers:
- name: sysbox-cleanup-k8s
- image: registry.nestybox.com/nestybox/sysbox-deploy-k8s
+ image: ghcr.io/karellen/sysbox-deploy-k8s
imagePullPolicy: Always
command: [ "bash", "-c", "/opt/sysbox/scripts/sysbox-deploy-k8s.sh ce cleanup" ]
env:
diff --git a/k8s/manifests/daemonset/sysbox-deploy-k8s.yaml b/k8s/manifests/daemonset/sysbox-deploy-k8s.yaml
index 1afc943..bdfe9fe 100644
--- a/k8s/manifests/daemonset/sysbox-deploy-k8s.yaml
+++ b/k8s/manifests/daemonset/sysbox-deploy-k8s.yaml
@@ -18,7 +18,7 @@ spec:
sysbox-install: "yes"
containers:
- name: sysbox-deploy-k8s
- image: registry.nestybox.com/nestybox/sysbox-deploy-k8s
+ image: ghcr.io/karellen/sysbox-deploy-k8s
imagePullPolicy: Always
command: [ "bash", "-c", "/opt/sysbox/scripts/sysbox-deploy-k8s.sh ce install" ]
env:
diff --git a/k8s/scripts/sysbox-deploy-k8s.sh b/k8s/scripts/sysbox-deploy-k8s.sh
index 0ebacce..d18fd23 100755
--- a/k8s/scripts/sysbox-deploy-k8s.sh
+++ b/k8s/scripts/sysbox-deploy-k8s.sh
@@ -271,7 +271,8 @@ function get_artifacts_dir() {
local distro=$os_distro_release
- if [[ "$distro" == "ubuntu-22.04" ]] ||
+ if [[ "$distro" == "ubuntu-24.04" ]] ||
+ [[ "$distro" == "ubuntu-22.04" ]] ||
[[ "$distro" == "ubuntu-21.10" ]] ||
[[ "$distro" == "ubuntu-20.04" ]] ||
[[ "$distro" == "ubuntu-18.04" ]] ||
@@ -280,8 +281,21 @@ function get_artifacts_dir() {
elif [[ "$distro" =~ "flatcar" ]]; then
local release=$(echo $distro | cut -d"-" -f2)
artifacts_dir="${sysbox_artifacts}/bin/flatcar-${release}"
- else
- die "Sysbox is not supported on this host's distro ($distro)".
+ elif [[ "$distro" =~ "fedora" ]]; then
+ artifacts_dir="${sysbox_artifacts}/bin/$distro"
+ elif [[ "$distro" =~ "centos" ]]; then
+ local release=$(echo $distro | cut -d"-" -f2)
+ artifacts_dir="${sysbox_artifacts}/bin/centos-stream-$release"
+ elif [[ "$distro" =~ "rhel" ]]; then
+ local release=$(echo $distro | cut -d"-" -f2 | cut -d"." -f1)
+ artifacts_dir="${sysbox_artifacts}/bin/epel-$release"
+ elif [[ "$distro" =~ "amzn" ]]; then
+ local release=$(echo $distro | cut -d"-" -f2)
+ artifacts_dir="${sysbox_artifacts}/bin/amazonlinux-$release"
+ fi
+
+ if [[ -z "$artifacts_dir" ]] || [[ ! -d "$artifacts_dir" ]]; then
+ die "Sysbox is not supported on this host's distro ($distro): $artifacts_dir".
fi
echo $artifacts_dir
@@ -330,11 +344,11 @@ function config_sysbox_env() {
# Update Sysbox's systemd unit files with the received configMap configuration
# corresponding to the sysbox-mgr and sysbox-fs services.
function config_sysbox() {
- if [ -n "$SYSBOX_MGR_CONFIG" ]; then
+ if [ -n "${SYSBOX_MGR_CONFIG:-}" ]; then
sed -i "/^ExecStart=/ s|/usr/bin/sysbox-mgr|/usr/bin/sysbox-mgr ${SYSBOX_MGR_CONFIG}|" ${sysbox_artifacts}/systemd/sysbox-mgr.service
fi
- if [ -n "$SYSBOX_FS_CONFIG" ]; then
+ if [ -n "${SYSBOX_FS_CONFIG:-}" ]; then
sed -i "/^ExecStart=/ s|/usr/bin/sysbox-fs|/usr/bin/sysbox-fs ${SYSBOX_FS_CONFIG}|" ${sysbox_artifacts}/systemd/sysbox-fs.service
fi
}
@@ -742,12 +756,17 @@ function is_supported_distro() {
local distro=$os_distro_release
- if [[ "$distro" == "ubuntu-22.04" ]] ||
+ if [[ "$distro" == "ubuntu-24.04" ]] ||
+ [[ "$distro" == "ubuntu-22.04" ]] ||
[[ "$distro" == "ubuntu-21.10" ]] ||
[[ "$distro" == "ubuntu-20.04" ]] ||
[[ "$distro" == "ubuntu-18.04" ]] ||
[[ "$distro" =~ "debian" ]] ||
- [[ "$distro" =~ "flatcar" ]]; then
+ [[ "$distro" =~ "flatcar" ]] ||
+ [[ "$distro" =~ "fedora" ]] ||
+ [[ "$distro" =~ "centos" ]] ||
+ [[ "$distro" =~ "amzn" ]] ||
+ [[ "$distro" =~ "rhel" ]]; then
return
fi
@@ -871,8 +890,8 @@ function is_sysbox_config_changed() {
sysbox_fs_config=$(cat ${host_var_lib_sysbox_deploy_k8s}/sysbox_fs_config)
fi
- if [ "$sysbox_mgr_config" != "$SYSBOX_MGR_CONFIG" ] || [ "$sysbox_fs_config" != "$SYSBOX_FS_CONFIG" ]; then
- echo "Sysbox operational settings have changed -- sysbox-mgr: ${SYSBOX_MGR_CONFIG}, sysbox-fs: ${SYSBOX_FS_CONFIG}"
+ if [ "$sysbox_mgr_config" != "${SYSBOX_MGR_CONFIG:-}" ] || [ "$sysbox_fs_config" != "${SYSBOX_FS_CONFIG:-}" ]; then
+ echo "Sysbox operational settings have changed -- sysbox-mgr: ${SYSBOX_MGR_CONFIG:-}, sysbox-fs: ${SYSBOX_FS_CONFIG:-}"
return 0
fi
diff --git a/k8s/scripts/sysbox-installer-helper.sh b/k8s/scripts/sysbox-installer-helper.sh
index 6c8a3de..1bf6f3e 100755
--- a/k8s/scripts/sysbox-installer-helper.sh
+++ b/k8s/scripts/sysbox-installer-helper.sh
@@ -86,14 +86,25 @@ function semver_ge() {
}
function install_package_deps() {
+ DNF="$(which dnf 2>/dev/null || true)"
+ YUM="$(which yum 2>/dev/null || true)"
- # Need this to work-around "E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem."
- dpkg --configure -a
+ if [ -n "$DNF" ] || [ -n "$YUM" ]; then
+ if [ -n "$DNF" ]; then
+ YUM=""
+ fi
+ DNF="$DNF$YUM" # Either YUM is empty or DNF is not present
+
+ $DNF install -y rsync fuse iptables-nft
+ else
+ # Need this to work-around "E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem."
+ dpkg --configure -a
- # Certificates package is required prior to running apt-update.
- apt-get -y install ca-certificates
- apt-get update
- apt-get install -y rsync fuse iptables
+ # Certificates package is required prior to running apt-update.
+ apt-get -y install ca-certificates
+ apt-get update
+ apt-get install -y rsync fuse iptables
+ fi
}
function install_shiftfs() {
diff --git a/k8s/systemd/99-sysbox-sysctl.conf b/k8s/systemd/99-sysbox-sysctl.conf
index ce903bc..5177a58 100644
--- a/k8s/systemd/99-sysbox-sysctl.conf
+++ b/k8s/systemd/99-sysbox-sysctl.conf
@@ -1,7 +1,7 @@
# Sysbox's sysctl.d requirements
# Enable user-namespaces in kernel.
-kernel.unprivileged_userns_clone = 1
+# kernel.unprivileged_userns_clone = 1
# Increase default "inotify" kernel resources for scaling purposes.
fs.inotify.max_queued_events = 1048576