Merge pull request #101107 from cmssczy/etcd_storage

fix hardcoding and format error log

Kubernetes-commit: 2bda8ac3ec163ef158ca45d4f49de857c5107070
This commit is contained in:
Kubernetes Publisher 2021-05-05 10:15:14 -07:00
commit 2e076b8708
5 changed files with 9 additions and 8 deletions

2
Godeps/Godeps.json generated
View File

@ -920,7 +920,7 @@
}, },
{ {
"ImportPath": "k8s.io/api", "ImportPath": "k8s.io/api",
"Rev": "13f29098a509" "Rev": "0097618c6e4c"
}, },
{ {
"ImportPath": "k8s.io/apimachinery", "ImportPath": "k8s.io/apimachinery",

2
go.mod
View File

@ -51,7 +51,7 @@ require (
) )
replace ( replace (
k8s.io/api => k8s.io/api v0.0.0-20210518101607-13f29098a509 k8s.io/api => k8s.io/api v0.0.0-20210505141115-0097618c6e4c
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100456-fda713515979 k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100456-fda713515979
k8s.io/client-go => k8s.io/client-go v0.0.0-20210518102924-2ed8b3081056 k8s.io/client-go => k8s.io/client-go v0.0.0-20210518102924-2ed8b3081056
k8s.io/component-base => k8s.io/component-base v0.0.0-20210518111232-44faecbf614e k8s.io/component-base => k8s.io/component-base v0.0.0-20210518111232-44faecbf614e

4
go.sum
View File

@ -674,8 +674,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U= honnef.co/go/tools v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20210518101607-13f29098a509 h1:+1GipftN626FJVaUP8O0o0pgeqGunyS22Ng4hZYulvI= k8s.io/api v0.0.0-20210505141115-0097618c6e4c h1:QmszvJU0uDvIUanyZ0QhOYfZaILVvbkLJbRM7Ve3nts=
k8s.io/api v0.0.0-20210518101607-13f29098a509/go.mod h1:IgKLK42qxUHnMxdcdbEBFOo+TfTANemQTLg3gcGe8/M= k8s.io/api v0.0.0-20210505141115-0097618c6e4c/go.mod h1:IgKLK42qxUHnMxdcdbEBFOo+TfTANemQTLg3gcGe8/M=
k8s.io/apimachinery v0.0.0-20210518100456-fda713515979 h1:qjGp8QxGJZSGSMQw31AFuI2za6IEfDmdJ5/cY+Eeas8= k8s.io/apimachinery v0.0.0-20210518100456-fda713515979 h1:qjGp8QxGJZSGSMQw31AFuI2za6IEfDmdJ5/cY+Eeas8=
k8s.io/apimachinery v0.0.0-20210518100456-fda713515979/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= k8s.io/apimachinery v0.0.0-20210518100456-fda713515979/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs=
k8s.io/client-go v0.0.0-20210518102924-2ed8b3081056 h1:t4nxl6RpDRcvk1H0shNODINaiDEcBvGozB+ufxikbiA= k8s.io/client-go v0.0.0-20210518102924-2ed8b3081056 h1:t4nxl6RpDRcvk1H0shNODINaiDEcBvGozB+ufxikbiA=

View File

@ -27,6 +27,7 @@ import (
const ( const (
StorageTypeUnset = "" StorageTypeUnset = ""
StorageTypeETCD2 = "etcd2"
StorageTypeETCD3 = "etcd3" StorageTypeETCD3 = "etcd3"
DefaultCompactInterval = 5 * time.Minute DefaultCompactInterval = 5 * time.Minute

View File

@ -30,8 +30,8 @@ type DestroyFunc func()
// Create creates a storage backend based on given config. // Create creates a storage backend based on given config.
func Create(c storagebackend.Config, newFunc func() runtime.Object) (storage.Interface, DestroyFunc, error) { func Create(c storagebackend.Config, newFunc func() runtime.Object) (storage.Interface, DestroyFunc, error) {
switch c.Type { switch c.Type {
case "etcd2": case storagebackend.StorageTypeETCD2:
return nil, nil, fmt.Errorf("%v is no longer a supported storage backend", c.Type) return nil, nil, fmt.Errorf("%s is no longer a supported storage backend", c.Type)
case storagebackend.StorageTypeUnset, storagebackend.StorageTypeETCD3: case storagebackend.StorageTypeUnset, storagebackend.StorageTypeETCD3:
return newETCD3Storage(c, newFunc) return newETCD3Storage(c, newFunc)
default: default:
@ -42,8 +42,8 @@ func Create(c storagebackend.Config, newFunc func() runtime.Object) (storage.Int
// CreateHealthCheck creates a healthcheck function based on given config. // CreateHealthCheck creates a healthcheck function based on given config.
func CreateHealthCheck(c storagebackend.Config) (func() error, error) { func CreateHealthCheck(c storagebackend.Config) (func() error, error) {
switch c.Type { switch c.Type {
case "etcd2": case storagebackend.StorageTypeETCD2:
return nil, fmt.Errorf("%v is no longer a supported storage backend", c.Type) return nil, fmt.Errorf("%s is no longer a supported storage backend", c.Type)
case storagebackend.StorageTypeUnset, storagebackend.StorageTypeETCD3: case storagebackend.StorageTypeUnset, storagebackend.StorageTypeETCD3:
return newETCD3HealthCheck(c) return newETCD3HealthCheck(c)
default: default: