helm

package
v0.0.0-...-79f7847 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProfileListKey  = "singleuser.profileList"
	EnvKey          = "env"
	KnauditImageKey = "knauditImage,omit"
)
View Source
const (
	// DefaultHelmDriver is set to secrets, which is the default
	// for Helm 3: https://helm.sh/docs/topics/advanced/#storage-backends
	DefaultHelmDriver = "secrets"
)

Variables

This section is empty.

Functions

func ParseString

func ParseString(value any) (any, error)

func ParseValue

func ParseValue(value any) (any, error)

func SetChartValue

func SetChartValue(keys []string, value any, chart map[string]any)

func SplitEnv

func SplitEnv(envs []string) map[string]string

SplitEnv returns the split envvars

func UnmarshalToValues

func UnmarshalToValues(data []byte) (map[string]interface{}, error)

UnmarshalToValues takes a byte slice and unmarshalls it into a map, which is what Helm's API expects

Types

type AirflowEnricher

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

func NewAirflowEnricher

func NewAirflowEnricher(teamID string, store AirflowEnricherStore) *AirflowEnricher

func (*AirflowEnricher) Enrich

func (e *AirflowEnricher) Enrich(ctx context.Context, values map[string]any) (map[string]any, error)

type AirflowEnricherStore

type AirflowEnricherStore interface {
	GlobalValueGet(ctx context.Context, chartType gensql.ChartType, key string) (gensql.ChartGlobalValue, error)
	TeamValueGet(ctx context.Context, key, teamID string) (gensql.ChartTeamValue, error)
}

type Applier

type Applier interface {
	// Apply will either install or upgrade a chart depending on the
	// state of the release in the cluster
	Apply(ctx context.Context, loader ChartLoader, opts *ApplyOpts) error
}

type ApplyOpts

type ApplyOpts struct {
	ReleaseName string
	Namespace   string
}

type ChainEnricher

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

func NewChainEnricher

func NewChainEnricher(enrichers ...Enricher) *ChainEnricher

func (*ChainEnricher) Enrich

func (e *ChainEnricher) Enrich(ctx context.Context, values map[string]any) (map[string]any, error)

type Chart

type Chart struct {
	RepositoryName string
	RepositoryURL  string

	ReleaseName string
	Version     string
	Chart       string
	Namespace   string

	Timeout time.Duration

	Values interface{}
}

Chart contains the state for installing a chart

type ChartFetcher

type ChartFetcher interface {
	Fetch(ctx context.Context, repo, chartName, version string) (*chart.Chart, error)
}

type ChartLoader

type ChartLoader interface {
	// Load a chart from a source
	Load(ctx context.Context) (*chart.Chart, error)
}

type ChartUpdater

type ChartUpdater interface {
	Update(ctx context.Context) error
}

type ClassicLoader

type ClassicLoader struct {
	RepositoryName string
	ChartName      string
	Version        string
	// contains filtered or unexported fields
}

func NewClassicLoader

func NewClassicLoader(repositoryName, chartName, version string, fetcher ChartFetcher, enricher Enricher) *ClassicLoader

func (*ClassicLoader) Load

func (l *ClassicLoader) Load(ctx context.Context) (*chart.Chart, error)

type Client

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

func NewClient

func NewClient(config *Config, repo *database.Repo) (*Client, error)

func (*Client) InstallOrUpgrade

func (c *Client) InstallOrUpgrade(ctx context.Context, ev *EventData) error

func (*Client) Rollback

func (c *Client) Rollback(ctx context.Context, helmEvent *EventData) error

func (*Client) Uninstall

func (c *Client) Uninstall(ctx context.Context, helmEvent *EventData) error

type Config

type Config struct {
	KubeContext      string
	KubeConfig       string
	Debug            bool
	RepositoryConfig string

	DryRun bool

	Out io.Writer
	Err io.Writer
}

func (*Config) ToHelmEnvs

func (c *Config) ToHelmEnvs() map[string]string

type DeclarativeLoader

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

func (*DeclarativeLoader) Load

func (d *DeclarativeLoader) Load(_ context.Context) (map[string]any, error)

type DeleteOpts

type DeleteOpts struct {
	ReleaseName string
	Namespace   string
}

type Deleter

type Deleter interface {
	// Delete will remove a release from the cluster
	Delete(ctx context.Context, opts *DeleteOpts) error
}

type Enricher

type Enricher interface {
	Enrich(ctx context.Context, values map[string]any) (map[string]any, error)
}

type ErrRollback

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

func NewErrRollback

func NewErrRollback(err error) *ErrRollback

func (*ErrRollback) Error

func (e *ErrRollback) Error() string

func (*ErrRollback) Unwrap

func (e *ErrRollback) Unwrap() error

type EventData

type EventData struct {
	TeamID       string
	Namespace    string
	ReleaseName  string
	ChartType    gensql.ChartType
	ChartRepo    string
	ChartName    string
	ChartVersion string
}

type GlobalEnricher

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

func NewGlobalEnricher

func NewGlobalEnricher(chartType gensql.ChartType, store GlobalEnricherStore) *GlobalEnricher

func (*GlobalEnricher) Enrich

func (g *GlobalEnricher) Enrich(ctx context.Context, values map[string]any) (map[string]any, error)

type GlobalEnricherStore

type GlobalEnricherStore interface {
	GlobalValuesGet(ctx context.Context, chartType gensql.ChartType) ([]gensql.ChartGlobalValue, error)
	DecryptValue(encValue string) (string, error)
}

type Helm

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

func NewHelm

func NewHelm(config *Config) *Helm

func (*Helm) Apply

func (h *Helm) Apply(ctx context.Context, loader ChartLoader, opts *ApplyOpts) error

func (*Helm) Delete

func (h *Helm) Delete(_ context.Context, opts *DeleteOpts) error

func (*Helm) Fetch

func (h *Helm) Fetch(_ context.Context, repo, chartName, version string) (*chart.Chart, error)

func (*Helm) Rollback

func (h *Helm) Rollback(_ context.Context, opts *RollbackOpts) error

func (*Helm) Update

func (h *Helm) Update(_ context.Context) error

type JupyterhubEnricher

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

func NewJupyterhubEnricher

func NewJupyterhubEnricher(teamID string, store JupyterhubEnricherStore) *JupyterhubEnricher

func (*JupyterhubEnricher) Enrich

func (e *JupyterhubEnricher) Enrich(ctx context.Context, values map[string]any) (map[string]any, error)

type JupyterhubEnricherStore

type JupyterhubEnricherStore interface {
	TeamValueGet(ctx context.Context, key, teamID string) (gensql.ChartTeamValue, error)
	GlobalValueGet(ctx context.Context, chartType gensql.ChartType, key string) (gensql.ChartGlobalValue, error)
}

type Marshaller

type Marshaller interface {
	MarshalYAML() ([]byte, error)
}

Marshaller provides an interface for returning YAML

type Operations

type Operations interface {
	Applier
	Deleter
	Rollbacker
	ChartFetcher
	ChartUpdater
}

type RestoreEnvFn

type RestoreEnvFn func() error

RestoreEnvFn can be deferred in the calling function and will return the environment to its original state

func EstablishEnv

func EstablishEnv(envs map[string]string, keepEnvs ...string) (RestoreEnvFn, error)

EstablishEnv provides functionality for setting a safe environment, this is required, because helm for some reason, loves fetching everything from environment variables

type RollbackOpts

type RollbackOpts struct {
	ReleaseName string
	Namespace   string
}

type Rollbacker

type Rollbacker interface {
	Rollback(ctx context.Context, opts *RollbackOpts) error
}

type StreamRender

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

func NewStreamRenderer

func NewStreamRenderer(out io.Writer) *StreamRender

func (*StreamRender) Run

func (r *StreamRender) Run(renderedManifests *bytes.Buffer) (*bytes.Buffer, error)

type TeamEnricher

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

func NewTeamEnricher

func NewTeamEnricher(chartType gensql.ChartType, teamID string, store TeamEnricherStore) *TeamEnricher

func (TeamEnricher) Enrich

func (e TeamEnricher) Enrich(ctx context.Context, values map[string]any) (map[string]any, error)

type TeamEnricherStore

type TeamEnricherStore interface {
	TeamValuesGet(ctx context.Context, chartType gensql.ChartType, teamID string) ([]gensql.ChartTeamValue, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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