Unverified Commit 83d467c2 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #75270 from justincormack/uuid4

Use UUIDv4 not UUIDv1
parents 0118630a 0fb4b81c
......@@ -471,6 +471,10 @@
"Rev": "24818f796faf91cd76ec7bddd72458fbced7a6c1"
},
{
"ImportPath": "github.com/google/uuid",
"Rev": "8c31c18f31ede9fc8eae72290a7e7a8064e9b3e3"
},
{
"ImportPath": "github.com/googleapis/gnostic/OpenAPIv2",
"Rev": "0c5108395e2debce0d731cf0287ddf7242066aba"
},
......
......@@ -63,6 +63,10 @@
"Rev": "24818f796faf91cd76ec7bddd72458fbced7a6c1"
},
{
"ImportPath": "github.com/google/uuid",
"Rev": "8c31c18f31ede9fc8eae72290a7e7a8064e9b3e3"
},
{
"ImportPath": "github.com/googleapis/gnostic/OpenAPIv2",
"Rev": "0c5108395e2debce0d731cf0287ddf7242066aba"
},
......@@ -99,10 +103,6 @@
"Rev": "cca7078d478f8520f85629ad7c68962d31ed7682"
},
{
"ImportPath": "github.com/pborman/uuid",
"Rev": "ca53cad383cad2479bbba7f7a1a05797ec1386e4"
},
{
"ImportPath": "github.com/pmezard/go-difflib/difflib",
"Rev": "5d4384ee4fb2527b0a1256a821ebfc92f91efefc"
},
......
......@@ -12,7 +12,7 @@ go_library(
importpath = "k8s.io/apimachinery/pkg/util/uuid",
deps = [
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/github.com/pborman/uuid:go_default_library",
"//vendor/github.com/google/uuid:go_default_library",
],
)
......
......@@ -17,27 +17,11 @@ limitations under the License.
package uuid
import (
"sync"
"github.com/pborman/uuid"
"github.com/google/uuid"
"k8s.io/apimachinery/pkg/types"
)
var uuidLock sync.Mutex
var lastUUID uuid.UUID
func NewUUID() types.UID {
uuidLock.Lock()
defer uuidLock.Unlock()
result := uuid.NewUUID()
// The UUID package is naive and can generate identical UUIDs if the
// time interval is quick enough.
// The UUID uses 100 ns increments so it's short enough to actively
// wait for a new value.
for uuid.Equal(lastUUID, result) == true {
result = uuid.NewUUID()
}
lastUUID = result
return types.UID(result.String())
return types.UID(uuid.New().String())
}
......@@ -451,6 +451,10 @@
"Rev": "24818f796faf91cd76ec7bddd72458fbced7a6c1"
},
{
"ImportPath": "github.com/google/uuid",
"Rev": "8c31c18f31ede9fc8eae72290a7e7a8064e9b3e3"
},
{
"ImportPath": "github.com/googleapis/gnostic/OpenAPIv2",
"Rev": "0c5108395e2debce0d731cf0287ddf7242066aba"
},
......
......@@ -143,6 +143,10 @@
"Rev": "24818f796faf91cd76ec7bddd72458fbced7a6c1"
},
{
"ImportPath": "github.com/google/uuid",
"Rev": "8c31c18f31ede9fc8eae72290a7e7a8064e9b3e3"
},
{
"ImportPath": "github.com/googleapis/gnostic/OpenAPIv2",
"Rev": "0c5108395e2debce0d731cf0287ddf7242066aba"
},
......
......@@ -135,6 +135,10 @@
"Rev": "24818f796faf91cd76ec7bddd72458fbced7a6c1"
},
{
"ImportPath": "github.com/google/uuid",
"Rev": "8c31c18f31ede9fc8eae72290a7e7a8064e9b3e3"
},
{
"ImportPath": "github.com/googleapis/gnostic/OpenAPIv2",
"Rev": "0c5108395e2debce0d731cf0287ddf7242066aba"
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment