sherlock

package
v1.0.102 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartVersionUpdater added in v0.0.74

type ChartVersionUpdater interface {
	// UpdateForNewChartVersion does three things in sequence, all directly with Sherlock's API.
	//
	// 1. Report new chart version to Sherlock (meaning there's a new latest chart version)
	// 2. Update given chart releases (via chartReleaseSelectors) to point at the latest chart version and refresh to get the new latest version
	//    - 9 times out of 10 this means `dev/${chartSelector}` based on how .autorelease.yaml file gets defaulted
	// 3. Refresh **template** chart releases that either:
	//    - already follow latest chart version (so step 1 means they'd have an update if we didn't catch them in step 2)
	//    - follow a chart release we just updated in step 2 (so step 2 means they'd have an update)
	UpdateForNewChartVersion(chartSelector string, newVersion string, lastVersion string, description string, chartReleaseSelectors ...string) error
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client contains an API client for a remote sherlock server. It implements StateReadWriter.

func New

func New(config config.Config, iapToken string) (*Client, error)

New configures a new Client instance which confers the ability to issue requests against the API of a sherlock server

func NewWithHostnameOverride added in v0.0.63

func NewWithHostnameOverride(addr, iapToken string) (*Client, error)

NewWithHostnameOverride enables thelma commands to utilize a sherlock client that targets a different sherlock instance from the one used for state loading

func (*Client) Clusters

func (c *Client) Clusters() (Clusters, error)

func (*Client) CreateEnvironmentFromTemplate added in v0.0.71

func (c *Client) CreateEnvironmentFromTemplate(templateName string, options terra.CreateOptions) (string, error)

func (*Client) DeleteEnvironments added in v0.0.64

func (c *Client) DeleteEnvironments(envs []terra.Environment) ([]string, error)

func (*Client) DisableRelease added in v0.0.64

func (c *Client) DisableRelease(envName, releaseName string) error

func (*Client) EnableRelease added in v0.0.64

func (c *Client) EnableRelease(env terra.Environment, releaseName string) error

func (*Client) Environments

func (c *Client) Environments() (Environments, error)

func (*Client) PinEnvironmentVersions added in v0.0.71

func (c *Client) PinEnvironmentVersions(environmentName string, versions map[string]terra.VersionOverride) error

func (*Client) Releases added in v0.0.72

func (c *Client) Releases() (Releases, error)

func (*Client) ResetEnvironmentAndPinToDev added in v0.0.71

func (c *Client) ResetEnvironmentAndPinToDev(environment terra.Environment) error

func (*Client) SetEnvironmentOffline added in v1.0.34

func (c *Client) SetEnvironmentOffline(environmentName string, offline bool) error

func (*Client) SetTerraHelmfileRefForEntireEnvironment added in v0.0.71

func (c *Client) SetTerraHelmfileRefForEntireEnvironment(environment terra.Environment, terraHelmfileRef string) error

func (*Client) UpdateForNewChartVersion added in v0.0.74

func (c *Client) UpdateForNewChartVersion(chartSelector string, newVersion string, lastVersion string, description string, chartReleaseSelectors ...string) error

func (*Client) WriteClusters added in v0.0.63

func (c *Client) WriteClusters(cls []terra.Cluster) error

WriteClusters will take a list of terra.Cluster interfaces them and issue POST requests to create both the cluster and any releases within that cluster. 409 Conflict responses are ignored

func (*Client) WriteEnvironments added in v0.0.63

func (c *Client) WriteEnvironments(envs []terra.Environment) ([]string, error)

WriteEnvironments will take a list of terra.Environment interfaces them and issue POST requests to write both the environment and any releases within that environment. 409 Conflict responses are ignored

type Cluster

type Cluster struct {
	*models.SherlockClusterV3
}

type Clusters

type Clusters []Cluster

type Environment

type Environment struct {
	*models.V2controllersEnvironment
}

type Environments

type Environments []Environment

type Release

type Release struct {
	*models.V2controllersChartRelease
}

type Releases

type Releases []Release

type StateLoader

type StateLoader interface {
	Environments() (Environments, error)
	Clusters() (Clusters, error)
	Releases() (Releases, error)
}

type StateReadWriter added in v0.0.72

type StateReadWriter interface {
	StateLoader
	StateWriter
}

StateReadWriter is an interface representing the ability to both read and create/update thelma's internal state using a sherlock client

type StateWriter added in v0.0.71

type StateWriter interface {
	terra.StateWriter

	// CreateEnvironmentFromTemplate has the same *effect* as WriteEnvironments for the narrow case of creating a
	// BEE from a template, but it relies entirely on Sherlock for the template-default logic.
	// All the desired fields can be left blank to let Sherlock's defaulting behavior take over.
	// The name of the new environment is returned.
	// Of note here is that calling this function doesn't touch Thelma's in-memory state, only Sherlock's state.
	// Thelma's in-memory state will need to be reloaded to work with the newly-created environment.
	CreateEnvironmentFromTemplate(templateName string, options terra.CreateOptions) (string, error)

	// PinEnvironmentVersions adapts Thelma's pin-override pattern to Sherlock's changeset pattern to apply specific
	// versions to chart releases in an environment.
	PinEnvironmentVersions(environmentName string, versions map[string]terra.VersionOverride) error

	// SetTerraHelmfileRefForEntireEnvironment sets it both for the environment itself and for every chart release it
	// contains. This generally matches the semantics of Thelma's old state bucket, where the environment's value
	// would be used for chart releases if they didn't have their own override. Sherlock enforces that every chart
	// release always contain its own version information, so the closest we can get is just set that value to what
	// we're given here.
	SetTerraHelmfileRefForEntireEnvironment(environment terra.Environment, terraHelmfileRef string) error

	// ResetEnvironmentAndPinToDev is a temporary-ish hack implementation of what Thelma could do with state bucket
	// overrides. Because overrides were stored separately, Thelma could drop them, leading to really nice pin-and-
	// unpin semantics. Sherlock doesn't have this notion, at least not right now. Versions just are, and while this
	// allows cool things like following a specific branch, Sherlock doesn't currently have a mechanism to go back to
	// some default set of versions. The closest we can get is effectively re-pinning the environment to dev. We can
	// think about adding this to Sherlock in the future, because it does have some default-version mechanisms, they're
	// just not exposed in the API like how unpinning would expect.
	ResetEnvironmentAndPinToDev(environment terra.Environment) error

	// SetEnvironmentOffline controls the "offline" flag on a given environment.
	// Of note here is that calling this function doesn't touch Thelma's in-memory state, only Sherlock's state.
	// Thelma's in-memory state will need to be reloaded to work with the mutated environment.
	SetEnvironmentOffline(environmentName string, offline bool) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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