BUILD 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. package(default_visibility = ["//visibility:public"])
  2. load("@io_k8s_repo_infra//defs:deb.bzl", "deb_data", "k8s_deb")
  3. load("@io_k8s_repo_infra//defs:build.bzl", "release_filegroup")
  4. load("@io_k8s_repo_infra//defs:pkg.bzl", "pkg_tar")
  5. load(
  6. "//build:platforms.bzl",
  7. "CLIENT_PLATFORMS",
  8. "NODE_PLATFORMS",
  9. "SERVER_PLATFORMS",
  10. "for_platforms",
  11. )
  12. load("//build:workspace.bzl", "CNI_VERSION", "CRI_TOOLS_VERSION")
  13. # We do not include kube-scheduler, kube-controller-manager,
  14. # kube-apiserver, and kube-proxy in this list even though we
  15. # produce debs for them. We recommend that they be run in docker
  16. # images. We use the debs that we produce here to build those
  17. # images.
  18. release_filegroup(
  19. name = "debs",
  20. conditioned_srcs = for_platforms(
  21. default = [],
  22. for_client = [":kubectl.deb"],
  23. for_node = [
  24. ":cri-tools.deb",
  25. ":kubeadm.deb",
  26. ":kubelet.deb",
  27. ":kubernetes-cni.deb",
  28. ],
  29. only_os = "linux",
  30. ),
  31. )
  32. # Create genrules to copy the arch-specific debs to debs without the arch in their filename.
  33. genrule(
  34. name = "kubectl",
  35. srcs = select(for_platforms(
  36. for_client = [":kubectl-{ARCH}.deb"],
  37. only_os = "linux",
  38. )),
  39. outs = ["kubectl.deb"],
  40. cmd = "cp $< $@",
  41. output_to_bindir = True,
  42. )
  43. [genrule(
  44. name = pkg,
  45. srcs = select(for_platforms(
  46. for_node = [":%s-{ARCH}.deb" % pkg],
  47. only_os = "linux",
  48. )),
  49. outs = ["%s.deb" % pkg],
  50. cmd = "cp $< $@",
  51. output_to_bindir = True,
  52. ) for pkg in [
  53. "cri-tools",
  54. "kubeadm",
  55. "kubelet",
  56. "kubernetes-cni",
  57. ]]
  58. [deb_data(
  59. name = "kubectl",
  60. data = [
  61. {
  62. "files": ["//cmd/kubectl"],
  63. "mode": "0755",
  64. "dir": "/usr/bin",
  65. },
  66. ],
  67. goarch = arch,
  68. tags = ["manual"],
  69. ) for arch in CLIENT_PLATFORMS["linux"]]
  70. [[deb_data(
  71. name = binary,
  72. data = [
  73. {
  74. "files": ["//cmd/" + binary],
  75. "mode": "0755",
  76. "dir": "/usr/bin",
  77. },
  78. ],
  79. goarch = arch,
  80. tags = ["manual"],
  81. ) for binary in [
  82. "cloud-controller-manager",
  83. "kube-apiserver",
  84. "kube-controller-manager",
  85. "kube-proxy",
  86. "kube-scheduler",
  87. ]] for arch in SERVER_PLATFORMS["linux"]]
  88. [deb_data(
  89. name = "kubelet",
  90. data = [
  91. {
  92. "files": ["//cmd/kubelet"],
  93. "mode": "0755",
  94. "dir": "/usr/bin",
  95. },
  96. {
  97. "files": ["kubelet.service"],
  98. "mode": "644",
  99. "dir": "/lib/systemd/system",
  100. },
  101. ],
  102. goarch = arch,
  103. tags = ["manual"],
  104. ) for arch in NODE_PLATFORMS["linux"]]
  105. [deb_data(
  106. name = "kubeadm",
  107. data = [
  108. {
  109. "files": ["//cmd/kubeadm"],
  110. "mode": "0755",
  111. "dir": "/usr/bin",
  112. },
  113. {
  114. "files": ["10-kubeadm.conf"],
  115. "mode": "644",
  116. "dir": "/etc/systemd/system/kubelet.service.d",
  117. },
  118. {
  119. "files": ["kubeadm.conf"],
  120. "mode": "644",
  121. "dir": "/usr/lib/modules-load.d",
  122. },
  123. {
  124. "files": ["50-kubeadm.conf"],
  125. "mode": "644",
  126. "dir": "/etc/sysctl.d",
  127. },
  128. ],
  129. goarch = arch,
  130. tags = ["manual"],
  131. ) for arch in NODE_PLATFORMS["linux"]]
  132. [pkg_tar(
  133. name = "kubernetes-cni-data-%s" % goarch,
  134. package_dir = "/opt/cni/bin",
  135. tags = ["manual"],
  136. deps = ["@kubernetes_cni_%s//file" % goarch],
  137. ) for goarch in NODE_PLATFORMS["linux"]]
  138. [pkg_tar(
  139. name = "cri-tools-data-%s" % goarch,
  140. package_dir = "/usr/bin",
  141. tags = ["manual"],
  142. deps = ["@cri_tools_%s//file" % goarch],
  143. ) for goarch in NODE_PLATFORMS["linux"]]
  144. [k8s_deb(
  145. name = "cloud-controller-manager",
  146. description = "Kubernetes Cloud Controller Manager",
  147. goarch = arch,
  148. tags = ["manual"],
  149. version_file = "//build:os_package_version",
  150. ) for arch in SERVER_PLATFORMS["linux"]]
  151. [k8s_deb(
  152. name = "kubectl",
  153. description = """Kubernetes Command Line Tool
  154. The Kubernetes command line tool for interacting with the Kubernetes API.
  155. """,
  156. goarch = arch,
  157. tags = ["manual"],
  158. version_file = "//build:os_package_version",
  159. ) for arch in CLIENT_PLATFORMS["linux"]]
  160. [k8s_deb(
  161. name = "kube-apiserver",
  162. description = "Kubernetes API Server",
  163. goarch = arch,
  164. tags = ["manual"],
  165. version_file = "//build:os_package_version",
  166. ) for arch in SERVER_PLATFORMS["linux"]]
  167. [k8s_deb(
  168. name = "kube-controller-manager",
  169. description = "Kubernetes Controller Manager",
  170. goarch = arch,
  171. tags = ["manual"],
  172. version_file = "//build:os_package_version",
  173. ) for arch in SERVER_PLATFORMS["linux"]]
  174. [k8s_deb(
  175. name = "kube-scheduler",
  176. description = "Kubernetes Scheduler",
  177. goarch = arch,
  178. tags = ["manual"],
  179. version_file = "//build:os_package_version",
  180. ) for arch in SERVER_PLATFORMS["linux"]]
  181. [k8s_deb(
  182. name = "kube-proxy",
  183. depends = [
  184. "iptables (>= 1.4.21)",
  185. "iproute2",
  186. ],
  187. description = "Kubernetes Service Proxy",
  188. goarch = arch,
  189. tags = ["manual"],
  190. version_file = "//build:os_package_version",
  191. ) for arch in NODE_PLATFORMS["linux"]]
  192. [k8s_deb(
  193. name = "kubelet",
  194. depends = [
  195. "conntrack",
  196. "ebtables",
  197. "ethtool",
  198. "iproute2",
  199. "iptables (>= 1.4.21)",
  200. "kubernetes-cni (>= %s)" % CNI_VERSION,
  201. "mount",
  202. "socat",
  203. "util-linux",
  204. ],
  205. description = """Kubernetes Node Agent
  206. The node agent of Kubernetes, the container cluster manager
  207. """,
  208. goarch = arch,
  209. tags = ["manual"],
  210. version_file = "//build:os_package_version",
  211. ) for arch in NODE_PLATFORMS["linux"]]
  212. [k8s_deb(
  213. name = "kubeadm",
  214. depends = [
  215. "kubelet (>= 1.8.0)",
  216. "kubectl (>= 1.8.0)",
  217. "kubernetes-cni (>= %s)" % CNI_VERSION,
  218. "cri-tools (>= 1.11.0)",
  219. ],
  220. description = """Kubernetes Cluster Bootstrapping Tool
  221. The Kubernetes command line tool for bootstrapping a Kubernetes cluster.
  222. """,
  223. goarch = arch,
  224. postinst = "postinst",
  225. tags = ["manual"],
  226. version_file = "//build:os_package_version",
  227. ) for arch in NODE_PLATFORMS["linux"]]
  228. [k8s_deb(
  229. name = "kubernetes-cni",
  230. description = """Kubernetes Packaging of CNI
  231. The Container Networking Interface tools for provisioning container networks.
  232. """,
  233. goarch = arch,
  234. tags = ["manual"],
  235. version = CNI_VERSION,
  236. ) for arch in NODE_PLATFORMS["linux"]]
  237. [k8s_deb(
  238. name = "cri-tools",
  239. description = """Container Runtime Interface tools (crictl)""",
  240. goarch = arch,
  241. tags = ["manual"],
  242. version = CRI_TOOLS_VERSION,
  243. ) for arch in NODE_PLATFORMS["linux"]]
  244. filegroup(
  245. name = "package-srcs",
  246. srcs = glob(["**"]),
  247. tags = ["automanaged"],
  248. visibility = ["//visibility:private"],
  249. )
  250. filegroup(
  251. name = "all-srcs",
  252. srcs = [":package-srcs"],
  253. tags = ["automanaged"],
  254. )