Generate content of metadata.name and introduce display name #290

Closed
opened 2025-11-14 08:09:27 +00:00 by tobru · 4 comments
Owner

Stories

As the control plane, I want to have unique resource names

Implementation Notes

We currently directly allow the portal user to set the content of metadata.name. This is a very crucial field in the control-plane and it's immutable. To increase the system stability and prevent bad naming, we will generate this value now and let the user set a display name.

  • Generate the value of metadata.name
  • Store the generated value in the ServiceInstance model; this is used to work with the resource in the control-plane
  • Use the current "name" field of the ServiceInstance model as the display name.
  • Set an annotation servala.com/displayName

Name generation

Input read: https://gnugat.github.io/2018/06/15/short-identifier.html
We could use plain old UUID, but this is not human friendly for the poor ops guy for debugging in the middle of the night on the control plane.

Proposal: Do a SHA256 on the name used when creating the service instance and use the first 8 characters of the SHA sum. Alternative: Use https://github.com/hnimminh/human-readable-id

## Stories _As the control plane, I want to have unique resource names_ ## Implementation Notes We currently directly allow the portal user to set the content of `metadata.name`. This is a very crucial field in the control-plane and it's immutable. To increase the system stability and prevent bad naming, we will generate this value now and let the user set a display name. * Generate the value of `metadata.name` * Store the generated value in the `ServiceInstance` model; this is used to work with the resource in the control-plane * Use the current "name" field of the `ServiceInstance` model as the display name. * Set an annotation `servala.com/displayName` ### Name generation Input read: https://gnugat.github.io/2018/06/15/short-identifier.html We could use plain old UUID, but this is not human friendly for the poor ops guy for debugging in the middle of the night on the control plane. Proposal: Do a SHA256 on the name used when creating the service instance and use the first 8 characters of the SHA sum. Alternative: Use https://github.com/hnimminh/human-readable-id
tobru changed title from Generate content of metadata.name to Generate content of metadata.name and introduce display name 2025-11-14 08:09:55 +00:00
Member

Do a SHA256 on the name used when creating the service instance and use the first 8 characters of the SHA sum.

I think this is a good call. We could additionally use some (hard-coded in the project settings, maybe) prefix/suffix, so that it's always clear that you're looking at an instance ID when passing one around? I really like how the Stripe API prefixes all their IDs so that it's clear what is currently being referred to (e.g. in their API, event IDs are always evt_LONG_ID, etc).

> Do a SHA256 on the name used when creating the service instance and use the first 8 characters of the SHA sum. I think this is a good call. We could additionally use some (hard-coded in the project settings, maybe) prefix/suffix, so that it's always clear that you're looking at an instance ID when passing one around? I really like how the Stripe API prefixes all their IDs so that it's clear what is currently being referred to (e.g. in their API, event IDs are always `evt_LONG_ID`, etc).
Author
Owner

Yes, let's do it that way. Use a dash - for separation.

To not cause any collisions, we also need to take the organization name into consideration when calculating the hash:

sha256($instanceName+$organizationName)

Yes, let's do it that way. Use a dash `-` for separation. To not cause any collisions, we also need to take the organization name into consideration when calculating the hash: `sha256($instanceName+$organizationName)`
Member

Do we enforce per-organisation uniqueness on display names?

Do we enforce per-organisation uniqueness on display names?
Author
Owner

Do we enforce per-organisation uniqueness on display names?

Per service type, yes. Different services can have the same name.

> Do we enforce per-organisation uniqueness on display names? Per service type, yes. Different services can have the same name.
tobru closed this issue 2025-12-11 15:33:25 +00:00
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
servala/servala-portal#290
No description provided.