migrate callers to g/g/uuid
Kubernetes-commit: a4ca9e6c93e45b4a97e7d04df37362299088f64a
This commit is contained in:
parent
01a4eabd0b
commit
44b9fc84ab
18
go.mod
18
go.mod
|
@ -19,6 +19,7 @@ require (
|
||||||
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d
|
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d
|
||||||
github.com/google/go-cmp v0.3.0
|
github.com/google/go-cmp v0.3.0
|
||||||
github.com/google/gofuzz v1.0.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/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d
|
||||||
github.com/gorilla/websocket v1.4.0 // indirect
|
github.com/gorilla/websocket v1.4.0 // indirect
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
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/square/go-jose.v2 v2.2.2
|
||||||
gopkg.in/yaml.v2 v2.2.4
|
gopkg.in/yaml.v2 v2.2.4
|
||||||
gotest.tools v2.2.0+incompatible // indirect
|
gotest.tools v2.2.0+incompatible // indirect
|
||||||
k8s.io/api v0.0.0-20191104185821-86199361f0af
|
k8s.io/api v0.0.0
|
||||||
k8s.io/apimachinery v0.0.0-20191104185628-a55cb1b94bd3
|
k8s.io/apimachinery v0.0.0
|
||||||
k8s.io/client-go v0.0.0-20191104190107-a7c4a955b2a3
|
k8s.io/client-go v0.0.0
|
||||||
k8s.io/component-base v0.0.0-20191101230432-fc40a62c56dd
|
k8s.io/component-base v0.0.0
|
||||||
k8s.io/klog v1.0.0
|
k8s.io/klog v1.0.0
|
||||||
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf
|
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf
|
||||||
k8s.io/utils v0.0.0-20191030222137-2b95a09bc58d
|
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/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/text => golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db
|
||||||
golang.org/x/time => golang.org/x/time v0.0.0-20161028155119-f51c12702a4d
|
golang.org/x/time => golang.org/x/time v0.0.0-20161028155119-f51c12702a4d
|
||||||
k8s.io/api => k8s.io/api v0.0.0-20191104185821-86199361f0af
|
k8s.io/api => ../api
|
||||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191104185628-a55cb1b94bd3
|
k8s.io/apimachinery => ../apimachinery
|
||||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20191104190107-a7c4a955b2a3
|
k8s.io/apiserver => ../apiserver
|
||||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20191101230432-fc40a62c56dd
|
k8s.io/client-go => ../client-go
|
||||||
|
k8s.io/component-base => ../component-base
|
||||||
)
|
)
|
||||||
|
|
4
go.sum
4
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-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-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/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-20191104185821-86199361f0af/go.mod h1:6Z4OXN69aR5stkJdnH2bnMwbWCUtnz8QjNPM7vjy/rk=
|
|
||||||
k8s.io/apimachinery v0.0.0-20191104185628-a55cb1b94bd3/go.mod h1:gA1T9z4LIup7PIegBwxkF2UYXUNVKhOAPvQWWnAc34k=
|
|
||||||
k8s.io/client-go v0.0.0-20191104190107-a7c4a955b2a3/go.mod h1:VGooD1Z+Z3ZMidoLvNRbJI+PKMuJH9m/0vJ7hWtOSBQ=
|
|
||||||
k8s.io/component-base v0.0.0-20191101230432-fc40a62c56dd/go.mod h1:ENDlyOTf2BFTMuaSVcdNTAhiEJIZb+lQ5RKyUvR9Ixk=
|
|
||||||
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
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.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||||
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pborman/uuid"
|
"github.com/google/uuid"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
authnv1 "k8s.io/api/authentication/v1"
|
authnv1 "k8s.io/api/authentication/v1"
|
||||||
|
@ -58,7 +58,7 @@ func NewEventFromRequest(req *http.Request, level auditinternal.Level, attribs a
|
||||||
if ids != "" {
|
if ids != "" {
|
||||||
ev.AuditID = types.UID(ids)
|
ev.AuditID = types.UID(ids)
|
||||||
} else {
|
} else {
|
||||||
ev.AuditID = types.UID(uuid.NewRandom().String())
|
ev.AuditID = types.UID(uuid.New().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
ips := utilnet.SourceIPs(req)
|
ips := utilnet.SourceIPs(req)
|
||||||
|
|
|
@ -21,7 +21,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pborman/uuid"
|
"github.com/google/uuid"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/clock"
|
"k8s.io/apimachinery/pkg/util/clock"
|
||||||
"k8s.io/apiserver/pkg/authentication/authenticator"
|
"k8s.io/apiserver/pkg/authentication/authenticator"
|
||||||
|
@ -50,7 +50,7 @@ func BenchmarkStripedCache(b *testing.B) {
|
||||||
func benchmarkCache(cache cache, b *testing.B) {
|
func benchmarkCache(cache cache, b *testing.B) {
|
||||||
keys := []string{}
|
keys := []string{}
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
key := uuid.NewRandom().String()
|
key := uuid.New().String()
|
||||||
keys = append(keys, key)
|
keys = append(keys, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pborman/uuid"
|
"github.com/google/uuid"
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
@ -223,7 +223,7 @@ func TestAudit(t *testing.T) {
|
||||||
"short running with auditID",
|
"short running with auditID",
|
||||||
shortRunningPath,
|
shortRunningPath,
|
||||||
"GET",
|
"GET",
|
||||||
uuid.NewRandom().String(),
|
uuid.New().String(),
|
||||||
nil,
|
nil,
|
||||||
func(w http.ResponseWriter, req *http.Request) {
|
func(w http.ResponseWriter, req *http.Request) {
|
||||||
w.Write([]byte("foo"))
|
w.Write([]byte("foo"))
|
||||||
|
@ -422,7 +422,7 @@ func TestAudit(t *testing.T) {
|
||||||
"empty longrunning with audit id",
|
"empty longrunning with audit id",
|
||||||
longRunningPath,
|
longRunningPath,
|
||||||
"GET",
|
"GET",
|
||||||
uuid.NewRandom().String(),
|
uuid.New().String(),
|
||||||
nil,
|
nil,
|
||||||
func(w http.ResponseWriter, req *http.Request) {
|
func(w http.ResponseWriter, req *http.Request) {
|
||||||
w.Write([]byte("foo"))
|
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",
|
"no http header when there is no audit even the request header specified",
|
||||||
uuid.NewRandom().String(),
|
uuid.New().String(),
|
||||||
auditinternal.LevelNone,
|
auditinternal.LevelNone,
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
|
@ -790,7 +790,7 @@ func TestAuditIDHttpHeader(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"user provided header",
|
"user provided header",
|
||||||
uuid.NewRandom().String(),
|
uuid.New().String(),
|
||||||
auditinternal.LevelRequestResponse,
|
auditinternal.LevelRequestResponse,
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -30,7 +30,7 @@ import (
|
||||||
|
|
||||||
jsonpatch "github.com/evanphx/json-patch"
|
jsonpatch "github.com/evanphx/json-patch"
|
||||||
"github.com/go-openapi/spec"
|
"github.com/go-openapi/spec"
|
||||||
"github.com/pborman/uuid"
|
"github.com/google/uuid"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
@ -727,7 +727,7 @@ func AuthorizeClientBearerToken(loopback *restclient.Config, authn *Authenticati
|
||||||
}
|
}
|
||||||
|
|
||||||
privilegedLoopbackToken := loopback.BearerToken
|
privilegedLoopbackToken := loopback.BearerToken
|
||||||
var uid = uuid.NewRandom().String()
|
var uid = uuid.New().String()
|
||||||
tokens := make(map[string]*user.DefaultInfo)
|
tokens := make(map[string]*user.DefaultInfo)
|
||||||
tokens[privilegedLoopbackToken] = &user.DefaultInfo{
|
tokens[privilegedLoopbackToken] = &user.DefaultInfo{
|
||||||
Name: user.APIServerUser,
|
Name: user.APIServerUser,
|
||||||
|
|
|
@ -19,7 +19,7 @@ package options
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/pborman/uuid"
|
"github.com/google/uuid"
|
||||||
|
|
||||||
"k8s.io/apiserver/pkg/server"
|
"k8s.io/apiserver/pkg/server"
|
||||||
"k8s.io/apiserver/pkg/server/dynamiccertificates"
|
"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)
|
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 {
|
switch {
|
||||||
// if we failed and there's no fallback loopback client config, we need to fail
|
// if we failed and there's no fallback loopback client config, we need to fail
|
||||||
case err != nil && *loopbackClientConfig == nil:
|
case err != nil && *loopbackClientConfig == nil:
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pborman/uuid"
|
"github.com/google/uuid"
|
||||||
|
|
||||||
authnv1 "k8s.io/api/authentication/v1"
|
authnv1 "k8s.io/api/authentication/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
@ -48,7 +48,7 @@ func TestLogEventsLegacy(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
&auditinternal.Event{
|
&auditinternal.Event{
|
||||||
AuditID: types.UID(uuid.NewRandom().String()),
|
AuditID: types.UID(uuid.New().String()),
|
||||||
},
|
},
|
||||||
`[\d\:\-\.\+TZ]+ AUDIT: id="[\w-]+" stage="" ip="<unknown>" method="" user="<none>" groups="<none>" as="<self>" asgroups="<lookup>" namespace="<none>" uri="" response="<deferred>"`,
|
`[\d\:\-\.\+TZ]+ AUDIT: id="[\w-]+" stage="" ip="<unknown>" method="" user="<none>" groups="<none>" as="<self>" asgroups="<lookup>" namespace="<none>" uri="" response="<deferred>"`,
|
||||||
},
|
},
|
||||||
|
@ -62,7 +62,7 @@ func TestLogEventsLegacy(t *testing.T) {
|
||||||
"127.0.0.1",
|
"127.0.0.1",
|
||||||
},
|
},
|
||||||
RequestReceivedTimestamp: metav1.NewMicroTime(time.Now()),
|
RequestReceivedTimestamp: metav1.NewMicroTime(time.Now()),
|
||||||
AuditID: types.UID(uuid.NewRandom().String()),
|
AuditID: types.UID(uuid.New().String()),
|
||||||
Stage: auditinternal.StageRequestReceived,
|
Stage: auditinternal.StageRequestReceived,
|
||||||
Verb: "get",
|
Verb: "get",
|
||||||
User: authnv1.UserInfo{
|
User: authnv1.UserInfo{
|
||||||
|
@ -80,7 +80,7 @@ func TestLogEventsLegacy(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&auditinternal.Event{
|
&auditinternal.Event{
|
||||||
AuditID: types.UID(uuid.NewRandom().String()),
|
AuditID: types.UID(uuid.New().String()),
|
||||||
Level: auditinternal.LevelMetadata,
|
Level: auditinternal.LevelMetadata,
|
||||||
ObjectRef: &auditinternal.ObjectReference{
|
ObjectRef: &auditinternal.ObjectReference{
|
||||||
Resource: "foo",
|
Resource: "foo",
|
||||||
|
@ -108,7 +108,7 @@ func TestLogEventsLegacy(t *testing.T) {
|
||||||
func TestLogEventsJson(t *testing.T) {
|
func TestLogEventsJson(t *testing.T) {
|
||||||
for _, event := range []*auditinternal.Event{
|
for _, event := range []*auditinternal.Event{
|
||||||
{
|
{
|
||||||
AuditID: types.UID(uuid.NewRandom().String()),
|
AuditID: types.UID(uuid.New().String()),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResponseStatus: &metav1.Status{
|
ResponseStatus: &metav1.Status{
|
||||||
|
@ -120,7 +120,7 @@ func TestLogEventsJson(t *testing.T) {
|
||||||
},
|
},
|
||||||
RequestReceivedTimestamp: metav1.NewMicroTime(time.Now().Truncate(time.Microsecond)),
|
RequestReceivedTimestamp: metav1.NewMicroTime(time.Now().Truncate(time.Microsecond)),
|
||||||
StageTimestamp: 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,
|
Stage: auditinternal.StageRequestReceived,
|
||||||
Verb: "get",
|
Verb: "get",
|
||||||
User: authnv1.UserInfo{
|
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,
|
Level: auditinternal.LevelMetadata,
|
||||||
ObjectRef: &auditinternal.ObjectReference{
|
ObjectRef: &auditinternal.ObjectReference{
|
||||||
Resource: "foo",
|
Resource: "foo",
|
||||||
|
|
Loading…
Reference in New Issue