hashicorp / levant

An open source templating and deployment tool for HashiCorp Nomad jobs
Mozilla Public License 2.0
822 stars 124 forks source link

Question: levant vs hcl2 #391

Open fredwangwang opened 3 years ago

fredwangwang commented 3 years ago

Nomad 1.0 introduced hcl2 support for the job file, which brings a lot of the nice templating functionalities into the job file natively.

Some Pros and Cons I can think of using hcl2 over levant: Pros:

  1. native, aware of the syntax of generated snippet
  2. one less tool in the mix

Cons:

  1. native, making it infeasible to render non hcl files.

So there are use cases for levant to render files like json or yaml (we are). But as its original intent for templating Nomad job files hcl2 seems like a better alternative.

With that been said, curious to know if levant is going to be maintained going forward?

cgbaker commented 3 years ago

Hi @fredwangwang , excellent question. We're constantly in discussion about what the future of Levant looks like. As you noted, numerous parts of Levant's functionality have been superseded by native features in Nomad. However, there are still things that are not possible with Nomad's HCL2 support which are possible with Levant. Furthermore, there are many users of Levant who rely on it for existing workflows. Therefore, I imagine we'll continue to maintain it for the foreseeable future.

For those jobs which can be described using HCL2, it is the better choice; the Nomad team is committed to supporting and expanding HCL2 parsing of job specifications.

I'll leave this open so that @jrasell and others have a chance to speak.

nvx commented 3 years ago

The main usecase I have for levant that HCL2 doesn't yet address is being able to pull in configuration from Consul. This could be emulated by reading Consul data and outputting it to a vars file (or a plain json file which is read with hcl2 functions) then using hcl2 to template it in.

Of course I'd be pretty happy if the Nomad CLI could read from Consul directly too though (noting that HCL2 is only evaluated client side and at that point in time of course, but that's an existing limitation using Levant anyway).