chartsync

package
v1.0.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: Apache-2.0 Imports: 36 Imported by: 2

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.

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, 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 up
  each chart that makes use of the mirror that has new commits,
  replacing the clone for that chart, and scheduling a new 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    = "HelmUpgradeFailed"
	ReasonRollbackFailed   = "HelmRollbackFailed"
	ReasonCloned           = "GitRepoCloned"
	ReasonSuccess          = "HelmSuccess"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartChangeSync

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

func New

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

func (*ChartChangeSync) CompareValuesChecksum

func (chs *ChartChangeSync) CompareValuesChecksum(hr helmfluxv1.HelmRelease) bool

CompareValuesChecksum recalculates the checksum of the values and compares it to the last recorded checksum.

func (*ChartChangeSync) DeleteRelease

func (chs *ChartChangeSync) DeleteRelease(hr helmfluxv1.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(hr helmfluxv1.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) RollbackRelease

func (chs *ChartChangeSync) RollbackRelease(hr helmfluxv1.HelmRelease)

RollbackRelease rolls back a helm release

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.

func (*ChartChangeSync) SyncMirrors

func (chs *ChartChangeSync) SyncMirrors()

SyncMirrors instructs all mirrors to refresh from their upstream.

type Clients

type Clients struct {
	KubeClient kubernetes.Clientset
	IfClient   ifclientset.Clientset
	HrLister   iflister.HelmReleaseLister
}

type Config

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

func (Config) WithDefaults

func (c Config) WithDefaults() Config

type ReleaseQueue

type ReleaseQueue interface {
	AddRateLimited(item interface{})
}

ReleaseQueue is an add-only workqueue.RateLimitingInterface

Jump to

Keyboard shortcuts

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