Home - mihaiush/timona GitHub Wiki

Requirements

  1. helm, https://github.com/helm/helm
  2. helm-diff plugin, https://github.com/databus23/helm-diff
  3. a command line templating tool . It was tested with:
  4. python (>3.7)

Install

pip install timona

Usage example

Config file (timona.yaml)

config:
  tmp: /tmp
  template:
    command:
      render: gomplate
      version: gomplate -v
      regex: '\.Env\.[a-zA-Z_][a-zA-Z0-9_]*'
  helm:
    command: helm 
    flags: '--kube-context {{ .Env.CLUSTER }} --namespace {{ .Env.NAMESPACE }}'

values: t_values.yaml

variables:
    NAMESPACE: '{{ .Env.PRODUCT }}'
    CLUSTER: 'k8s-{{ .Env.LOCATION }}-{{ .Env.STAGE }}' 

releases:
  '{{ .Env.PRODUCT }}-{{ .Env.LOCATION }}-{{ .Env.STAGE }}-{{ .Env.COLOR }}':
    variables:
      PRODUCT: foo
    matrix:
      - STAGE: [live, qa]
        LOCATION: [paris, berlin]
        COLOR: [red, green, blue]

List releases

$ timona releases

  foo-berlin-live-blue
  foo-berlin-live-green
  foo-berlin-live-red
  foo-berlin-qa-blue
  foo-berlin-qa-green
  foo-berlin-qa-red
  foo-paris-live-blue
  foo-paris-live-green
  foo-paris-live-red
  foo-paris-qa-blue
  foo-paris-qa-green
  foo-paris-qa-red

Show environment for a release

$ timona env foo-berlin-live-blue

foo-berlin-live-blue:
  values: t_values.yaml
  variables:
    CLUSTER: k8s-berlin-live
    COLOR: blue
    LOCATION: berlin
    NAMESPACE: foo
    PRODUCT: foo
    STAGE: live

Show status

$ timona status foo-berlin-live-blue

foo-berlin-live-blue:
  values: t_values.yaml
  variables:
    CLUSTER: k8s-berlin-live
    COLOR: blue
    LOCATION: berlin
    NAMESPACE: foo
    PRODUCT: foo
    STAGE: live

NAME                    NAMESPACE     REVISION      UPDATED                                         STATUS          CHART            APP VERSION
foo-berlin-live-blue    foo           1             2023-04-26 10:18:47.391345865 +0300 EEST        deployed        foo-1.0.13       6.3.2      

Other actions available

$ timona

timona COMAND [RELEASE]

COMMANDS:
  releases         - list releases
  env RELEASE      - show environment
  template RELEASE - render template
  debug RELEASE    - dry-run
  diff RELEASE     - diff between running and config
  deploy RELEASE   - deploy
  status RELEASE   - status
  delete RELEASE   - delete
  version          - show version(s)

Values file

$ cat t_values.yaml

namespace: {{ .Env.NAMESPACE }}
stage: {{ .Env.STAGE }}
color: {{ .Env.COLOR }}

it is rendered using the release environment and passed with -f to helm commands.