deployer

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

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) *deployer

GetClient return a deployer client, implementing the DeployerInterface

func GetKey

func GetKey(clusterNamespace, clusterName, applicant, featureID string) string

GetKey returns a unique ID for a request provided: - clusterNamespace and clusterName which are the namespace/name of the CAPI 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 a feature in a given
	// CAPI cluster (identified by clusterNamespace, clusterName).
	// 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,
		f RequestHandler,
	) error

	// GetResult returns result for a given request.
	GetResult(
		ctx context.Context,
		clusterNamespace, clusterName, applicant, featureID string,
	) Result
}

type RequestHandler

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

type Result

type Result struct {
	ResultStatus
	Err error
}

type ResultStatus

type ResultStatus int64
const (
	Deployed ResultStatus = iota
	InProgress
	Failed
	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