Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Add support for etcd 3.3.17
Browse files Browse the repository at this point in the history
  • Loading branch information
rifelpet committed Mar 26, 2020
1 parent 7e4cb19 commit f694856
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
11 changes: 11 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ gazelle(
"etcdctl",
]]

[genrule(
name = "etcd-v3.3.17-linux-amd64_%s" % c,
srcs = ["@etcd_3_3_17_tar//file"],
outs = ["etcd-v3.3.17-linux-amd64/%s" % c],
cmd = "tar -x -z --no-same-owner -f ./$(location @etcd_3_3_17_tar//file) etcd-v3.3.17-linux-amd64/%s && mv etcd-v3.3.17-linux-amd64/%s \"$@\"" % (c, c),
visibility = ["//visibility:public"],
) for c in [
"etcd",
"etcdctl",
]]

[genrule(
name = "etcd-v3.4.3-linux-amd64_%s" % c,
srcs = ["@etcd_3_4_3_tar//file"],
Expand Down
6 changes: 6 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ http_file(
urls = ["https://github.com/coreos/etcd/releases/download/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz"],
)

http_file(
name = "etcd_3_3_17_tar",
sha256 = "8c1168a24d17a2d6772f8148ea35d4f3398c51f1e23db90c849d506adb387060",
urls = ["https://github.com/coreos/etcd/releases/download/v3.3.17/etcd-v3.3.17-linux-amd64.tar.gz"],
)

http_file(
name = "etcd_3_4_3_tar",
sha256 = "6c642b723a86941b99753dff6c00b26d3b033209b15ee33325dc8e7f4cd68f07",
Expand Down
12 changes: 12 additions & 0 deletions images/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ container_layer(
],
)

# Layer for etcd 3.3.17, updated recommendation for k8s 1.16.3 and later
container_layer(
name = "etcd-3-3-17-layer",
directory = "/opt/etcd-v3.3.17-linux-amd64/",
files = [
"//:etcd-v3.3.17-linux-amd64_etcdctl",
"//:etcd-v3.3.17-linux-amd64_etcd",
],
)

# Layer for etcd 3.4.3, updated recommendation for k8s 1.17 and later
container_layer(
name = "etcd-3-4-3-layer",
Expand All @@ -96,6 +106,8 @@ container_image(
"etcd-3-2-24-layer",
"etcd-3-3-10-layer",
"etcd-3-3-13-layer",
"etcd-3-3-15-layer",
"etcd-3-3-17-layer",
"etcd-3-4-3-layer",
],
)
Expand Down
10 changes: 8 additions & 2 deletions pkg/etcdversions/mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (
Version_3_2_24 = "3.2.24"
Version_3_3_10 = "3.3.10"
Version_3_3_13 = "3.3.13"
Version_3_3_17 = "3.3.17"
Version_3_4_3 = "3.4.3"
)

Expand All @@ -27,6 +28,7 @@ var AllEtcdVersions = []string{
Version_3_2_24,
Version_3_3_10,
Version_3_3_13,
Version_3_3_17,
Version_3_4_3,
}

Expand Down Expand Up @@ -100,8 +102,10 @@ func EtcdVersionForAdoption(fromVersion string) string {
case "3.3":
if fromSemver.Patch <= 10 {
return Version_3_3_10
} else {
} else if fromSemver.Patch <= 13 {
return Version_3_3_13
} else {
return Version_3_3_17
}
case "3.4":
return Version_3_4_3
Expand Down Expand Up @@ -134,8 +138,10 @@ func EtcdVersionForRestore(fromVersion string) string {
case "3.3":
if fromSemver.Patch <= 10 {
return Version_3_3_10
} else {
} else if fromSemver.Patch <= 13 {
return Version_3_3_13
} else {
return Version_3_3_17
}
case "3.4":
return Version_3_4_3
Expand Down
2 changes: 2 additions & 0 deletions test/integration/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ go_test(
"//:etcd-v3.3.10-linux-amd64_etcdctl",
"//:etcd-v3.3.13-linux-amd64_etcd",
"//:etcd-v3.3.13-linux-amd64_etcdctl",
"//:etcd-v3.3.17-linux-amd64_etcd",
"//:etcd-v3.3.17-linux-amd64_etcdctl",
"//:etcd-v3.4.3-linux-amd64_etcd",
"//:etcd-v3.4.3-linux-amd64_etcdctl",
],
Expand Down

0 comments on commit f694856

Please sign in to comment.