deployer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 10 Imported by: 10 modules, 15 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClient

func GetClient(ctx context.Context, l logr.Logger, c client.Client, numOfWorker int) *deployer

GetClient return a deployer client, implementing the DeployerInterface

func GetKey

func GetKey(clusterNamespace, clusterName, applicant, featureID string, clusterType sveltosv1.ClusterType, cleanup bool) string

GetKey returns a unique ID for a request provided: - clusterNamespace and clusterName which are the namespace/name of the cluster where feature needs to be deployed; - featureID is a unique identifier for the feature that needs to be deployed.

Types

type DeployerInterface

type DeployerInterface interface {
	// RegisterFeatureID allows registering a feature ID.
	// If a featureID is already registered, it returns an error.
	RegisterFeatureID(
		featureID string,
	) error

	// Deploy creates a request to deploy/cleanup a feature in a given
	// CAPI cluster (identified by clusterNamespace, clusterName).
	// cleanup indicates whether request is for feature to be provisioned
	// or removed.
	// When worker is available to fulfill such request, RequestHandler
	// will be invoked in the worker context.
	// If featureID is not registered, an error will be returned.
	// Applicant is an identifier of whatever is making this request.
	// It can be left empty (in case there is no need to differentiate between
	// different applicants).
	Deploy(
		ctx context.Context,
		clusterNamespace, clusterName, applicant, featureID string,
		clusterType sveltosv1.ClusterType,
		cleanup bool,
		f RequestHandler,
		m MetricHandler,
		o Options,
	) error

	// IsInProgress returns true, if featureID for clusterNamespace/clusterName
	// requested by applicant is currently in progress.
	// cleanup indicates whether request for feature to be provisioned or
	// removed is currently in progress.
	IsInProgress(
		clusterNamespace, clusterName, applicant, featureID string,
		clusterType sveltosv1.ClusterType,
		cleanup bool,
	) bool

	// GetResult returns result for a given request.
	GetResult(
		ctx context.Context,
		clusterNamespace, clusterName, applicant, featureID string,
		clusterType sveltosv1.ClusterType,
		cleanup bool,
	) Result

	// CleanupEntries removes any entry (from any internal data structure) for
	// given feature
	CleanupEntries(clusterNamespace, clusterName, applicant, featureID string,
		clusterType sveltosv1.ClusterType, cleanup bool)
}

type MetricHandler

type MetricHandler func(elapsed time.Duration,
	clusterNamespace, clusterName, featureID string,
	clusterType sveltosv1.ClusterType, logger logr.Logger)

type Options added in v0.3.0

type Options struct {
	HandlerOptions map[string]string
}

type RequestHandler

type RequestHandler func(ctx context.Context, c client.Client,
	clusterNamespace, clusterName, applicant, featureID string,
	clusterType sveltosv1.ClusterType, o Options, logger logr.Logger) error

type Result

type Result struct {
	ResultStatus
	Err error
}

type ResultStatus

type ResultStatus int64
const (
	Deployed ResultStatus = iota
	InProgress
	Failed
	Removed
	Unavailable
)

func (ResultStatus) String

func (r ResultStatus) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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