Added Kubernetes to build system
This adds Kubernetes and its dependencies to the WORKSPACE. A small patch
is needed to make this compatible with Bazel 1.0+ since they still use
0.23.
Test Plan:
`bazel test @kubernetes//pkg/...` (:warning: slow)
There is one single test failure with OpenAPI, but I'm not yet sure if it
is actually meaningful since the individual tests of the OpenAPI generated
code pass just fine.
`bazel build @kubernetes//cmd/kube-controller-manager @kubernetes//cmd/kube-scheduler @kubernetes//cmd/kube-apiserver`
All three required binaries for the control plane build just fine
X-Origin-Diff: phab/D237
GitOrigin-RevId: 1c0708272636fb68ca6ced6666f885344bb81a7c
diff --git a/WORKSPACE b/WORKSPACE
index 9a8dd93..ac7e314 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -153,3 +153,25 @@
strip_prefix = "xfsprogs-dev-" + xfsprogs_dev_version,
urls = ["https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/snapshot/xfsprogs-dev-%s.tar.gz" % xfsprogs_dev_version],
)
+
+# Kubernetes
+k8s_version = "1.16.2"
+
+http_archive(
+ name = "kubernetes",
+ patch_args = ["-p1"],
+ patches = [
+ "@//core/build/kubernetes:0001-avoid-unexpected-keyword-error-by-using-positional-p.patch"
+ ],
+ sha256 = "21d884b67abd1182958313474a40678ba8f3713e6b6f520401e42c02ba6ea302",
+ urls = ["https://dl.k8s.io/v%s/kubernetes-src.tar.gz" % k8s_version],
+)
+
+load("@kubernetes//build:workspace_mirror.bzl", "mirror")
+
+http_archive(
+ name = "io_k8s_repo_infra",
+ sha256 = "f6d65480241ec0fd7a0d01f432938b97d7395aeb8eefbe859bb877c9b4eafa56",
+ strip_prefix = "repo-infra-9f4571ad7242bf3ec4b47365062498c2528f9a5f",
+ urls = mirror("https://github.com/kubernetes/repo-infra/archive/9f4571ad7242bf3ec4b47365062498c2528f9a5f.tar.gz"),
+)
\ No newline at end of file
diff --git a/core/build/kubernetes/0001-avoid-unexpected-keyword-error-by-using-positional-p.patch b/core/build/kubernetes/0001-avoid-unexpected-keyword-error-by-using-positional-p.patch
new file mode 100644
index 0000000..5223bee
--- /dev/null
+++ b/core/build/kubernetes/0001-avoid-unexpected-keyword-error-by-using-positional-p.patch
@@ -0,0 +1,47 @@
+Copyright 2020 The Monogon Project Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+From d73ca1c4da53336442d2d256e70ce2acc45e4275 Mon Sep 17 00:00:00 2001
+From: Mostyn Bramley-Moore <mostynb@vewd.com>
+Date: Thu, 17 Oct 2019 14:00:18 +0200
+Subject: [PATCH] avoid unexpected keyword error by using positional parameters
+
+This avoids the following error, when building with bazel 1.0:
+...
+ File "/home/user/kubernetes/build/code_generation.bzl", line 44, in go_pkg
+ pkg.replace("staging/src/", "vendor/", maxsplit ...)
+unexpected keyword 'maxsplit', for call to method replace(old, new, maxsplit = None) of 'string'
+
+Fixes #81382
+---
+ build/code_generation.bzl | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/build/code_generation.bzl b/build/code_generation.bzl
+index eed223eb86..6feef4ba6e 100644
+--- a/build/code_generation.bzl
++++ b/build/code_generation.bzl
+@@ -41,7 +41,7 @@ def go_pkg(pkg):
+ ...
+ )
+ """
+- return go_prefix + "/" + pkg.replace("staging/src/", "vendor/", maxsplit = 1)
++ return go_prefix + "/" + pkg.replace("staging/src/", "vendor/", 1)
+
+ def openapi_deps():
+ deps = [
+--
+2.20.1
+
diff --git a/core/build/kubernetes/BUILD b/core/build/kubernetes/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/core/build/kubernetes/BUILD