Skip to content

GoPlugin/helmenv

Repository files navigation

Helm environment

Go Report Card Go Reference Lint License: MIT

Thin wrapper for Helm to help you interact with k8s environments

Goals

  • Create a thin wrapper around deployments that works almost like Helm subcharts to compose test environments, with only small code part that helps you to configure your env more easily than writing hooks
  • Ability to use in both ephemeral deployments for CI as a lib and when creating standalone environment as a CLI

Install

ASDF

asdf plugin add helmenv https://github.com/goplugin/asdf-helmenv.git
asdf install helmenv latest
asdf global helmenv <version>

envcli -h

From Source

make install_cli

CLI usage

Usage docs

envcli -h

Create new environment with a preset

envcli new -p examples/presets/plugin.yaml -o my_env.yaml

You'll see all deployed charts info are now added to a preset yaml file

Now you can connect

envcli connect -e my_env.yaml

You can see all forwarded ports and get it by name from config now

Dump all the logs and postgres sqls

envcli dump -e my_env.yaml -a test_logs -db plugin

Apply some chaos from template

envcli chaos apply -e my_env.yaml -t examples/standalone/pod-failure-tmpl.yml

Now you can find running experiment ID in examples/standalone/plugin-example-preset

Remove chaos by id

envcli chaos stop -p examples/standalone/plugin-example-preset -c ${chaosID}

Clear all chaos if you have multiple experiments running

envcli chaos clear -e examples/standalone/plugin-example-preset

To remove env use

envcli remove -e my_env.yaml

Usage as a library

Have a look at tests in environment/environment_test.go

Spinning up your custom preset

If you want a custom preset that you can use only in your repo have a look at examples/programmatic

Charts requirements

Your applications must have app: *any_app_name* label, see examples in charts

All ports must have names, example:

ports:
    - name: http-rpc
      containerPort: 8544

TODO:

  • Deploy a chart
  • Expose required port by names for every chart
  • Have persistent connection config for all charts
  • Can connect/disconnect with particular chart and all of them at once
  • Test cli interactions: deploy/connect/disconnect/shutdown
  • Minimal programmatic e2e test for deployments
  • Test port forwarder forking on OS X
  • Test port forwarder forking on Linux
  • More tests with a different charts (services/dns) to check port forwarding
  • Test config interactions and overrides for viper and Helm values

Presets:

  • Plugin <-> ETH preset
  • Plugin <-> Relay preset
  • Plugin <-> Multinode network x2 preset (reorg testing)