OSC / ood_core

Open OnDemand core library
https://osc.github.io/ood_core/
MIT License
10 stars 30 forks source link

k8s pod.yml.erb is hard to read & understand #257

Open johrstrom opened 3 years ago

johrstrom commented 3 years ago

The k8s template has become a bit unwiedley to understand with so many if blocks. I wonder if partials could help reduce some of this complexity.

https://github.com/OSC/ood_core/blob/e8d004b4fd464c193e9aa86e346b437dbef2ba65/lib/ood_core/job/adapters/kubernetes/templates/pod.yml.erb

┆Issue is synchronized with this Asana task by Unito

treydock commented 3 years ago

Now that we support <%- and -%> where leading and trailing space and newlines are stripped, maybe one way to make it more readable is have the conditions and loops at different indentation levels. I worry about lots of partials when it comes to tracking where changes are being made. There are also some places where partials would make it more complicated and not less, like around volume mounts because you have to deal with multiple sources of the mounts, so dealing with partials would either move the complicated if conditions to another file and just make things harder to follow or keep if where they are and render using partial which may just be yet another file someone has to track down and look at to see what's happening. Also couldn't use same partial for init mounts main container mounts since they are slightly different conditions and things rendering the values.