Package: emskaffolden
Emskaffolden = Emrichen + SkaffoldEmrichenis a template engine that takes in templates written in YAML or JSON, processes tags that do things like variable substitution, and outputs YAML or JSON. Emrichen is especially powerful for templating Kubernetes manifests.Skaffoldis a developer tool that handles the workflow for building, pushing and deploying your application, allowing you to focus on what matters most: writing code. Skaffold is especially good at three things: doing everyday development with Kubernetes, providing a coherent way to do image tagging in CI and watching for Kubernetes deployments to complete in CD.Emskaffoldencombines Emrichen and Skaffold by compiling the Skaffold config file and Kubernetes templates with Emrichen and then invoking Skaffold.Emskaffolden is opinionated: it may not suit everyone's workflow. If you find Emskaffolden's way of working unsuitable for your needs, you can try to make your case in the issues, but we try to keep the core very small.Why wrap Skaffold instead of implementing Emrichen support for Skaffold?Emrichen is a relatively unknown templating tool, so they'd probably never accept a PR integrating Emrichen into Skaffold. I wouldn't ;)This way we can support any of the Skaffold deploy methods using Emrichen, not justkubectl. You can even go wild and generate Kustomize or even Helm YAML using Emrichen! Err, not sure why you'd want to. But you can.InstallationInstallSkaffoldandPython 3.5+. Then installemskaffoldenusing Pip:python3 -m pip install emskaffoldenUsageWhen you invokeemskaffolden(or the shorthandemsk), it does the following steps:Compilesskaffold.in.yamltoskaffold.compiled.yaml(change with-F)Readsskaffold.compiled.yaml, discovers all*.compiled.yamlfiles referenced there, locates a corresponding*.in.yamltemplate and compiles it to*.compiled.yamlInvokes Skaffold with-f skaffold.compiled.yamland any other parameters you passed to the Emskaffolden command line after--.Use--to separate Emrichen and Skaffold optionsAs a general rule, options before--go to Emrichen and options after--go toskaffold. The Skaffold subcommand (or basically anypositionalarguments) can go on either side of--.So eg. these two are interchangeable:emskaffolden run -f kubernetes/staging.vars.yaml -- --default-repo=harbor.con2.fi/con2
emskaffolden -f kubernetes/staging.vars.yaml -- run --default-repo=harbor.con2.fi/con2are interchangeable and both tell Emrichen to use thekubernetes/staging.vars.yamlvar file, and invokes Skaffold withrun -f skaffold.compiled.yaml --default-repo=harbor.con2.fi/con2.On the other hand, if you were to leave out the--, Emskaffolden would complain about--default-repo, which is understood by Skaffold but not Emrichen/Emskaffolden.Tip: You can use the short formemskfor all commands instead ofemskaffolden.Default and environment-specific var filesAkubernetes/default.vars.yamlvar file is loaded from if present.Environment-specific files are loaded fromkubernetes/if present. The default environment is calleddevelopment, corresponding tokubernetes/development.vars.yaml, and the environment can be switched with-E <env name>.If your environment specific var files are elsewhere, use-f path/to/foo.vars.yamlinstead.Let Skaffold manage image tagsSkaffold has first-in-class support forgenerating immutable image tags.Just use a simple name for first-party images in Deployments etc., such askompassioredegal-static. Skaffold will automatically use the Git commit hash as the image tag.Finally, add--default-repoorSKAFFOLD_DEFAULT_REPOtoprefix the image name with your private registry.WorkflowThere is noemskaffolden init. Just copy over files fromexample/and edit them to your liking. For a real-world example, seeKompassiorEdegal.Useemskaffolden devas your everyday development environment – either locally using Docker Desktop, or in the Kubernetes environment of your choice.Useemskaffolden runin your CI/CD pipeline, or split it intoemskaffolden build -- --file-output=build.jsonandemskaffolden deploy -- -a build.json.*.compiled.yamlfiles should not be committed into Git. The.gitignoreinexample/excludes them.LicenseThe MIT License (MIT)

Copyright © 2020 Santtu Pajukanta

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.