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 ¶
- func IsUnavailable(target *fleet.BundleDeployment) bool
- func MaxUnavailable(targets []*Target) (int, error)
- func MaxUnavailablePartitions(partitions []Partition, targets []*Target) (int, error)
- func Summary(targets []*Target) fleet.BundleSummary
- func Unavailable(targets []*Target) (count int)
- func UpdateStatusUnavailable(status *fleet.PartitionStatus, targets []*Target) bool
- type BundleMapping
- type Manager
- func (m *Manager) BundleFromDeployment(bd *fleet.BundleDeployment) (string, string)
- func (m *Manager) BundlesForCluster(cluster *fleet.Cluster) (bundlesToRefresh, bundlesToCleanup []*fleet.Bundle, err error)
- func (m *Manager) GetBundleDeploymentsForBundleInCluster(bundle *fleet.Bundle, cluster *fleet.Cluster) (result []*fleet.BundleDeployment, err error)
- func (m *Manager) StoreManifest(manifest *manifest.Manifest) (string, error)
- func (m *Manager) Targets(bundle *fleet.Bundle, manifest *manifest.Manifest) ([]*Target, error)
- type Partition
- type Target
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 ¶
MaxUnavailable returns the maximum number of unavailable deployments given the targets rollout strategy (pure function)
func MaxUnavailablePartitions ¶
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 ¶
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 NewBundleMapping ¶
func NewBundleMapping(mapping *fleet.BundleNamespaceMapping, namespaces corecontrollers.NamespaceCache, bundles fleetcontrollers.BundleCache) (*BundleMapping, error)
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 New ¶
func New( clusters fleetcontrollers.ClusterCache, clusterGroups fleetcontrollers.ClusterGroupCache, bundles fleetcontrollers.BundleCache, bundleNamespaceMappingCache fleetcontrollers.BundleNamespaceMappingCache, namespaceCache corecontrollers.NamespaceCache, contentStore manifest.Store, bundleDeployments fleetcontrollers.BundleDeploymentCache) *Manager
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 (*Manager) GetBundleDeploymentsForBundleInCluster ¶
func (*Manager) StoreManifest ¶
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 ¶
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 ¶
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 }