Commit graph

42 commits

Author SHA1 Message Date
Vincent Ambo
795a974665 chore(kontemplate): Prepare kontemplate for depot-merge
This merge will not yet include moving over to buildGo.nix, as support
for testing and such is not present in that library yet.
2019-12-20 22:13:07 +00:00
Vincent Ambo
fad8dfcef6 chore(build): Bump version to 1.8.0 2019-09-04 11:58:58 +01:00
Vincent Ambo
7b9ae4831d chore: Update copyright headers to 2019 2019-09-04 11:58:58 +01:00
Martin Lehmann
54db9785d6 feat(main): Support specifying kubectl args in ResourceSets 2018-12-11 10:58:52 +01:00
Vincent Ambo
6b39254917 chore: Bump version to 1.7.0 2018-06-26 21:06:38 +02:00
Vincent Ambo
bd5980a5d7 feat(main): Add CLI flag for setting kubectl executable
This lets users choose the executable (either by full path or via a
$PATH-entry) to be used when executing `kubectl`.

This is useful in, for example, OpenShift based setups.

This fixes #143
2018-06-26 12:29:49 +02:00
Vincent Ambo
97bef90387 chore: Bump version to 1.6.0 2018-06-09 21:34:58 +02:00
Vincent Ambo
141355f350 refactor(util): Use YAML parser for both JSON & YAML files
JSON is a subset of YAML and the previous detection logic is
unnecessary.
2018-06-09 20:21:29 +02:00
Vincent Ambo
b33c353233 refactor(context): Implement more explicit merging of variables
The hierarchy for loading variables was previously not expressed
explicitly.

This commit refactors the logic for merging variables to explicitly
set the different layers of variables as values on the context object
and merge them for each resource set in `mergeContextValues`.
2018-06-09 19:16:23 +02:00
Phillip Johnsen
5cf9d53e80 feat(context): allow explicit variables to be defined as argument
These changes allows variables to be defined when executing
`kontemplate` via one or more `--variable` arguments.

With this in place one can either define new variables or override
existing variables loaded from a file:

```
$ kontemplate apply --variable version=v1.0 example/fancy-app.yaml
```

This avoids the need to write variables into a temporary file that is
only needed to provide "external variables" into resource sets.

Closes https://github.com/tazjin/kontemplate/issues/122
2018-06-09 19:16:23 +02:00
Vincent Ambo
c68518d6c9 chore: Bump version to 1.5.0 2018-05-08 11:32:56 +02:00
Vincent Ambo
ea297abe1d fix(main): Use 'app.Fatalf' for fatal kubectl errors 2018-05-08 11:32:56 +02:00
Vincent Ambo
b8c3264019 fix(main): Handle errors & logic when templating to directory
This does several changes to the new "template to directory" feature
introduced in the previous commit:

1. Errors are now "handled". In classic Go-style, it is of course all
   too easy to do absolutely nothing with errors, but we can't have
   that. I'm onto you, Renee French's husband!

2. Resource sets containing similarly named files are now templated
   correctly by prepending the resource set name to the filename.

3. In the same vein as the previous point, nested resource sets are
   now also output correctly by replacing slashes (`/`) with
   dashes (`-`) to guarantee that the output files are a flat list.

Some minor cosmetic fixes have also been applied.
2018-05-08 11:23:59 +02:00
Niklas Wik
84dcc294bf feat(main): Support output directories in template function.
This introduces a new command line flag `--output` (or `-o` for short)
which makes it possible to template all specified resource sets into a
folder (instead of to stdout) when using `kontemplate template`.
2018-05-08 11:23:59 +02:00
Vincent Ambo
1f373caba0 chore: Bump version to 1.4.0 2018-03-17 22:47:57 +01:00
Vincent Ambo
3aa2cb8d3e refactor: Remove old error handling library
Removes the old error handling library and switches to plain
fmt.Errorf calls.

There are several reasons for this:

* There are no useful types or handling here anyways, so output format
  is the only priority.
* Users don't care about getting stacktraces.
* My emotional wellbeing.

Fin de siècle.
2018-03-09 15:23:57 +01:00
Vincent Ambo
bfad4a3932 feat(license): Relicense under GPLv3
All further kontemplate source code changes and releases will happen under the GPLv3.

Previous releases are still available under the MIT license.
2017-11-21 11:46:27 +01:00
Vincent Ambo
7bbc3cc033 Version 1.3.0
This release comes with minor usability improvements and features.

* A new 'lookupIPAddr' template function is available for resolving
  DNS A records in templates. Thanks to @landro for the pull request!

* Handling of "non-standard" resource set structures has been improved
  to result in better error messages and behaviour in several places.

Release binaries are signed with GPG key `66F505681DB8F43B` which is
verified on my Github profile.

--------------

Note: This is the last Kontemplate release that will be written in Go.

Rob Pike's art project has proven its point but I believe it is
ethically questionable and morally indefensible to continue on this
path.

You can track #72 for the Rust-rewrite of Kontemplate.
2017-11-04 13:23:55 +01:00
Vincent Ambo
bd03e639bf refactor main: Reword empty/nonexistent resource set warning 2017-10-27 02:55:41 +02:00
Vincent Ambo
2574942338 fix main: Do not stop templater if a single resource set is empty
This fixes #91
2017-10-27 02:55:41 +02:00
Vincent Ambo
f8b6ad652d
Version 1.2.0
This release comes with some new features, usability improvements and
a better build & release process.

Features:

* Documentation has been improved significantly, check out the new
  [README][] and follow the links within!
* Extra variables can now be loaded from files on disk. Simply specify
  a list of YAML/JSON files under the 'import' key in your cluster
  context file. Check out #66 for details!
* Resource set paths can now be overridden by users. By default it is
  assumed that the path to a resource set is the same as its name,
  however this is now user-controllable.
  This means the same resource set can be included multiple times
  under different names, for easier including/excluding. See #71 for
  details!
* Kontemplate is currently getting a website that is under construction
  at [kontemplate.works][] - feel free to check it out and
  [give feedback][]!

Fixes:

* Windows release binaries now have the correct filename
* Several potential warning and error messages have been improved

Release binaries are signed with GPG key `66F505681DB8F43B` which is
verified on my Github profile.

[README]: https://github.com/tazjin/kontemplate/blob/master/README.md
[kontemplate.works]: http://kontemplate.works/
[give feedback]: https://github.com/tazjin/kontemplate-website/issues
2017-08-22 19:18:14 +02:00
Vincent Ambo
d22b3694fe feat main: Warn if resource set contains no templates
If a resource set is specified by the user and does _not_ contain any
templates, a warning will now be printed.

This fixes #79
2017-08-22 19:08:29 +02:00
Vincent Ambo
5bc6370af2 fix main: Correctly print kubectl errors 2017-07-03 14:27:48 +02:00
Vincent Ambo
e2be6152f9 chore: Release version 1.1.0
This release features some cleanup and under-the-hood changes, as well
as "ecosystem-features" that don't directly affect the way Kontemplate
itself functions.

* Resource-sets are now passed on to kubectl in individual
  invocations. This means that kubectl errors can be scoped to
  individual resource set files and issues such as #51 are less of a
  problem.
* A Dockerfile is provided and published at `tazjin:kontemplate` on
  Docker Hub. This image contains `kontemplate`, `kubectl` and `pass`
  and can be used - for example - as an image for a step in a CI
  system.
* Kontemplate is now available on Homebrew, check the README for
  installation instructions.

* If different resource sets don't contain `---` separators in YAML,
  `kubectl` calls will no longer fail. (#51)
* Autocompleted trailing slashes in shells are now filtered from
  include & exclude lists to enhance the CLI experience slightly.
2017-06-11 23:47:59 +02:00
Vincent Ambo
3cba344fbe fix main: Fix 'kontemplate template' output 2017-06-11 22:09:10 +02:00
Vincent Ambo
162b962fad refactor main: Call kubectl individually per resource set
Instead of passing the rendered output of all resource sets to kubectl
simultaneously, build upon the previous commit and pass resource sets
individually to new instances of kubectl.

This resolves #51
2017-06-11 22:09:10 +02:00
Vincent Ambo
f79b261079 chore: Version bump to 1.0.2 2017-05-18 19:41:18 +02:00
Vincent Ambo
c45e616258 fix main: Print information about kubectl errors 2017-05-08 14:29:47 +02:00
Vincent Ambo
cb6413bff7 fix main: Exit with kubectl status code
If kubectl fails during a kontemplate run, kontemplate should also
exit with a non-zero status code.

This fixes #43
2017-05-08 14:20:45 +02:00
Vincent Ambo
d15dfefce2 feat build: Add ArchLinux PKGBUILD 2017-05-08 13:47:53 +02:00
Vincent Ambo
d93bc51e86 feat main: Add version command
Adds a version command that can have the Kontemplate git hash added to it at
build time by using the Go linker's -X flag.
2017-05-08 11:15:20 +02:00
Vincent Ambo
c8a63861ae refactor main: Move to Kingpin CLI library
Replace urfave/cli with the kingpin[1] library.

It has slightly more sensible argument validation than the other Go libraries.

Additionally I've opted for removing the '-f / --file' flag in favour of positional arguments to commands.

A previous command like `kontemplate template -f somefile.yml` is now just `kontemplate template somefile.yml`. All other arguments remain the same.

[1]: https://github.com/alecthomas/kingpin
2017-05-04 18:49:43 +02:00
Vincent Ambo
4eadb58841 fix main: Don't panic if file is unspecified
Instead of printing a spooky stacktrace when the user forgets to specify
the `-f` argument, return an error a lot more gracefully.
2017-04-04 13:49:53 +02:00
Vincent Ambo
c181decd9d fix main: Add a forgotten error check 2017-02-09 15:50:22 +01:00
Vincent Ambo
25c9ed4adc feat main: Version bump to v1.0.0-beta1 2017-02-09 15:44:18 +01:00
Vincent Ambo
c046e5acff feat main: Add 'delete' command 2017-02-08 18:16:00 +01:00
Vincent Ambo
8e08a282eb feat templater: Add ability to exclude resource sets
* renamed --limit to --include (-i)
* added --exclude (-e)

Kontemplate users can now explicitly include and exclude certain resource sets.
Excludes always override includes.

Closes #11
2017-02-08 16:53:38 +01:00
Vincent Ambo
11a5cf9e19 feat main: Add replace support & respect context setting
* Adds support for calling `kubectl replace` (necessary for resource types that do
  not support `apply`).

* Sets `kubectl` context to whatever is defined in the cluster configuration file
2017-02-08 16:19:10 +01:00
Vincent Ambo
bc9fc9730d feat main: Add apply command
This integrates support for actually calling out to `kubectl apply`.

A dry-run flag is implemented, too.

The `run` command has been renamed to `template`.
2017-02-08 15:42:13 +01:00
Vincent Ambo
7ac63613fb feat main: Add proper CLI support
Adds a basic CLI structure with a single "run" command that takes a --file (-f)
and --limit (-l) flag.

--limit can be used to only output certain resource sets.

Closes #4
2017-02-08 12:58:53 +01:00
Vincent Ambo
8fac7c1a41 chore: Better example & gofmt 2017-02-08 11:55:59 +01:00
Vincent Ambo
8fb24f9f75 feat main: Initial program implementation & example 2017-02-08 11:51:08 +01:00