1
1
#!/bin/python3
2
- # Copyright 2019 Red Hat
2
+ # Copyright 2020 Red Hat
3
3
#
4
4
# Licensed under the Apache License, Version 2.0 (the "License"); you may
5
5
# not use this file except in compliance with the License. You may obtain
32
32
33
33
environ ["GOPATH" ] = str (BASE_DIR )
34
34
35
- # 2019-09-02T05:32:23Z
36
- ROOTLESSKIT_COMMIT = "182be5f88e62f3568b86331356d237910909b24e"
37
- # 2019-08-30T11:19:53Z
38
- SLIRP4NETNS_COMMIT = "f9503feb2adcd33ad817f954d294f2076de80f45"
39
- # 2019-09-18T18:53:36Z
40
- RUNC_COMMIT = "2186cfa3cd52b8e00b1de76db7859cacdf7b1f94"
41
- # Sat Jan 4 12:13:38 2020
42
- CRIO_COMMIT = "a82ac66f0b89f6caaa1d1a127c0fd7992522a396"
43
- # 2019-09-18T15:12:43Z
44
- CNI_PLUGINS_COMMIT = "497560f35f2cef2695f1690137b0bba98adf849b"
45
- # 2019-09-24T20:37:53Z
46
- KUBERNETES_COMMIT = "948870b5840add1ba4068e3d27d54ea353839992"
47
- CONMON_RELEASE = "v2.0.1"
48
- # Wed Dec 11 19:16:53 2019 tag: v1.6.6
49
- COREDNS_COMMIT = "6a7a75e0cc14159177e604d0157836cc32add343"
50
- # Kube's build script requires KUBE_GIT_VERSION to be set to a semver string
51
- KUBE_GIT_VERSION = "v1.17.0-usernetes"
52
- # 01/23/2017 (v.1.7.3.2)
53
- SOCAT_COMMIT = "cef0e039a89fe3b38e36090d9fe4be000973e0be"
54
-
55
- ETCD_RELEASE = "v3.4.1"
56
- BAZEL_RELEASE = "0.29.1"
35
+ USERNETES_COMMIT = "534df949509da0bfbb9e036688bded3e03533ec2"
36
+ ROOTLESSKIT_COMMIT = "7d4b61b7e0939e63d2d550139ee0ee0a96081b07"
37
+ CRIO_COMMIT = "4dff9dd17d3d27046b3261bd5688581c421334a9"
38
+ KUBERNETES_COMMIT = "v1.21.0-alpha.0"
39
+ SLIRP4NETNS_COMMIT = "v1.1.8"
40
+ CRUN_COMMIT = "0.16"
41
+ CNI_PLUGINS_COMMIT = "v0.8.7"
42
+ CONMON_RELEASE = "v2.0.21"
43
+ COREDNS_COMMIT = "v1.8.0"
44
+ KUBE_GIT_VERSION = "v1.21.0-usernetes"
45
+
46
+ ETCD_RELEASE = "v3.4.14"
47
+ BAZEL_RELEASE = "3.7.1"
57
48
58
49
59
50
def execute (args : List [str ], cwd : Path = Path ("." )) -> None :
@@ -124,13 +115,15 @@ def build_slirp() -> List[Path]:
124
115
return [slirp ]
125
116
126
117
127
- def build_runc () -> List [Path ]:
128
- print ("Building runc" )
129
- git = clone ("https://github.com/opencontainers/runc" , RUNC_COMMIT )
130
- runc = git / "runc"
131
- if not runc .exists ():
132
- execute (["make" , "BUILDTAGS=seccomp selinux" ], git )
133
- return [runc ]
118
+ def build_crun () -> List [Path ]:
119
+ print ("Building crun" )
120
+ git = clone ("https://github.com/containers/crun" , CRUN_COMMIT )
121
+ crun = git / "crun"
122
+ if not crun .exists ():
123
+ execute (["./autogen.sh" ], git )
124
+ execute (["./configure" ], git )
125
+ execute (["make" ], git )
126
+ return [crun ]
134
127
135
128
136
129
def build_crio () -> List [Path ]:
@@ -194,14 +187,45 @@ def build_kube() -> List[Path]:
194
187
)
195
188
execute (["sudo" , "chmod" , "+x" , str (bazel )])
196
189
git = clone ("https://github.com/kubernetes/kubernetes" , KUBERNETES_COMMIT )
197
- kube = git / "bazel-bin" / "cmd" / "hyperkube" / "hyperkube"
198
- if not kube .exists ():
190
+ cmds = ["kubelet" ] + list (
191
+ map (
192
+ lambda n : "kube-" + n ,
193
+ ["apiserver" , "controller-manager" , "scheduler" , "proxy" ],
194
+ )
195
+ )
196
+
197
+ def get_kubes ():
198
+ try :
199
+ return list (
200
+ map (
201
+ lambda cmd : Path (
202
+ glob (
203
+ str (
204
+ git
205
+ / "bazel-out"
206
+ / "k8-fastbuild*"
207
+ / "bin"
208
+ / "cmd"
209
+ / cmd
210
+ / (cmd + "_" )
211
+ / cmd
212
+ )
213
+ )[0 ]
214
+ ),
215
+ cmds ,
216
+ )
217
+ )
218
+ except IndexError :
219
+ return []
220
+
221
+ kubes = get_kubes ()
222
+ if not kubes or not all (map (lambda kube : kube .exists (), kubes )):
199
223
execute ([
"git" ,
"config" ,
"user.email" ,
"[email protected] " ],
git )
200
224
execute (["git" , "config" , "user.name" , "Silverkube Build Script" ], git )
201
225
patches = (
202
226
clone (
203
227
"https://github.com/rootless-containers/usernetes" ,
204
- "d58792bd5d4c56c4dda844ea119ee05a6b0d1808" ,
228
+ USERNETES_COMMIT ,
205
229
)
206
230
/ "src"
207
231
/ "patches"
@@ -215,11 +239,14 @@ def build_kube() -> List[Path]:
215
239
"KUBE_GIT_VERSION=" + KUBE_GIT_VERSION ,
216
240
"bazel" ,
217
241
"build" ,
218
- "cmd/hyperkube" ,
219
- ] ,
242
+ ]
243
+ + list ( map ( lambda cmd : "cmd/" + cmd , cmds )) ,
220
244
git ,
221
245
)
222
- return [kube ]
246
+ kubes = get_kubes ()
247
+ if not kubes :
248
+ raise RuntimeError ("Couldn't find:" + cmds )
249
+ return kubes
223
250
224
251
225
252
def build_etcd () -> List [Path ]:
@@ -251,6 +278,8 @@ def build_etcd() -> List[Path]:
251
278
"automake" ,
252
279
"libtool" ,
253
280
"libcap-devel" ,
281
+ "libslirp-devel" ,
282
+ "yajl-devel" ,
254
283
"glibc-static" ,
255
284
"gcc" ,
256
285
"gcc-c++" ,
@@ -280,7 +309,7 @@ def main():
280
309
bins = (
281
310
build_rootless ()
282
311
+ build_slirp ()
283
- + build_runc ()
312
+ + build_crun ()
284
313
+ build_crio ()
285
314
+ build_conmon ()
286
315
+ build_coredns ()
@@ -291,11 +320,11 @@ def main():
291
320
292
321
specfile = [
293
322
"Name: silverkube" ,
294
- "Version: 0.0.4 " ,
323
+ "Version: 0.1.0 " ,
295
324
"Release: 1%{?dist}" ,
296
325
"Summary: A kubernetes service for desktop" ,
297
326
"" ,
298
- "Requires: iptables, ipset, conntrack-tools, containers-common" ,
327
+ "Requires: iptables, ipset, conntrack-tools, containers-common, kubernetes-client " ,
299
328
"Requires(post): udica" ,
300
329
"Requires(post): coreutils" ,
301
330
"" ,
@@ -306,7 +335,7 @@ def main():
306
335
"Source2: silverkube.cil" ,
307
336
]
308
337
for idx , source in zip (range (100 , 1000 ), bins + cnis ):
309
- src_name = str (source ).replace ( "/root/ .cache/silverkube/", "" )
338
+ src_name = str (source ).split ( " .cache/silverkube/")[ 1 ]
310
339
specfile .append (f"Source{ idx } : { src_name } " )
311
340
312
341
specfile .extend (
@@ -354,7 +383,7 @@ def sd(mode: str, path: str, srcs: List[Path]) -> List[Tuple[str, str]]:
354
383
"/usr/share/silverkube" ,
355
384
"" ,
356
385
"%changelog" ,
357
- "* Sat Sep 21 2019 Tristan Cacqueray <[email protected] >" ,
386
+ "* Mon Dec 14 2020 Tristan Cacqueray <[email protected] >" ,
358
387
"- Initial packaging" ,
359
388
]
360
389
)
0 commit comments