mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 21:50:05 +00:00
Set uid during object create
This commit is contained in:
@@ -100,7 +100,8 @@ func (rs *REST) Create(ctx api.Context, obj runtime.Object) (<-chan apiserver.RE
|
||||
if errs := validation.ValidatePod(pod); len(errs) > 0 {
|
||||
return nil, errors.NewInvalid("pod", pod.Name, errs)
|
||||
}
|
||||
pod.CreationTimestamp = util.Now()
|
||||
|
||||
api.FillObjectMetaSystemFields(ctx, &pod.ObjectMeta)
|
||||
|
||||
return apiserver.MakeAsync(func() (runtime.Object, error) {
|
||||
if err := rs.registry.CreatePod(ctx, pod); err != nil {
|
||||
|
@@ -586,13 +586,15 @@ func TestCreatePod(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
select {
|
||||
case <-channel:
|
||||
// Do nothing, this is expected.
|
||||
case <-time.After(time.Millisecond * 100):
|
||||
t.Error("Unexpected timeout on async channel")
|
||||
}
|
||||
if !api.HasObjectMetaSystemFieldValues(&podRegistry.Pod.ObjectMeta) {
|
||||
t.Errorf("Expected ObjectMeta field values were populated")
|
||||
}
|
||||
}
|
||||
|
||||
type FakePodInfoGetter struct {
|
||||
|
Reference in New Issue
Block a user