mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Refactor uuid into its own pkg
This commit is contained in:
@@ -23,7 +23,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/conversion"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/types"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"k8s.io/kubernetes/pkg/util/uuid"
|
||||
)
|
||||
|
||||
// FillObjectMetaSystemFields populates fields that are managed by the system on ObjectMeta.
|
||||
@@ -33,7 +33,7 @@ func FillObjectMetaSystemFields(ctx Context, meta *ObjectMeta) {
|
||||
// to support tracking resources pending creation.
|
||||
uid, found := UIDFrom(ctx)
|
||||
if !found {
|
||||
uid = util.NewUUID()
|
||||
uid = uuid.NewUUID()
|
||||
}
|
||||
meta.UID = uid
|
||||
meta.SelfLink = ""
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api/testapi"
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"k8s.io/kubernetes/pkg/util/uuid"
|
||||
)
|
||||
|
||||
var _ meta.Object = &api.ObjectMeta{}
|
||||
@@ -44,7 +44,7 @@ func TestFillObjectMetaSystemFields(t *testing.T) {
|
||||
t.Errorf("resource.UID missing")
|
||||
}
|
||||
// verify we can inject a UID
|
||||
uid := util.NewUUID()
|
||||
uid := uuid.NewUUID()
|
||||
ctx = api.WithUID(ctx, uid)
|
||||
resource = api.ObjectMeta{}
|
||||
api.FillObjectMetaSystemFields(ctx, &resource)
|
||||
|
||||
Reference in New Issue
Block a user