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 BundleFromDeployment(labels map[string]string) (string, string)
- func MaxUnavailable(targets []*Target) (int, error)
- func Summary(targets []*Target) fleet.BundleSummary
- func Unavailable(targets []*Target) (count int)
- func UpdatePartitions(status *fleet.BundleStatus, allTargets []*Target) (err error)
- type BundleMapping
- func (b *BundleMapping) Bundles(ctx context.Context, c client.Client) ([]*fleet.Bundle, error)
- func (b *BundleMapping) Matches(bundle *fleet.Bundle) bool
- func (b *BundleMapping) MatchesNamespace(ctx context.Context, c client.Client, namespace string) bool
- func (b *BundleMapping) Namespaces(ctx context.Context, c client.Client) ([]corev1.Namespace, error)
- type Manager
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BundleFromDeployment ¶ added in v0.10.0
BundleFromDeployment returns the namespace and name of the bundle that created the bundledeployment
func MaxUnavailable ¶
MaxUnavailable returns the maximum number of unavailable deployments given the targets rollout strategy (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 UpdatePartitions ¶ added in v0.10.0
func UpdatePartitions(status *fleet.BundleStatus, allTargets []*Target) (err error)
UpdatePartitions recomputes status, including partitions, from data in allTargets. It creates Deployments in allTargets if they are missing. It updates Deployments in allTargets if they are out of sync (DeploymentID != StagedDeploymentID).
Types ¶
type BundleMapping ¶
type BundleMapping struct {
// contains filtered or unexported fields
}
BundleMapping is created from a BundleNamespaceMapping resource
func (*BundleMapping) MatchesNamespace ¶
func (*BundleMapping) Namespaces ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) BundlesForCluster ¶
func (*Manager) Targets ¶
func (m *Manager) Targets(ctx context.Context, bundle *fleet.Bundle, manifestID string) ([]*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, which includes the "TargetCustomizations" from fleet.yaml. Finally all existing bundledeployments are added to the targets.
type Target ¶
type Target struct { Deployment *fleet.BundleDeployment ClusterGroups []*fleet.ClusterGroup Cluster *fleet.Cluster Bundle *fleet.Bundle Options fleet.BundleDeploymentOptions DeploymentID string }
func (*Target) BundleDeployment ¶ added in v0.10.0
func (t *Target) BundleDeployment() *fleet.BundleDeployment
BundleDeployment returns a new bd, it discards annotations, status, etc. The labels are copied from the Bundle.