ansibleplaybookbundle / hello-world-apb

An APB which deploys a sample Hello World! application
3 stars 10 forks source link

Using the instance_id to generate the name leads to too long resources name #9

Open dmetzler opened 6 years ago

dmetzler commented 6 years ago

I'm using that playbook as an example for our own APB here https://github.com/nuxeo-sandbox/nuxeo-apb-catalog/.

I'm figuring that using the {{_apb_service_instance_id}} to generate the resources name may lead to too long resources name (more than 63 characters) which ends up with the following error:

metadata.labels: Invalid value: "nuxeo-elasticsearch-f168d75e-aa07-41f9-98de-5e1037933c62-client-0": must be no more than 63 characters

With hello-world, it's ok as the name is not very long but it becomes quite fast a very constraining limit if you intend to publish that sample as a blueprint. It seems that in Openshift, the service instances are using 5 characters long hash.

WDYT?

djzager commented 6 years ago

This is an unfortunate reality when trying to make it possible to provision more than one in a particular namespace. I personally am investigating an addition to the broker (haven't made it very far) that would use something like moby's name generator to give APBs access to a unique name that would be much shorter. It stinks and I'm sorry.

You could take a "release name" as a parameter if you wish and enforce it's length so you could guarantee the name + your identifiers is less than 63 characters. The other option is to simply use more generic names, that when combined with the UUID. These aren't the greatest solutions but I hope they at least give you a way forward.

I think this issue should remain open and I'll link the proposal in the broker once created.

dmetzler commented 6 years ago

As in our use case we don't intend to have many services of the same kind in the same project, I'm currently doing

name: "nuxeo-elasticsearch-{{ _apb_service_instance_id  |truncate(5, True, '') }}"

the risk of name collision is very limited. I just wanted to share that kind of error as other may have it...