tem

module
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2021 License: MIT

README

tem

Tem is a templating and management tool for multi-resource Kubernetes deployments.

A tool like kubectl is great for managing individual Kubernetes resources, but lacks in functionallity when it comes to managing multiple resources that are part of a single deployment. Tem tries to solve that problem.

Tem is heavily inspired by Helm and (still) depends on the Helm Go libraries for some of it features. Most Helm charts should be usable with Tem (see differences below). Tem solves some fundamental limitations of Helm (like CRD handling and resource sorting) and uses the latests Kubernetes best practices for updating and managing resources.

Tem is still experimental and both the Go api and the cli api will still change a lot in the future.

Installation

> curl -Lo tem https://github.com/amurant/tem/releases/latest/download/tem
> chmod +x tem
> sudo mv tem /usr/bin/
> source <(tem completion bash) # adapt to your terminal & add to .bashrc

Tem workflow

  1. create templates for yaml defintions of your Kubernetes resources or find a Helm chart that contains these templates
  2. override the default values used for rendering the template, specify these overrides using --set or -f flags
  3. render the templates with overrides and install the rendered resources on a Kubernetes cluster
> tem -n <namespace> install <chart-name>:<repo-url> <release-name> -f <override-yaml-file>
INFO    Installed all ServiceAccount resources
INFO    Installed all ClusterRole resources
INFO    Installed all ClusterRoleBinding resources
INFO    Installed all Role resources
INFO    Installed all RoleBinding resources
INFO    Installed all Service resources
INFO    Installed all Deployment resources
INFO    Installed all Job resources
INFO    Installed all ValidatingWebhookConfiguration resources
INFO    Installed all MutatingWebhookConfiguration resources
Installing [10/10] ████████████████████████████████████████████ 100%
  1. list all releases installed on your Kubernetes cluster
> tem releases
Name         | Namespace   | Revision | Status   | Description    | Chart   | AppVersion
<chart-name> | <namespace> | 1        | deployed | fully deployed | <chart> | <version>
  1. change the setting and/or chart used in the release
> tem -n <namespace> apply <chart-name2>:<repo-url2> <release-name> -f <override-yaml-file2>
INFO    Updated all ServiceAccount resources
INFO    Updated all ClusterRole resources
INFO    Updated all ClusterRoleBinding resources
INFO    Updated all Role resources
INFO    Updated all RoleBinding resources
INFO    Updated all Service resources
INFO    Updated all Deployment resources
INFO    Updated all Job resources
INFO    Updated all ValidatingWebhookConfiguration resources
INFO    Updated all MutatingWebhookConfiguration resources
Updating [10/10] ██████████████████████████████████████████████ 100%
  1. uninstall the release
> tem -n <namespace> uninstall <release-name>
INFO    Uninstalled all MutatingWebhookConfiguration resources
INFO    Uninstalled all ValidatingWebhookConfiguration resources
INFO    Uninstalled all Job resources
INFO    Uninstalled all Deployment resources
INFO    Uninstalled all Service resources
INFO    Uninstalled all RoleBinding resources
INFO    Uninstalled all Role resources
INFO    Uninstalled all ClusterRoleBinding resources
INFO    Uninstalled all ClusterRole resources
INFO    Uninstalled all ServiceAccount resources
Uninstalling [10/10] ██████████████████████████████████████████ 100%
INFO    run 'tem -n cert-manager purge cert-manager' to remove the release history
  1. remove the release history
> tem -n <namespace> purge <release-name>

Render non-Kubernetes resources

> tem text -v values=examples/hello/values.yaml examples/hello/hello.template.txt
Hello Tem User,
Checkout this website: https://github.com/amurant/tem

Download installed release

> tem -n <namespace> export <release-name>
Fetching [10/10] ██████████████████████████████████████████████ 100%

Command docs

Cobra auto-generated docs

Tem Goals

  • low code complexity
  • highly efficient & optimal performance
  • great UX for in-cluster and workstation usecases

Tem vs Helm

Tem Helm
crds can be templated crds in the crds/ folder are static, conversion webhooks cannot be templated
crds are uninstalled optionally using --remove-crds flag crds in the crds/ folder are never uninstalled, crds in the templates/ folder are always uninstalled (can cause CRs to be garbage collected)
crds can be upgraded only crds in the templates/ folder will get upgraded
autocomplete cli searches for chart on https://artifacthub.io/ not possible
templating a non-yaml file is easy tem text not possible
cleanly cancels the pending requests on ctrl-c and fix the state instantly kills the install process
does not allow resource lookups while templating the lookup template function can be used to retrieve cluster information while templating
Helm hooks are not supported has support for Helm hooks
Helm tests are not supported has support for Helm tests

Testing

> ./devel/run-tests.sh

WIP:

  • better support for Helm dependencies
  • progress bar is not thread-safe & output interleaves incorrectly with logging
  • "tem list" error is printed twice (cobra error + logging error)
  • unstructured objects give limited error details (eg. does not say what field is missing if a field is missing)
  • add instant kill on 2nd ctrl-c
  • better handle cancel scenarios (display msg explaining how to fix the release)

Template functions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL