target

package
v0.10.0-rc.7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 25 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 BundleFromDeployment added in v0.10.0

func BundleFromDeployment(labels map[string]string) (string, string)

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

func MaxUnavailable

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

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

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

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) Bundles

func (b *BundleMapping) Bundles(ctx context.Context, c client.Client) ([]*fleet.Bundle, error)

func (*BundleMapping) Matches

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

func (*BundleMapping) MatchesNamespace

func (b *BundleMapping) MatchesNamespace(ctx context.Context, c client.Client, namespace string) bool

func (*BundleMapping) Namespaces

func (b *BundleMapping) Namespaces(ctx context.Context, c client.Client) ([]corev1.Namespace, error)

type Manager

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

func New

func New(client client.Client) *Manager

func (*Manager) BundlesForCluster

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

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. 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.

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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