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

add CNI_VERSION to build/workspace.bzl, use it to dedupe version #71686

Merged
merged 1 commit into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions build/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ grep ^STABLE_BUILD_SCM_REVISION bazel-out/stable-status.txt \
stamp = 1,
)

genrule(
name = "cni_package_version",
outs = ["cni_version"],
cmd = "echo 0.6.0 >$@",
)

release_filegroup(
name = "docker-artifacts",
srcs = [":%s.tar" % binary for binary in DOCKERIZED_BINARIES.keys()] +
Expand Down
8 changes: 4 additions & 4 deletions build/debs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package(default_visibility = ["//visibility:public"])
load("@io_kubernetes_build//defs:deb.bzl", "k8s_deb", "deb_data")
load("@io_kubernetes_build//defs:build.bzl", "release_filegroup")
load("@io_kubernetes_build//defs:pkg.bzl", "pkg_tar")
load("//build:workspace.bzl", "CRI_TOOLS_VERSION")
load("//build:workspace.bzl", "CNI_VERSION", "CRI_TOOLS_VERSION")

# We do not include kube-scheduler, kube-controller-manager,
# kube-apiserver, and kube-proxy in this list even though we
Expand Down Expand Up @@ -153,7 +153,7 @@ k8s_deb(
"ethtool",
"iproute2",
"iptables (>= 1.4.21)",
"kubernetes-cni (>= 0.6.0)",
"kubernetes-cni (>= %s)" % CNI_VERSION,
"mount",
"socat",
"util-linux",
Expand All @@ -169,7 +169,7 @@ k8s_deb(
depends = [
"kubelet (>= 1.8.0)",
"kubectl (>= 1.8.0)",
"kubernetes-cni (>= 0.6.0)",
"kubernetes-cni (>= %s)" % CNI_VERSION,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the right thing to do? e.g. cri-tools is specifying a different version than CRI_TOOLS, and kubelet/kubectl are quite a bit behind. but maybe those are wrong?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will result in the same value today but de-duped. wether we continue to specify the minimum version or not I'm not sure. IIRC, technically 0.5.0 would function today, just with some reduction in capabilities. I'm not sure how we want to manage this, but so far it seems like we use the version we are shipping.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if we ever want to not require the latest version we test with for a dep like this, we'll change this but for now this reflects reality

"cri-tools (>= 1.11.0)",
],
description = """Kubernetes Cluster Bootstrapping Tool
Expand All @@ -184,7 +184,7 @@ k8s_deb(
description = """Kubernetes Packaging of CNI
The Container Networking Interface tools for provisioning container networks.
""",
version_file = "//build:cni_package_version",
version = CNI_VERSION,
)

k8s_deb(
Expand Down
4 changes: 2 additions & 2 deletions build/root/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
load("//build:workspace_mirror.bzl", "mirror")
load("//build:workspace.bzl", "CRI_TOOLS_VERSION")
load("//build:workspace.bzl", "CNI_VERSION", "CRI_TOOLS_VERSION")

http_archive(
name = "io_bazel_rules_go",
Expand Down Expand Up @@ -58,7 +58,7 @@ http_file(
name = "kubernetes_cni",
downloaded_file_path = "kubernetes_cni.tgz",
sha256 = "f04339a21b8edf76d415e7f17b620e63b8f37a76b2f706671587ab6464411f2d",
urls = mirror("https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v0.6.0.tgz"),
urls = mirror("https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-amd64-v%s.tgz" % CNI_VERSION),
)

http_file(
Expand Down
4 changes: 2 additions & 2 deletions build/rpms/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package(default_visibility = ["//visibility:public"])

load("@bazel_tools//tools/build_defs/pkg:rpm.bzl", "pkg_rpm")
load("//build:workspace.bzl", "CRI_TOOLS_VERSION")
load("//build:workspace.bzl", "CNI_VERSION", "CRI_TOOLS_VERSION")

filegroup(
name = "rpms",
Expand Down Expand Up @@ -66,7 +66,7 @@ pkg_rpm(
],
spec_file = "kubernetes-cni.spec",
tags = ["manual"],
version_file = "//build:cni_package_version",
version = CNI_VERSION,
)

pkg_rpm(
Expand Down
2 changes: 2 additions & 0 deletions build/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
# limitations under the License.

CRI_TOOLS_VERSION = "1.12.0"

CNI_VERSION = "0.6.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this, but being honest... I don't think this should live in bazel.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to decouple bazel from the artifact generation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change just minimizes it down to ~ one place in bazel, which should be strictly better than the n places we had before. It definitely doesn't solve anything else.

It will be easier to derive it from another source later now that it is not hardcoded in many places.
We could have a rule read it in from some other format. Or we can generate deb / rpm with another tool / set of rules or ....

Will leave that up to future PRs. Direction there seems pretty TBD and I'm low on bandwidth atm.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree we're in a better place now rather than before. We could experiment with one central place for ~all well-known deps