Commit graph

80 commits

Author SHA1 Message Date
Vincent Ambo
658c6a9b0c docs README: Update feature list
Adds a feature list with links to individual feature description
documents.
2017-08-04 23:11:27 +02:00
Vincent Ambo
5e7bb55e00 refactor templater: Use resource set 'path' field when loading files 2017-07-13 16:07:08 +02:00
Vincent Ambo
7607f6dc0f feat context: Allow overriding resource set paths
Instead of always inferring the path at which files in a resource set
are located, let users override the path by specifying a `path` field.

This makes it possible to add the same resource set multiple times
with different values while still keeping distinct names for
addressability (for example when using include/exclude).

This fixes #70
2017-07-13 16:07:08 +02:00
Vincent Ambo
9d26c17f13 feat context: Add ability to import extra variables from files
Kontemplate context specifications can now load extra variables from YAML
or JSON files by specifying a list of files (relative to the context file)
under the `import` key.
2017-07-03 14:27:48 +02:00
Vincent Ambo
68e1e48459 feat build: Test if 'go fmt' has been applied 2017-07-03 14:27:48 +02:00
Vincent Ambo
8c7a3d6c30 feat build: Run go vet before building 2017-07-03 14:27:48 +02:00
Vincent Ambo
5bc6370af2 fix main: Correctly print kubectl errors 2017-07-03 14:27:48 +02:00
Vincent Ambo
3728d0ae2e refactor context: Extract loadJsonOrYaml to util package
The logic to deserialise a structure from *either* JSON or YAML is reused several
times and can be easily extracted, which this commit does.
2017-07-03 14:27:48 +02:00
Dr. J. Kubernaught
e2f7cf6258 docs: Add official code of conduct
As dictated by the goddess to the eternal polyfather of love.

Signed-off-by: Reverend Dr. J. Kubernaughtt The Most Recent <tazjin@gmail.com>
2017-06-22 15:12:51 +02:00
Vincent Ambo
5144842e97 chore: Update Brew formula & Dockerfile to 1.1.0 2017-06-11 23:47:59 +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
3a2f00f29f chore: Update dependencies 2017-06-11 23:16:22 +02:00
Vincent Ambo
cf5e392baf feat: Add shell script to check if dependencies are up-to-date 2017-06-11 23:16:22 +02:00
Vincent Ambo
a7781b169d fix templater: Ignore slash-suffixes on includes/excludes
To prevent situations where a shell auto-appends a slash to an
include/exclude specification on the CLI, trailing slashes in those
string lists are now trimmed.

This fixes #54
2017-06-11 22:33:07 +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
f3264329b9 refactor templater: Add intermediate type to represent rendered RSes
As a first step in resolving #51 this refactors the `templater`
package to return rendered resource sets as a distinct type.

This also fixes #56
2017-06-11 22:09:10 +02:00
Vincent Ambo
d76ea59f4c feat image: Add Dockerfile for CI pipeline image
Adds a simple Docker image that can be used in CI pipelines to deploy
`kontemplate`-based environments.

This image contains kontemplate and all of its dependencies (including
pass as an optional dependency).
2017-06-07 10:05:56 +02:00
Vincent Ambo
9923b1e64d docs README: Update installation instructions 2017-05-18 20:54:44 +02:00
Vincent Ambo
de4171da31 feat build: Add Homebrew binary formula
Adds a Homebrew formula that downloads and installs the 1.0.2 binary release.

Users should be able to "tap" this formula from OS X, the README will be updated in a separate commit.

This fixes #41
2017-05-18 20:35:00 +02:00
Vincent Ambo
f79b261079 chore: Version bump to 1.0.2 2017-05-18 19:41:18 +02:00
Vincent Ambo
aadea2f698 feat build: Add Repeatr formula for repeatable builds
Adds a formula for Repeatr (http://repeatr.io/) that can be used to
build kontemplate in a repeatable way with pinned dependencies.

Fixes #47
2017-05-18 19:38:21 +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
20ccc33347 docs: Mention AUR package in README 2017-05-08 13:53:24 +02:00
Vincent Ambo
d15dfefce2 feat build: Add ArchLinux PKGBUILD 2017-05-08 13:47:53 +02:00
Vincent Ambo
1e3ecad709 feat release: Add simple release script
Adds a simple script that will build stripped binaries for various platforms
and GPG-sign them.
2017-05-08 11:15:20 +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
9b2d102bbf docs: Add note about binary releases to README 2017-05-08 10:37:24 +02:00
Vincent Ambo
c2a8f8784f docs: Add more information to README 2017-05-08 10:37:24 +02:00
Vincent Ambo
5bc67f4271 docs: Add some tips and tricks 2017-05-08 10:37:24 +02:00
Vincent Ambo
7644a1f675 docs: Document template format 2017-05-08 10:37:24 +02:00
Vincent Ambo
211289765a docs README: Update usage examples for kingpin CLI 2017-05-04 18:49:43 +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
32ca64c50a feat templater: Warn if no valid resource sets are included
After filtering resource sets, check whether any resource sets "survived".

Otherwise it can be assumed that the user specified invalid exclude/include
combinations and should be warned about that.

Fixes #35
2017-05-04 18:45:03 +02:00
Vincent Ambo
7286751db7 fix test: Assert variable override order 2017-04-04 20:06:15 +02:00
Vincent Ambo
746e733cbb fix templater: Don't try to template default value files 2017-04-04 20:06:15 +02:00
Vincent Ambo
11cfc80020 feat context: Support resource set default values
This adds functionality to specify default values directly in resource sets.

The idea is that users can create a file called `values.yaml` or `values.json`
in a resource set's folder and have all variables specified in that file be
automatically merged into the resource set variables with the lowest priority.

This fixes #25
This fixes #30 (to a degree)
2017-04-04 20:06:15 +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
3b0f41e71d feat templater: Fail if values are missing
Golang's template package now has an option for failing if template variables
are missing: https://golang.org/pkg/text/template/#Template.Option

This updates the templater code to make use of that option and return the
errors encountered during templating.

This fixes #1
2017-04-04 11:05:09 +02:00
Vincent Ambo
45aee8257f style: Apply go fmt 2017-02-20 14:25:39 +01:00
Vincent Ambo
0b992c6156 fix pass: Trim leading & trailing whitespace 2017-02-20 14:25:24 +01:00
Vincent Ambo
0147c3e13e feat ctx: Let sub-resource-sets inherit vars from parent
Users of kontemplate may expect variables defined on the parent resource to be
inherited by children.

This implements that functionality. Values defined twice are overwritten by the
child's definition.

Fixes #20
2017-02-14 19:12:53 +01:00
Vincent Ambo
f81fe551bc chore templater: Use new util.Merge func 2017-02-14 19:12:53 +01:00
Vincent Ambo
7a930aad11 feat util: Add silly map-merge function that should be in the stdlib 2017-02-14 19:12:53 +01:00
Vincent Ambo
c181decd9d fix main: Add a forgotten error check 2017-02-09 15:50:22 +01:00
Vincent Ambo
2f6e008121 feat templater: Add 'pass' lookup function
This introduces support for looking up secret values in the 'pass' command line
tool (https://www.passwordstore.org/).

Values like passwords can be interpolated from pass and even more complex
structures like certificates for Kubernetes Secrets can be retrieved and base64-
encoded as necessary.

Fixes #2
2017-02-09 15:44:18 +01:00
Vincent Ambo
4713d565d3 fix templater: Don't fail with two identical stack traces 2017-02-09 15:44:18 +01:00
Vincent Ambo
25c9ed4adc feat main: Version bump to v1.0.0-beta1 2017-02-09 15:44:18 +01:00
Vincent Ambo
b58b1e3385 feat templater: Add applyLimits tests 2017-02-08 22:12:34 +01:00