chartsync

package
v0.0.0-...-d1b097e Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

This package has the algorithm for making sure the Helm releases in the cluster match what are defined in the HelmRelease resources.

There are several ways they can be mismatched. Here's how they are reconciled:

1a. There is a HelmRelease resource, but no corresponding
  release. This can happen when the helm operator is first run, for
  example. The ChartChangeSync periodically checks for this by
  running through the resources and installing any that aren't
  released already.

1b. The release corresponding to a HelmRelease has been updated by
  some other means, perhaps while the operator wasn't running. This
  is also checked periodically, by doing a dry-run release and
  comparing the result to the release.

2. The chart has changed in git, meaning the release is out of
  date. The ChartChangeSync responds to new git commits by looking at
  each chart that's referenced by a HelmRelease, and if it's
  changed since the last seen commit, updating the release.

1a.) and 1b.) run on the same schedule, and 2.) is run when a git mirror reports it has fetched from upstream _and_ (upon checking) the head of the branch has changed.

Since both 1*.) and 2.) look at the charts in the git repo, but run on different schedules (non-deterministically), there's a chance that they can fight each other. For example, the git mirror may fetch new commits which are used in 1), then treated as changes subsequently by 2). To keep consistency between the two, the current revision of a repo is used by 1), and advanced only by 2).

Index

Constants

View Source
const (
	// condition change reasons
	ReasonGitNotReady      = "GitRepoNotCloned"
	ReasonDownloadFailed   = "RepoFetchFailed"
	ReasonDownloaded       = "RepoChartInCache"
	ReasonInstallFailed    = "HelmInstallFailed"
	ReasonDependencyFailed = "UpdateDependencyFailed"
	ReasonUpgradeFailed    = "HelmUgradeFailed"
	ReasonCloned           = "GitRepoCloned"
	ReasonSuccess          = "HelmSuccess"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartChangeSync

type ChartChangeSync struct {
	Polling
	// contains filtered or unexported fields
}

func New

func New(logger log.Logger, polling Polling, clients Clients, release *release.Release, config Config, namespace string) *ChartChangeSync

func (*ChartChangeSync) DeleteRelease

func (chs *ChartChangeSync) DeleteRelease(fhr fluxv1beta1.HelmRelease)

DeleteRelease deletes the helm release associated with a HelmRelease. This exists mainly so that the operator code can call it when it is handling a resource deletion.

func (*ChartChangeSync) ReconcileReleaseDef

func (chs *ChartChangeSync) ReconcileReleaseDef(fhr fluxv1beta1.HelmRelease)

ReconcileReleaseDef asks the ChartChangeSync to examine the release associated with a HelmRelease, and install or upgrade the release if the chart it refers to has changed.

func (*ChartChangeSync) Run

func (chs *ChartChangeSync) Run(stopCh <-chan struct{}, errc chan error, wg *sync.WaitGroup)

Run creates a syncing loop that will reconcile differences between Helm releases in the cluster, what HelmRelease declare, and changes in the git repos mentioned by any HelmRelease.

type Clients

type Clients struct {
	KubeClient kubernetes.Clientset
	IfClient   ifclientset.Clientset
}

type Config

type Config struct {
	ChartCache string
	LogDiffs   bool
	UpdateDeps bool
	GitTimeout time.Duration
}

func (Config) WithDefaults

func (c Config) WithDefaults() Config

type Polling

type Polling struct {
	Interval time.Duration
}

Jump to

Keyboard shortcuts

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