diff --git a/go.mod b/go.mod index b01f62107..90ebd48e5 100644 --- a/go.mod +++ b/go.mod @@ -19,6 +19,7 @@ require ( github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d github.com/google/go-cmp v0.3.0 github.com/google/gofuzz v1.0.0 + github.com/google/uuid v1.1.1 github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d github.com/gorilla/websocket v1.4.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 @@ -40,10 +41,10 @@ require ( gopkg.in/square/go-jose.v2 v2.2.2 gopkg.in/yaml.v2 v2.2.4 gotest.tools v2.2.0+incompatible // indirect - k8s.io/api v0.0.0-20191105135202-f26842a96636 - k8s.io/apimachinery v0.0.0-20191105135202-8b539fc8459d - k8s.io/client-go v0.0.0-20191105135202-b132d4e8c200 - k8s.io/component-base v0.0.0-20191105135202-5ba71dd09dcd + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 + k8s.io/client-go v0.0.0 + k8s.io/component-base v0.0.0 k8s.io/klog v1.0.0 k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf k8s.io/utils v0.0.0-20191030222137-2b95a09bc58d @@ -60,8 +61,9 @@ replace ( golang.org/x/sys => golang.org/x/sys v0.0.0-20190209173611-3b5209105503 golang.org/x/text => golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db golang.org/x/time => golang.org/x/time v0.0.0-20161028155119-f51c12702a4d - k8s.io/api => k8s.io/api v0.0.0-20191105135202-f26842a96636 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191105135202-8b539fc8459d - k8s.io/client-go => k8s.io/client-go v0.0.0-20191105135202-b132d4e8c200 - k8s.io/component-base => k8s.io/component-base v0.0.0-20191105135202-5ba71dd09dcd + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/apiserver => ../apiserver + k8s.io/client-go => ../client-go + k8s.io/component-base => ../component-base ) diff --git a/go.sum b/go.sum index 73979d0d7..74d70caff 100644 --- a/go.sum +++ b/go.sum @@ -316,10 +316,6 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.0.0-20191105135202-f26842a96636/go.mod h1:PSjZrYyf7B3FBnQ/Mg/Q8a608vRWJjqnecTDJ0rmg44= -k8s.io/apimachinery v0.0.0-20191105135202-8b539fc8459d/go.mod h1:gA1T9z4LIup7PIegBwxkF2UYXUNVKhOAPvQWWnAc34k= -k8s.io/client-go v0.0.0-20191105135202-b132d4e8c200/go.mod h1:fPfKKziusto52CHMcMygXEWs7lDSttDsoSeIBU2rEfM= -k8s.io/component-base v0.0.0-20191105135202-5ba71dd09dcd/go.mod h1:V5q1uXzr6XqJdZjg4acFLX+MMb1PzdLC9n7GpYGRi64= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= diff --git a/pkg/audit/request.go b/pkg/audit/request.go index 1ac39bc92..f53dfadf1 100644 --- a/pkg/audit/request.go +++ b/pkg/audit/request.go @@ -23,7 +23,7 @@ import ( "reflect" "time" - "github.com/pborman/uuid" + "github.com/google/uuid" "k8s.io/klog" authnv1 "k8s.io/api/authentication/v1" @@ -58,7 +58,7 @@ func NewEventFromRequest(req *http.Request, level auditinternal.Level, attribs a if ids != "" { ev.AuditID = types.UID(ids) } else { - ev.AuditID = types.UID(uuid.NewRandom().String()) + ev.AuditID = types.UID(uuid.New().String()) } ips := utilnet.SourceIPs(req) diff --git a/pkg/authentication/token/cache/cache_test.go b/pkg/authentication/token/cache/cache_test.go index 3b4d68a23..ad02cd3df 100644 --- a/pkg/authentication/token/cache/cache_test.go +++ b/pkg/authentication/token/cache/cache_test.go @@ -21,7 +21,7 @@ import ( "testing" "time" - "github.com/pborman/uuid" + "github.com/google/uuid" "k8s.io/apimachinery/pkg/util/clock" "k8s.io/apiserver/pkg/authentication/authenticator" @@ -50,7 +50,7 @@ func BenchmarkStripedCache(b *testing.B) { func benchmarkCache(cache cache, b *testing.B) { keys := []string{} for i := 0; i < b.N; i++ { - key := uuid.NewRandom().String() + key := uuid.New().String() keys = append(keys, key) } diff --git a/pkg/endpoints/filters/audit_test.go b/pkg/endpoints/filters/audit_test.go index 3d3edd68f..e885644f8 100644 --- a/pkg/endpoints/filters/audit_test.go +++ b/pkg/endpoints/filters/audit_test.go @@ -26,7 +26,7 @@ import ( "testing" "time" - "github.com/pborman/uuid" + "github.com/google/uuid" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -223,7 +223,7 @@ func TestAudit(t *testing.T) { "short running with auditID", shortRunningPath, "GET", - uuid.NewRandom().String(), + uuid.New().String(), nil, func(w http.ResponseWriter, req *http.Request) { w.Write([]byte("foo")) @@ -422,7 +422,7 @@ func TestAudit(t *testing.T) { "empty longrunning with audit id", longRunningPath, "GET", - uuid.NewRandom().String(), + uuid.New().String(), nil, func(w http.ResponseWriter, req *http.Request) { w.Write([]byte("foo")) @@ -778,7 +778,7 @@ func TestAuditIDHttpHeader(t *testing.T) { }, { "no http header when there is no audit even the request header specified", - uuid.NewRandom().String(), + uuid.New().String(), auditinternal.LevelNone, false, }, @@ -790,7 +790,7 @@ func TestAuditIDHttpHeader(t *testing.T) { }, { "user provided header", - uuid.NewRandom().String(), + uuid.New().String(), auditinternal.LevelRequestResponse, true, }, diff --git a/pkg/server/config.go b/pkg/server/config.go index 16208954a..ee8051a0a 100644 --- a/pkg/server/config.go +++ b/pkg/server/config.go @@ -30,7 +30,7 @@ import ( jsonpatch "github.com/evanphx/json-patch" "github.com/go-openapi/spec" - "github.com/pborman/uuid" + "github.com/google/uuid" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" @@ -727,7 +727,7 @@ func AuthorizeClientBearerToken(loopback *restclient.Config, authn *Authenticati } privilegedLoopbackToken := loopback.BearerToken - var uid = uuid.NewRandom().String() + var uid = uuid.New().String() tokens := make(map[string]*user.DefaultInfo) tokens[privilegedLoopbackToken] = &user.DefaultInfo{ Name: user.APIServerUser, diff --git a/pkg/server/options/serving_with_loopback.go b/pkg/server/options/serving_with_loopback.go index b19258bf9..9f9a42f81 100644 --- a/pkg/server/options/serving_with_loopback.go +++ b/pkg/server/options/serving_with_loopback.go @@ -19,7 +19,7 @@ package options import ( "fmt" - "github.com/pborman/uuid" + "github.com/google/uuid" "k8s.io/apiserver/pkg/server" "k8s.io/apiserver/pkg/server/dynamiccertificates" @@ -60,7 +60,7 @@ func (s *SecureServingOptionsWithLoopback) ApplyTo(secureServingInfo **server.Se return fmt.Errorf("failed to generate self-signed certificate for loopback connection: %v", err) } - secureLoopbackClientConfig, err := (*secureServingInfo).NewLoopbackClientConfig(uuid.NewRandom().String(), certPem) + secureLoopbackClientConfig, err := (*secureServingInfo).NewLoopbackClientConfig(uuid.New().String(), certPem) switch { // if we failed and there's no fallback loopback client config, we need to fail case err != nil && *loopbackClientConfig == nil: diff --git a/plugin/pkg/audit/log/backend_test.go b/plugin/pkg/audit/log/backend_test.go index ed3369d72..b839d96c9 100644 --- a/plugin/pkg/audit/log/backend_test.go +++ b/plugin/pkg/audit/log/backend_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "github.com/pborman/uuid" + "github.com/google/uuid" authnv1 "k8s.io/api/authentication/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -48,7 +48,7 @@ func TestLogEventsLegacy(t *testing.T) { }{ { &auditinternal.Event{ - AuditID: types.UID(uuid.NewRandom().String()), + AuditID: types.UID(uuid.New().String()), }, `[\d\:\-\.\+TZ]+ AUDIT: id="[\w-]+" stage="" ip="" method="" user="" groups="" as="" asgroups="" namespace="" uri="" response=""`, }, @@ -62,7 +62,7 @@ func TestLogEventsLegacy(t *testing.T) { "127.0.0.1", }, RequestReceivedTimestamp: metav1.NewMicroTime(time.Now()), - AuditID: types.UID(uuid.NewRandom().String()), + AuditID: types.UID(uuid.New().String()), Stage: auditinternal.StageRequestReceived, Verb: "get", User: authnv1.UserInfo{ @@ -80,7 +80,7 @@ func TestLogEventsLegacy(t *testing.T) { }, { &auditinternal.Event{ - AuditID: types.UID(uuid.NewRandom().String()), + AuditID: types.UID(uuid.New().String()), Level: auditinternal.LevelMetadata, ObjectRef: &auditinternal.ObjectReference{ Resource: "foo", @@ -108,7 +108,7 @@ func TestLogEventsLegacy(t *testing.T) { func TestLogEventsJson(t *testing.T) { for _, event := range []*auditinternal.Event{ { - AuditID: types.UID(uuid.NewRandom().String()), + AuditID: types.UID(uuid.New().String()), }, { ResponseStatus: &metav1.Status{ @@ -120,7 +120,7 @@ func TestLogEventsJson(t *testing.T) { }, RequestReceivedTimestamp: metav1.NewMicroTime(time.Now().Truncate(time.Microsecond)), StageTimestamp: metav1.NewMicroTime(time.Now().Truncate(time.Microsecond)), - AuditID: types.UID(uuid.NewRandom().String()), + AuditID: types.UID(uuid.New().String()), Stage: auditinternal.StageRequestReceived, Verb: "get", User: authnv1.UserInfo{ @@ -135,7 +135,7 @@ func TestLogEventsJson(t *testing.T) { }, }, { - AuditID: types.UID(uuid.NewRandom().String()), + AuditID: types.UID(uuid.New().String()), Level: auditinternal.LevelMetadata, ObjectRef: &auditinternal.ObjectReference{ Resource: "foo",