target

package
v0.8.4-rc.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package target provides functionality around building and deploying bundledeployments.

Each "Target" represents a bundle, cluster pair and will be transformed into a bundledeployment. The manifest, persisted in the content resource, contains the resources available to these bundledeployments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUnavailable

func IsUnavailable(target *fleet.BundleDeployment) bool

IsUnavailable checks if target is not available (pure function)

func MaxUnavailable

func MaxUnavailable(targets []*Target) (int, error)

MaxUnavailable returns the maximum number of unavailable deployments given the targets rollout strategy (pure function)

func MaxUnavailablePartitions

func MaxUnavailablePartitions(partitions []Partition, targets []*Target) (int, error)

MaxUnavailablePartitions returns the maximum number of unavailable partitions given the targets and partitions (pure function)

func Summary

func Summary(targets []*Target) fleet.BundleSummary

Summary calculates a fleet.BundleSummary from targets (pure function)

func Unavailable

func Unavailable(targets []*Target) (count int)

Unavailable counts the number of targets that are not available (pure function)

func UpdateStatusUnavailable

func UpdateStatusUnavailable(status *fleet.PartitionStatus, targets []*Target) bool

UpdateStatusUnavailable recomputes and sets the status.Unavailable counter and returns true if the partition is unavailable, eg. there are more unavailable targets than the maximum set (does not mutate targets)

Types

type BundleMapping

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

func (*BundleMapping) Bundles

func (b *BundleMapping) Bundles() ([]*fleet.Bundle, error)

func (*BundleMapping) Matches

func (b *BundleMapping) Matches(fleetBundle *fleet.Bundle) bool

func (*BundleMapping) MatchesNamespace

func (b *BundleMapping) MatchesNamespace(namespace string) bool

func (*BundleMapping) Namespaces

func (b *BundleMapping) Namespaces() ([]*corev1.Namespace, error)

type Manager

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

func (*Manager) BundleFromDeployment

func (m *Manager) BundleFromDeployment(bd *fleet.BundleDeployment) (string, string)

BundleFromDeployment returns the namespace and name of the bundle that created the bundledeployment

func (*Manager) BundlesForCluster

func (m *Manager) BundlesForCluster(cluster *fleet.Cluster) (bundlesToRefresh, bundlesToCleanup []*fleet.Bundle, err error)

func (*Manager) GetBundleDeploymentsForBundleInCluster

func (m *Manager) GetBundleDeploymentsForBundleInCluster(bundle *fleet.Bundle, cluster *fleet.Cluster) (result []*fleet.BundleDeployment, err error)

func (*Manager) StoreManifest

func (m *Manager) StoreManifest(manifest *manifest.Manifest) (string, error)

StoreManifest stores the manifest as a content resource and returns the name. It copies the resources from the bundle to the content resource.

func (*Manager) Targets

func (m *Manager) Targets(bundle *fleet.Bundle, manifest *manifest.Manifest) ([]*Target, error)

Targets returns all targets for a bundle, so we can create bundledeployments for each. This is done by checking all namespaces for clusters matching the bundle's BundleTarget matchers.

The returned target structs contain merged BundleDeploymentOptions. Finally all existing bundledeployments are added to the targets.

type Partition

type Partition struct {
	Status  fleet.PartitionStatus
	Targets []*Target
}

func Partitions

func Partitions(targets []*Target) ([]Partition, error)

Partitions distributes targets into partitions based on the rollout strategy (pure function)

type Target

type Target struct {
	Deployment    *fleet.BundleDeployment
	ClusterGroups []*fleet.ClusterGroup
	Cluster       *fleet.Cluster
	Bundle        *fleet.Bundle
	Options       fleet.BundleDeploymentOptions
	DeploymentID  string
}

func (*Target) BundleDeploymentLabels

func (t *Target) BundleDeploymentLabels(clusterNamespace string, clusterName string) map[string]string

BundleDeploymentLabels builds all labels for a bundledeployment

func (*Target) IsPaused

func (t *Target) IsPaused() bool

func (*Target) ResetDeployment

func (t *Target) ResetDeployment()

ResetDeployment replaces the BundleDeployment for the target with a new one

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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