mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-16 22:53:22 +00:00
Set uid during object create
This commit is contained in:
@@ -29,7 +29,6 @@ import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/master/ports"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
)
|
||||
|
||||
// REST implements the RESTStorage interface, backed by a MinionRegistry.
|
||||
@@ -57,7 +56,7 @@ func (rs *REST) Create(ctx api.Context, obj runtime.Object) (<-chan apiserver.RE
|
||||
return nil, kerrors.NewInvalid("minion", minion.Name, errs)
|
||||
}
|
||||
|
||||
minion.CreationTimestamp = util.Now()
|
||||
api.FillObjectMetaSystemFields(ctx, &minion.ObjectMeta)
|
||||
|
||||
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
||||
err := rs.registry.CreateMinion(ctx, minion)
|
||||
|
@@ -43,6 +43,9 @@ func TestMinionREST(t *testing.T) {
|
||||
t.Errorf("insert failed")
|
||||
}
|
||||
obj := <-c
|
||||
if !api.HasObjectMetaSystemFieldValues(&obj.Object.(*api.Minion).ObjectMeta) {
|
||||
t.Errorf("storage did not populate object meta field values")
|
||||
}
|
||||
if m, ok := obj.Object.(*api.Minion); !ok || m.Name != "baz" {
|
||||
t.Errorf("insert return value was weird: %#v", obj)
|
||||
}
|
||||
|
Reference in New Issue
Block a user