You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a pretty heavy change, but I think it's better to do it sooner rather than later: Kubernetes objects already provide UIDs, with most of them being UUIDs1:
UID is a type that holds unique ID values, including UUIDs. Because we
don't ONLY use UUIDs, this is an alias to string. Being a type captures
intent and helps make sure that UIDs and names do not get conflated.
Instead of creating our IDs from namespace/name, we should simply use the Kubernetes UUIDs:
Rename id to uuid and use github.com/google/uuid#UUID as type
Change foreign keys accordingly
Add uuid to schema/v1#Meta
For related objects like containers which do not provide UIDs, we can create UUIDs like uuid.NewSHA1(PodUUID, []byte(containerName))
Use the following code to create UUIDs from Kubernetes UIDs:
var NameSpaceKubernetes = uuid.MustParse("3f249403-2bb0-428f-8e91-504d1fd7ddb6")
func EnsureUUID(uid ktypes.UID) uuid.UUID {
if id, err := uuid.Parse(string(uid)); err == nil {
return id
}
return uuid.NewSHA1(NameSpaceKubernetes, []byte(uid))
}
This is a pretty heavy change, but I think it's better to do it sooner rather than later: Kubernetes objects already provide UIDs, with most of them being UUIDs1:
Instead of creating our IDs from namespace/name, we should simply use the Kubernetes UUIDs:
id
touuid
and usegithub.com/google/uuid#UUID
as typeuuid
toschema/v1#Meta
uuid.NewSHA1(PodUUID, []byte(containerName))
Footnotes
types.UID ↩
The text was updated successfully, but these errors were encountered: