thelma

module
v1.0.104 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: BSD-3-Clause

README

thelma

codecov Go Report Card

thelma (short for Terra Helm Automator) is DSP-Devops' self service CLI tool for interacting with DSP infrastructure.

Thelma includes sub commands for a variety of different common use cases

The most common ones are

  1. Rendering kubernetes manifests for helm charts in the terra-helmfile repo
  2. Packaging and publishing helm charts
  3. Lifecycle management for BEEs (Branch Engineering Environment)
  4. Connect securely to Cloudsql instances

And more ... thelma --help for more info

Local Development

The Makefile has targets for facilitating local development, including:

make help    # Print out all Makefile targets w/ brief description
make build   # Compile thelma binary into output
make release # Assemble a thelma release
make test    # Run unit tests
make smoke   # Run unit and smoke tests
make cover   # View code coverage report for tests in browser

The build and release targets accept useful parameters:

# Run a cross-platform build if desired
make build OS=linux ARCH=amd64

# Assemble a cross-platform build into a release archive
make release OS=linux ARCH=arm64
Environment Setup
  1. Ensure you have the go 1.19 toolchain installed on your local machine brew install go@1.19
  2. Running thelma requires a local copy of the terra-helmfile repo. clone terra-helmfile
  3. Set the THELMA_HOME environment variable as the path to your local clone of terra-helmfile
Testing

The provided Makefile has utilities to easily run Thelma's test suites. From root of this repo make test will run all of thelma's test suites. Note to future Thelma developers Go's testing too chain runs all tests in parallel by default, be wary of this if writing any tests that rely on shared state.

make smoke will run just the smoke tests.

Both will automatically build a new thelma binary incorporating your latest changes before running the tests

Building Thelma Locally

make build will build a thelma binary incorporating the latest changes in your branch. The resulting build artifact will be output to ./output/bin/thelma, this will not interfere with other installs of thelma on your system. From there you can test new functionality by running thelma commands directly on your machine via $ ./output/bin/thelma [COMMAND] Since thelma is compiled there is no hot building. After each change you make it is necessary to rerun make build.

Common Use Cases
  1. I want to try creating a BEE using my branch of thelma: make build && ./output/bin/thelma bee create --name <UNIQUE_BEE_NAME>

  2. I want to render terra-helmfile k8s manifests for my application in my bee make build && ./output/bin/thelma render -e [BEE_NAME] -a [MY_APP]

Directories

Path Synopsis
cmd
internal
thelma/app
Package app contains logic for global/cross-cutting Thelma dependencies, such as configuration, logging support, and API client factories
Package app contains logic for global/cross-cutting Thelma dependencies, such as configuration, logging support, and API client factories
thelma/app/autoupdate
Package autoupdate implements Thelma's self-install and self-update features
Package autoupdate implements Thelma's self-install and self-update features
thelma/app/autoupdate/bootstrap
Package bootstrap handles initial installation for Thelma.
Package bootstrap handles initial installation for Thelma.
thelma/app/autoupdate/manifest
Package manifest contains logic for parsing Thelma build manifests
Package manifest contains logic for parsing Thelma build manifests
thelma/app/env
Package env includes utilities for interacting with environment variables
Package env includes utilities for interacting with environment variables
thelma/app/metrics/labels
Package labels contains utility functions for generating a standard set of labels for terra.State objects Note that you cannot record two metrics with the same name and a different set of labels; if you do, the prometheus client library will panic.
Package labels contains utility functions for generating a standard set of labels for terra.State objects Note that you cannot record two metrics with the same name and a different set of labels; if you do, the prometheus client library will panic.
thelma/bee/cleanup
Package cleanup contains logic for cleaning up Bee cloud resources when BEEs are deleted
Package cleanup contains logic for cleaning up Bee cloud resources when BEEs are deleted
thelma/charts/changedfiles
Package changedfiles maps a list of updated files in the terra-helmfile repo to a list of charts that need to be published.
Package changedfiles maps a list of updated files in the terra-helmfile repo to a list of charts that need to be published.
thelma/charts/releaser
Package releaser is the main orchestrator for releasing new charts.
Package releaser is the main orchestrator for releasing new charts.
thelma/cli
Package cli contains code for Thelma's command-line interface
Package cli contains code for Thelma's command-line interface
thelma/cli/flags
Package flags contains common utilities for interacting with CLI flags
Package flags contains common utilities for interacting with CLI flags
thelma/clients
Package clients contains convenience constructors API clients that Thelma uses
Package clients contains convenience constructors API clients that Thelma uses
thelma/clients/api
Package api contains interfaces for client factories in the clients package.
Package api contains interfaces for client factories in the clients package.
thelma/clients/google/bucket/testing/assert
Package assert contains helper functions for making Testify assertions about objects in GCS buckets.
Package assert contains helper functions for making Testify assertions about objects in GCS buckets.
thelma/clients/vault/testing
Package testing provides utilities for testing code that requires a Vault client
Package testing provides utilities for testing code that requires a Vault client
thelma/ops
Package ops contains operational tools for Terra services
Package ops contains operational tools for Terra services
thelma/render
Package render contains code for rendering Kubernetes manifests from Helm charts
Package render contains code for rendering Kubernetes manifests from Helm charts
thelma/render/helmfile/stateval
Package stateval is used for generating Helmfile state values.
Package stateval is used for generating Helmfile state values.
thelma/state
Package state models the state of Terra's infrastructure, including environments, clusters, and chart releases.
Package state models the state of Terra's infrastructure, including environments, clusters, and chart releases.
thelma/state/api/terra
Package terra contains interfaces that model Terra's infrastructure, and support querying and updating the state of said infrastructure.
Package terra contains interfaces that model Terra's infrastructure, and support querying and updating the state of said infrastructure.
thelma/utils
Package utils contains miscellaneous utility code
Package utils contains miscellaneous utility code
thelma/utils/pool
Package pool contains a generic implementation of the worker pool pattern for concurrent processing
Package pool contains a generic implementation of the worker pool pattern for concurrent processing

Jump to

Keyboard shortcuts

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