gocardless / theatre

GoCardless' collection of Kubernetes extensions
MIT License
23 stars 17 forks source link

Replace slash and period with underscore for label names #237

Closed jackatbancast closed 3 years ago

jackatbancast commented 3 years ago

This change replaces all occurences of . and / in label keys. Occasionally a kubernetes label will take the form of a url, e.g. app.kubernetes.io/instance. In this case we would output that key prefixed by our given parameter.

This can cause issues with systems such as ElasticSearch where it will see the . as an object path separator and attempt to build the object from the labels. This may work but is likely unintended behaviour and can be surprising.

This issue is compounded if you have a matching key to the first segment of the domain-prefixed key, e.g. app in our case. This would conflict with the object that is being created by app.kubernetes.io and potentially cause errors to occur.

By reducing the label key to a form similar to snake case we can avoid this issue and provide dependant systems with a label form that doesn't conflict. Additionaly we can provide more consistent behaviour.