mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 07:03:31 +00:00
Use a strong type for UID fields
This commit is contained in:
@@ -63,7 +63,7 @@ func (rs *REST) Create(ctx api.Context, obj runtime.Object) (<-chan apiserver.RE
|
||||
}
|
||||
|
||||
if len(controller.Name) == 0 {
|
||||
controller.Name = util.NewUUID().String()
|
||||
controller.Name = string(util.NewUUID())
|
||||
}
|
||||
if errs := validation.ValidateReplicationController(controller); len(errs) > 0 {
|
||||
return nil, errors.NewInvalid("replicationController", controller.Name, errs)
|
||||
|
@@ -102,7 +102,7 @@ func (rs *REST) getAttrs(obj runtime.Object) (objLabels, objFields labels.Set, e
|
||||
"involvedObject.kind": event.InvolvedObject.Kind,
|
||||
"involvedObject.namespace": event.InvolvedObject.Namespace,
|
||||
"involvedObject.name": event.InvolvedObject.Name,
|
||||
"involvedObject.uid": event.InvolvedObject.UID,
|
||||
"involvedObject.uid": string(event.InvolvedObject.UID),
|
||||
"involvedObject.apiVersion": event.InvolvedObject.APIVersion,
|
||||
"involvedObject.resourceVersion": fmt.Sprintf("%s", event.InvolvedObject.ResourceVersion),
|
||||
"involvedObject.fieldPath": event.InvolvedObject.FieldPath,
|
||||
|
@@ -62,7 +62,7 @@ func (rs *REST) Create(ctx api.Context, obj runtime.Object) (<-chan apiserver.RE
|
||||
if len(pod.Name) == 0 {
|
||||
// TODO properly handle auto-generated names.
|
||||
// See https://github.com/GoogleCloudPlatform/kubernetes/issues/148 170 & 1135
|
||||
pod.Name = pod.UID
|
||||
pod.Name = string(pod.UID)
|
||||
}
|
||||
if errs := validation.ValidatePod(pod); len(errs) > 0 {
|
||||
return nil, errors.NewInvalid("pod", pod.Name, errs)
|
||||
|
Reference in New Issue
Block a user