Merge pull request #264 from brendandburns/padding

Set id width at 8 and pad with zeros.
This commit is contained in:
Daniel Smith 2014-06-26 19:37:17 -07:00
commit ab308ad13a
2 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ func (r RealPodControl) createReplica(controllerSpec api.ReplicationController)
} }
pod := api.Pod{ pod := api.Pod{
JSONBase: api.JSONBase{ JSONBase: api.JSONBase{
ID: fmt.Sprintf("%x", rand.Int()), ID: fmt.Sprintf("%08x", rand.Uint32()),
}, },
DesiredState: controllerSpec.DesiredState.PodTemplate.DesiredState, DesiredState: controllerSpec.DesiredState.PodTemplate.DesiredState,
Labels: controllerSpec.DesiredState.PodTemplate.Labels, Labels: controllerSpec.DesiredState.PodTemplate.Labels,

View File

@ -263,7 +263,7 @@ const containerNamePrefix = "k8s"
// Creates a name which can be reversed to identify both manifest id and container name. // Creates a name which can be reversed to identify both manifest id and container name.
func manifestAndContainerToDockerName(manifest *api.ContainerManifest, container *api.Container) string { func manifestAndContainerToDockerName(manifest *api.ContainerManifest, container *api.Container) string {
// Note, manifest.Id could be blank. // Note, manifest.Id could be blank.
return fmt.Sprintf("%s--%s--%s--%x", containerNamePrefix, escapeDash(container.Name), escapeDash(manifest.Id), rand.Uint32()) return fmt.Sprintf("%s--%s--%s--%08x", containerNamePrefix, escapeDash(container.Name), escapeDash(manifest.Id), rand.Uint32())
} }
// Upacks a container name, returning the manifest id and container name we would have used to // Upacks a container name, returning the manifest id and container name we would have used to