chartsync

package
v0.0.0-...-c42b1bb Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: Apache-2.0 Imports: 20 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 FluxHelmRelease resources.

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

1a. There is a FluxHelmRelease 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 FluxHelmRelease 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 FluxHelmRelease, 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 the 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 is used by 1), and advanced only by 2).

Index

Constants

This section is empty.

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 helmop.RepoConfig, logReleaseDiffs bool) *ChartChangeSync

func (*ChartChangeSync) DeleteRelease

func (chs *ChartChangeSync) DeleteRelease(fhr ifv1.FluxHelmRelease)

DeleteRelease deletes the helm release associated with a FluxHelmRelease. 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 ifv1.FluxHelmRelease)

ReconcileReleaseDef asks the ChartChangeSync to examine the release associated with a FluxHelmRelease, compared to what is in the git repo, and install or upgrade the release if necessary. This may block indefinitely, so the caller provides a context which it can cancel if it gets tired of waiting. Returns an error if the context timed out or was canceled before the operation was started.

func (*ChartChangeSync) Run

func (chs *ChartChangeSync) Run(stopCh <-chan struct{}, errc chan error, wg *sync.WaitGroup)
Run creates a syncing loop monitoring repo chart changes. It is
assumed that the *git.Repo given to the config is ready to use
before this is invoked.

The behaviour if the git mirror becomes unavailable while it's running is not defined (this could be tightened up).

type Clients

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

type Polling

type Polling struct {
	Interval time.Duration
	Timeout  time.Duration
}

Jump to

Keyboard shortcuts

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