This lets users specify the paths from which to import additional
variables using absolute paths in addition to relative paths.
This enables both loading of configuration files placed outside of the
resource set folder (if desired), as well as special use-cases such as
specifying `/dev/stdin` as an input path to read variables from
standard input.
This change supersedes #131
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`.
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
This document is intended to provide some information about how to
contribute to the project, from basic sanity checks and code quality
to information about how to structure git commits.
These are the most common things that I encounter in pull requests
sent to my projects.
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.
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`.
This makes it so that when gitHead is called in a template the git hash
that is returned is the hash of the folder containing the template, not
the hash of the folder where kontemplate is called.
A template function has been added that allows one to template the
Git hash of the surrounding repo. This is useful to be able to inspect the
deployment revision of an object in Kubernetes.
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.
This is actually several refactors in one:
* rename "fileContent" function to "insertFile"
* pass the resource set path to the "insetFile" function
* update docs and example with a pipeline including indentation
adjustments for the inserted file
Adds a 'fileContent' template function to insert the literal contents
of a file specified in the template.
Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
Pin the nixpkgs-commit used for building the Kontemplate release to a
specific commit.
Kontemplate builds should now be fully repeatable (and most likely
reproducible!) on any machine running Nix.
Adds a Nix derivation that produces statically linked output binaries
for multiple operating systems and architectures.
This requires a Nix-channel version that includes the Go 1.10
compiler.
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.
Due to an interesting combination of an error not being handled and Go
initialising everything with what it thinks should be the default,
non-existent resource sets have been gracefully handled already.
This makes this accidental fix explicit.
Fixes#90
This introduces support for looking up IP addresses using local DNS resolver.
Function will return a list of all IP addresses associated with hostname.
Further processing can be achieved using supported list template functions.
After the change from #84 default variable files with the '.yml'
extension got templated as resource set templates accidentally.
This resolves the issue by moving the list reserved default file names
to a common place and reusing it in both the templater and context pkg.
This fixes#85
In other places in Kontemplate that deal with YAML files, both the
".yaml" and ".yml" extension are supported.
This fixes context loading code to support that for resource set
variables, too.
This fixes#83
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
Instead of signing the binary and adding the signature in the release
tarball, keep the GPG-signatures *outside* of the tarball.
This makes it easier to use the built-in GPG-signature verification
features of package managers such as pacman.
Documents the structure of resource sets and the fields necessary for including
them in cluster configurations.
Also adds some words about nested resource sets and the like.