vmware/hamlet

Make Name mandatory?

sergiopozoh opened this issue · 4 comments

Just wondering if we should make Name mandatory or leave it as optional.

Proposed change
Name required to be mandatory and unique. Uniqueness in the service owner platform. The consumer platform has to provide it, for example, aliasing all services from the same owner platform consistently (with the same prefix or suffix).

Reasons
Name is commonly used by implementors' data models. For example

  • In the case of Istio, it is used for the name of a ServiceEntry (when consuming).

  • In the case of Consul, Service is mandatory but defaults to ServiceID if no name is specified. In fact, there is no uniqueness in Name and there can be two or more services with the same Name. In this case, their ServiceIDs must be unique.

There also differences in terms of the Name regex. Again, in the case of Consul, they can only use letters and dashes.

Alternatives
Name can always be derived from other fields like FQDN if not present in the FederaredService.

Name is commonly used by implementors' data models

In Kubernetes-based implementation, I imagine the name field would include the name/namespace of a CRD that represents a FederatedService. I agree though that Name can be optional since ID or FQDN would be the unique identifier for the service, not the Name.

If we make FQDN optional, then I think we should revert Name to mandatory. That was my reasoning, but also seems to be yours @andrewsykim (again, assuming FQDN is optional).

Also, I am interested in learning more about namespace. If an owner sets a name AND a namespace, would the namespace be used by the consumer? That namespace is where the service in the owner is running?

If we make FQDN optional, then I think we should revert Name to mandatory. That was my reasoning, but also seems to be yours @andrewsykim (again, assuming FQDN is optional).

I think this is reasonable, as opposed to FQDN being required.

Also, I am interested in learning more about namespace. If an owner sets a name AND a namespace, would the namespace be used by the consumer? That namespace is where the service in the owner is running?

My thinking here is that many Services from different namespaces in different clusters may publish a Service via Hamlet. In this case each Service in a different namespace represents a separate FederatedService, but the consumer may collapse them together based on the FQDN into a single logical service. In most scenarios I think the namespace across clusters will be the same, but I don't think we can assume that will always be the case.

Also, I am interested in learning more about namespace. If an owner sets a name AND a namespace, would the namespace be used by the consumer? That namespace is where the service in the owner is running?

My thinking here is that many Services from different namespaces in different clusters may publish a Service via Hamlet. In this case each Service in a different namespace represents a separate FederatedService, but the consumer may collapse them together based on the FQDN into a single logical service. In most scenarios I think the namespace across clusters will be the same, but I don't think we can assume that will always be the case.

I think this may be the same reason why we're discussing having multiple ports per service, so a consumer does not have to create multiple entries for each port. It is really only about efficiency on the consumer representation. Or are you thinking in other use cases?