kontena / mortar

The manifest shooter for Kubernetes
Apache License 2.0
145 stars 14 forks source link

Easier variable looping #12

Closed jnummelin closed 6 years ago

jnummelin commented 6 years ago

If variables are defined like mortar --var port.foo=80 --var port.bar=8080, we could loop over all the defined ports with:

ports:
  <% port.to_h.each do |name, value| %>
  - containerPort: <%= name %>
     name: <%= value %>
  <% end %>

For non-Ruby developer, the to_h is not so intuitive. We could simplify this by extending the RecursiveOpenStruct so it could be written as port.each do |k,v| ...