From 23d9d6b1d0f835d7b342773149ded2c89c6b4507 Mon Sep 17 00:00:00 2001 From: wojtekt Date: Tue, 2 Jul 2019 09:28:02 +0200 Subject: [PATCH] Move etcd/util to etcd3/ --- hack/.golint_failures | 1 - pkg/registry/core/rest/BUILD | 2 +- pkg/registry/core/rest/storage_core.go | 4 +-- .../src/k8s.io/apiserver/pkg/storage/BUILD | 1 - .../k8s.io/apiserver/pkg/storage/etcd/BUILD | 26 -------------- .../k8s.io/apiserver/pkg/storage/etcd/OWNERS | 27 -------------- .../k8s.io/apiserver/pkg/storage/etcd/doc.go | 17 --------- .../apiserver/pkg/storage/etcd/util/BUILD | 36 ------------------- .../apiserver/pkg/storage/etcd/util/doc.go | 19 ---------- .../k8s.io/apiserver/pkg/storage/etcd3/BUILD | 2 ++ .../etcd_util.go => etcd3/healthcheck.go} | 4 ++- .../healthcheck_test.go} | 2 +- vendor/modules.txt | 1 - 13 files changed, 9 insertions(+), 133 deletions(-) delete mode 100644 staging/src/k8s.io/apiserver/pkg/storage/etcd/BUILD delete mode 100644 staging/src/k8s.io/apiserver/pkg/storage/etcd/OWNERS delete mode 100644 staging/src/k8s.io/apiserver/pkg/storage/etcd/doc.go delete mode 100644 staging/src/k8s.io/apiserver/pkg/storage/etcd/util/BUILD delete mode 100644 staging/src/k8s.io/apiserver/pkg/storage/etcd/util/doc.go rename staging/src/k8s.io/apiserver/pkg/storage/{etcd/util/etcd_util.go => etcd3/healthcheck.go} (86%) rename staging/src/k8s.io/apiserver/pkg/storage/{etcd/util/etcd_util_test.go => etcd3/healthcheck_test.go} (98%) diff --git a/hack/.golint_failures b/hack/.golint_failures index 8ef17efd06c..30da8127600 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -455,7 +455,6 @@ staging/src/k8s.io/apiserver/pkg/server/httplog staging/src/k8s.io/apiserver/pkg/server/options staging/src/k8s.io/apiserver/pkg/server/storage staging/src/k8s.io/apiserver/pkg/storage -staging/src/k8s.io/apiserver/pkg/storage/etcd/util staging/src/k8s.io/apiserver/pkg/storage/etcd3/testing/testingcert staging/src/k8s.io/apiserver/pkg/storage/storagebackend staging/src/k8s.io/apiserver/pkg/storage/testing diff --git a/pkg/registry/core/rest/BUILD b/pkg/registry/core/rest/BUILD index bb579e1c0de..44e268ca679 100644 --- a/pkg/registry/core/rest/BUILD +++ b/pkg/registry/core/rest/BUILD @@ -56,7 +56,7 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/registry/rest:go_default_library", "//staging/src/k8s.io/apiserver/pkg/server:go_default_library", "//staging/src/k8s.io/apiserver/pkg/server/storage:go_default_library", - "//staging/src/k8s.io/apiserver/pkg/storage/etcd/util:go_default_library", + "//staging/src/k8s.io/apiserver/pkg/storage/etcd3:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/rest:go_default_library", diff --git a/pkg/registry/core/rest/storage_core.go b/pkg/registry/core/rest/storage_core.go index fd7466e468d..a8c8c765ab4 100644 --- a/pkg/registry/core/rest/storage_core.go +++ b/pkg/registry/core/rest/storage_core.go @@ -34,7 +34,7 @@ import ( "k8s.io/apiserver/pkg/registry/rest" genericapiserver "k8s.io/apiserver/pkg/server" serverstorage "k8s.io/apiserver/pkg/server/storage" - etcdutil "k8s.io/apiserver/pkg/storage/etcd/util" + "k8s.io/apiserver/pkg/storage/etcd3" utilfeature "k8s.io/apiserver/pkg/util/feature" policyclient "k8s.io/client-go/kubernetes/typed/policy/v1beta1" restclient "k8s.io/client-go/rest" @@ -284,7 +284,7 @@ func (s componentStatusStorage) serversToValidate() map[string]*componentstatus. TLSConfig: machine.TLSConfig, Port: port, Path: "/health", - Validate: etcdutil.EtcdHealthCheck, + Validate: etcd3.EtcdHealthCheck, } } return serversToValidate diff --git a/staging/src/k8s.io/apiserver/pkg/storage/BUILD b/staging/src/k8s.io/apiserver/pkg/storage/BUILD index 4ed7f4bea17..71d0bbc900e 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/BUILD +++ b/staging/src/k8s.io/apiserver/pkg/storage/BUILD @@ -57,7 +57,6 @@ filegroup( ":package-srcs", "//staging/src/k8s.io/apiserver/pkg/storage/cacher:all-srcs", "//staging/src/k8s.io/apiserver/pkg/storage/errors:all-srcs", - "//staging/src/k8s.io/apiserver/pkg/storage/etcd:all-srcs", "//staging/src/k8s.io/apiserver/pkg/storage/etcd3:all-srcs", "//staging/src/k8s.io/apiserver/pkg/storage/names:all-srcs", "//staging/src/k8s.io/apiserver/pkg/storage/storagebackend:all-srcs", diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd/BUILD b/staging/src/k8s.io/apiserver/pkg/storage/etcd/BUILD deleted file mode 100644 index 1439167ee22..00000000000 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd/BUILD +++ /dev/null @@ -1,26 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = ["doc.go"], - importmap = "k8s.io/kubernetes/vendor/k8s.io/apiserver/pkg/storage/etcd", - importpath = "k8s.io/apiserver/pkg/storage/etcd", -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [ - ":package-srcs", - "//staging/src/k8s.io/apiserver/pkg/storage/etcd/util:all-srcs", - ], - tags = ["automanaged"], -) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd/OWNERS b/staging/src/k8s.io/apiserver/pkg/storage/etcd/OWNERS deleted file mode 100644 index bb4ad2a4caf..00000000000 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd/OWNERS +++ /dev/null @@ -1,27 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners - -reviewers: -- lavalamp -- smarterclayton -- wojtek-t -- deads2k -- derekwaynecarr -- caesarxuchao -- mikedanese -- liggitt -- davidopp -- pmorie -- luxas -- janetkuo -- roberthbailey -- tallclair -- timothysc -- dims -- hongchaodeng -- krousey -- fgrzadkowski -- resouer -- pweil- -- mqliang -- feihujiang -- enj diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd/doc.go b/staging/src/k8s.io/apiserver/pkg/storage/etcd/doc.go deleted file mode 100644 index 566f466510e..00000000000 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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. -*/ - -package etcd // import "k8s.io/apiserver/pkg/storage/etcd" diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd/util/BUILD b/staging/src/k8s.io/apiserver/pkg/storage/etcd/util/BUILD deleted file mode 100644 index 783d9f12256..00000000000 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd/util/BUILD +++ /dev/null @@ -1,36 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_test( - name = "go_default_test", - srcs = ["etcd_util_test.go"], - embed = [":go_default_library"], -) - -go_library( - name = "go_default_library", - srcs = [ - "doc.go", - "etcd_util.go", - ], - importmap = "k8s.io/kubernetes/vendor/k8s.io/apiserver/pkg/storage/etcd/util", - importpath = "k8s.io/apiserver/pkg/storage/etcd/util", -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd/util/doc.go b/staging/src/k8s.io/apiserver/pkg/storage/etcd/util/doc.go deleted file mode 100644 index 97241a44f19..00000000000 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd/util/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2015 The Kubernetes 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. -*/ - -// Package util holds generic etcd-related utility functions that any user of ectd might want to -// use, without pulling in kubernetes-specific code. -package util // import "k8s.io/apiserver/pkg/storage/etcd/util" diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/BUILD b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/BUILD index a9c98f46ba4..22614fc570a 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/BUILD +++ b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/BUILD @@ -12,6 +12,7 @@ go_test( "api_object_versioner_test.go", "compact_test.go", "event_test.go", + "healthcheck_test.go", "lease_manager_test.go", "store_test.go", "watcher_test.go", @@ -56,6 +57,7 @@ go_library( "compact.go", "errors.go", "event.go", + "healthcheck.go", "lease_manager.go", "logger.go", "store.go", diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd/util/etcd_util.go b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/healthcheck.go similarity index 86% rename from staging/src/k8s.io/apiserver/pkg/storage/etcd/util/etcd_util.go rename to staging/src/k8s.io/apiserver/pkg/storage/etcd3/healthcheck.go index 9b98403bdae..ad051d2d6cd 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd/util/etcd_util.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/healthcheck.go @@ -14,18 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package etcd3 import ( "encoding/json" "fmt" ) +// etcdHealth encodes data returned from etcd /healthz handler. type etcdHealth struct { // Note this has to be public so the json library can modify it. Health string `json:"health"` } +// EtcdHealthCheck decodes data returned from etcd /healthz handler. func EtcdHealthCheck(data []byte) error { obj := etcdHealth{} if err := json.Unmarshal(data, &obj); err != nil { diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd/util/etcd_util_test.go b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/healthcheck_test.go similarity index 98% rename from staging/src/k8s.io/apiserver/pkg/storage/etcd/util/etcd_util_test.go rename to staging/src/k8s.io/apiserver/pkg/storage/etcd3/healthcheck_test.go index b06932e4f0d..551a27594f9 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd/util/etcd_util_test.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/healthcheck_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package util +package etcd3 import ( "testing" diff --git a/vendor/modules.txt b/vendor/modules.txt index aa20bbeaae2..ecfbb21e2d2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1260,7 +1260,6 @@ k8s.io/apiserver/pkg/server/storage k8s.io/apiserver/pkg/storage k8s.io/apiserver/pkg/storage/cacher k8s.io/apiserver/pkg/storage/errors -k8s.io/apiserver/pkg/storage/etcd/util k8s.io/apiserver/pkg/storage/etcd3 k8s.io/apiserver/pkg/storage/etcd3/metrics k8s.io/apiserver/pkg/storage/etcd3/preflight