Skip to content

Commit 0a7541c

Browse files
committed
Set uuid
1 parent 98be410 commit 0a7541c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/cmd/put.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3636
"k8s.io/apimachinery/pkg/runtime"
3737
"k8s.io/apimachinery/pkg/runtime/schema"
38+
"k8s.io/apimachinery/pkg/util/uuid"
3839
"k8s.io/apimachinery/pkg/util/yaml"
3940
)
4041

@@ -167,6 +168,11 @@ func putCommand(ctx context.Context, etcdclient client.Client, flags *putFlagpol
167168
obj.SetCreationTimestamp(metav1.Time{Time: start})
168169
}
169170

171+
uid := obj.GetUID()
172+
if uid == "" {
173+
obj.SetUID(uuid.NewUUID())
174+
}
175+
170176
obj.SetResourceVersion("")
171177
obj.SetSelfLink("")
172178

0 commit comments

Comments
 (0)