sherlock

package
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: BSD-3-Clause Imports: 19 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.
	//
	// First, it reports the new chart version to Sherlock. Sherlock will now most likely use that version as the
	// new "latest" chart version, unless Sherlock's handling for replay-requests or concurrency control kicks in.
	//
	// If and only if that first step succeeds, each chart release is set to use the latest chart version. Sherlock
	// automatically recalculates the latest version for each chart release, even if it was already set to use latest.
	// Any version changes are applied automatically, assuming Thelma's authentication has sufficient access for the
	// chart releases requested. If any part of this second step fails, the entire second step will have no effect.
	//
	// Lastly, Thelma looks up any template instances of this chart that are following the latest version of this chart,
	// which would've just gotten updated. Thelma will issue a refresh for any such instances, so that directly
	// template manifests will correctly have the new version.
	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) 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.V2controllersCluster
}

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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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