Commit graph

138 commits

Author SHA1 Message Date
Vincent Ambo
01f771fa2f chore(image): Bump version to 1.6.0
* kontemplate 1.6.0
* kubectl 1.10.4
2018-06-09 22:13:42 +02:00
Vincent Ambo
e9992aec0b chore(brew): Update Homebrew formula for 1.6.0 2018-06-09 22:13:42 +02:00
Vincent Ambo
3a688191af fix(build): Fix shebang in build-release.sh 2018-06-09 22:13:42 +02:00
Vincent Ambo
97bef90387 chore: Bump version to 1.6.0 2018-06-09 21:34:58 +02:00
Vincent Ambo
c91cb21f70 feat(templater): Support single-template resource sets
Supports resource sets in which the `path` is pointed at a single
template file.

The example has been updated with ... an example of this.

This closes #81.
2018-06-09 21:23:48 +02:00
Vincent Ambo
77ca5b47cf fix(context): Global values have precedence over defaults 2018-06-09 21:16:27 +02:00
Vincent Ambo
ae6d960df9 feat(context): Support loading import variables from absolute paths
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
2018-06-09 20:21:29 +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
09869cf8fc docs: Add contribution guidelines
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.
2018-05-15 11:25:25 +02:00
Vincent Ambo
fa5c12a9a2 chore(image): Bump version to 1.5.0
* Kontemplate 1.5.0
* kubectl 1.10.2
2018-05-08 12:11:33 +02:00
Vincent Ambo
75c92172af chore(brew): Update Homebrew formula for v1.5.0 2018-05-08 12:11:33 +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
noqcks
3ea3bed7ac fix(templater): add baseDir to gitHead cmd so that directory is overwritten
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.
2018-05-05 10:29:47 +02:00
noqcks
ac445d5235 refactor(templater) Refactor templator to use exec.Command directly instead of executing in sh 2018-03-29 20:05:30 +02:00
noqcks
e1c2c19330 feat(templater) Add a template function to insert surrounding repo's Git hash
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.
2018-03-29 20:05:30 +02:00
Vincent Ambo
867f40307e chore(brew): Bump Homebrew formula to 1.4.0 2018-03-17 23:20:13 +01:00
Vincent Ambo
e2effbb289 chore(image): Bump image version to 1.4
* upgrade Alpine release
* upgrade kubectl to 1.9.4
* upgrade Kontemplate to 1.4.0
2018-03-17 23:20:13 +01:00
Vincent Ambo
1f373caba0 chore: Bump version to 1.4.0 2018-03-17 22:47:57 +01:00
Vincent Ambo
03838ff31b fix(example): Add missing file to example folder 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
b8722ce83b refactor(templater): Pass resource set path to insertFile function
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
2018-03-09 14:54:20 +01:00
Niklas Wik
bafb792339 feat(templater): Added support for file include
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>
2018-03-09 14:54:20 +01:00
Vincent Ambo
850fdcf3e0 feat(build): Pin nixpkgs used for release build
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.
2018-03-09 14:51:05 +01:00
Vincent Ambo
a1d9d8b199 feat(build): Build both derivations on Travis 2018-03-09 13:35:35 +01:00
Vincent Ambo
4a6db37ef7 chore: Remove legacy build system 2018-03-09 13:35:35 +01:00
Vincent Ambo
d7f19934d9 feat(build): Add Nix derivation for release builds
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.
2018-03-09 13:35:35 +01:00
Vincent Ambo
4b1d44f71b refactor(build): Add Nix derivation & configure Travis to build it
Adds a Nix-derivation for building kontemplate with dependencies
pinned in Nix.
2018-03-09 13:35:35 +01:00
Vincent Ambo
9286e70da3 docs(cluster-config): 'context' key optional for template command
Thanks to @christopher376 on the Kubernetes Slack for pointing out this mistake.
2017-12-11 20:57:07 +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
5ee1e9387d feat(image): Install git in kontemplate image 2017-11-16 15:10:31 +01:00
Vincent Ambo
a67f2d87ee docs(README): Remove dead links
Never got around to writing them and maybe they shouldn't be hanging around.
2017-11-07 23:37:10 +01:00
Vincent Ambo
eaec5d57da chore: Bump Docker image & Homebrew release to v1.3.0 2017-11-04 13:34:25 +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
9cffd3d1d4 refactor templater: Add explicit note about empty-rs warnings
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
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
Stefan Magnus Landrø
68e2f99062 feat templater: Add IP lookup function
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.
2017-10-20 09:43:02 +02:00
Vincent Ambo
b20bc5f57a fix templater: Don't template default.yml files
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
2017-08-31 18:41:57 +02:00
Vincent Ambo
063a3e9d30 fix context: Support ".yml" extension on default files
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
2017-08-25 14:44:24 +02:00
Vincent Ambo
8ccaab322a chore brew: Update Homebrew formula to v1.2.0 2017-08-22 20:02:10 +02:00
Vincent Ambo
4c7ff46c73 chore image: Bump Docker image to build v1.2.0 2017-08-22 20:02:10 +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
825506d2e9 chore build: Bump dependency versions
Several bugfixes, nothing major. Skipped one "outdated" dependency
because the only change was a new text file.
2017-08-22 18:53:48 +02:00
Vincent Ambo
e8cfa9c119 refactor build: Keep GPG-signatures outside of tarballs
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.
2017-08-22 18:41:14 +02:00