clusters

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: UPL-1.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MCLocalRegistrationSecretFullName = types.NamespacedName{
	Namespace: constants.VerrazzanoSystemNamespace,
	Name:      constants.MCLocalRegistrationSecret}

MCLocalRegistrationSecretFullName is the full NamespacedName of the cluster local registration secret

View Source
var MCRegistrationSecretFullName = types.NamespacedName{
	Namespace: constants.VerrazzanoSystemNamespace,
	Name:      constants.MCRegistrationSecret}

MCRegistrationSecretFullName is the full NamespacedName of the cluster registration secret

Functions

func AddFinalizer added in v0.13.0

func AddFinalizer(ctx context.Context, r client.Client, obj client.Object, finalizerName string) (controllerruntime.Result, error)

AddFinalizer adds a finalizer and updates the resource if that finalizer is not already attached to the resource

func ComputeEffectiveState

ComputeEffectiveState computes the overall state of the multi cluster resource from the statuses at the level of the individual clusters it is placed in

func CreateClusterLevelStatus

func CreateClusterLevelStatus(condition clustersv1alpha1.Condition, clusterName string) clustersv1alpha1.ClusterLevelStatus

CreateClusterLevelStatus creates and returns a ClusterLevelStatus object based on the condition of an operation on a cluster

func DeleteAssociatedResource added in v0.13.0

func DeleteAssociatedResource(ctx context.Context, c client.Client, mcResource client.Object, finalizerName string, resourceToDelete client.Object, name types.NamespacedName) error

DeleteAssociatedResource will retrieve and delete the resource specified by the name. It is used to delete the underlying resource corresponding to a MultiClusterxxx wrapper resource (e.g. the OAM app config corresponding to a MultiClusterApplicationConfiguration)

func GetClusterName

func GetClusterName(ctx context.Context, rdr client.Reader) string

GetClusterName returns the cluster name for a this cluster, empty string if the cluster name cannot be determined due to an error.

func GetConditionFromResult

func GetConditionFromResult(err error, opResult controllerutil.OperationResult, msgPrefix string) clustersv1alpha1.Condition

GetConditionFromResult - Based on the result of a create/update operation on the embedded resource, returns the Condition and State that must be set on a MultiCluster resource's Status

func GetRandomRequeueDelay added in v0.14.0

func GetRandomRequeueDelay() time.Duration

GetRandomRequeueDelay returns a random delay to be used for RequeueAfter

func GetResourceLogger added in v1.2.0

func GetResourceLogger(controller string, namespacedName types.NamespacedName, obj client.Object) (vzlog.VerrazzanoLogger, error)

GetResourceLogger will return the controller logger associated with the resource

func IgnoreNotFoundWithLog

func IgnoreNotFoundWithLog(err error, log *zap.SugaredLogger) (reconcile.Result, error)

IgnoreNotFoundWithLog returns nil if err is a "Not Found" error, and if not, logs an error message that the resource could not be fetched and returns the original error

func IsPlacedInThisCluster

func IsPlacedInThisCluster(ctx context.Context, rdr client.Reader, placement clustersv1alpha1.Placement) bool

IsPlacedInThisCluster determines whether the given Placement represents placement in the current cluster. Current cluster's identity is determined from the verrazzano-cluster secret

func NewRequeueWithDelay added in v1.2.0

func NewRequeueWithDelay() reconcile.Result

NewRequeueWithDelay retruns a result set to requeue in 2 to 3 seconds

func NewScheme

func NewScheme() *runtime.Scheme

NewScheme creates a new scheme that includes this package's object to use for testing

func SetClusterLevelStatus

func SetClusterLevelStatus(status *clustersv1alpha1.MultiClusterResourceStatus, newClusterStatus clustersv1alpha1.ClusterLevelStatus)

SetClusterLevelStatus - given a multi cluster resource status object, and a new cluster status to be updated, either add or update the cluster status as appropriate

func SetEffectiveStateIfChanged

func SetEffectiveStateIfChanged(placement clustersv1alpha1.Placement,
	statusPtr *clustersv1alpha1.MultiClusterResourceStatus) clustersv1alpha1.StateType

SetEffectiveStateIfChanged - if the effective state of the resource has changed, set it on the in-memory multicluster resource's status. Returns the previous state, whether changed or not

func ShouldRequeue added in v1.2.0

func ShouldRequeue(r reconcile.Result) bool

ShouldRequeue returns true if requeue is needed

func StatusNeedsUpdate

func StatusNeedsUpdate(curStatus clustersv1alpha1.MultiClusterResourceStatus,
	newCondition clustersv1alpha1.Condition,
	newClusterStatus clustersv1alpha1.ClusterLevelStatus) bool

StatusNeedsUpdate determines based on the current state and conditions of a MultiCluster resource, as well as the new state and condition to be set, whether the status update needs to be done

func UpdateStatus

func UpdateStatus(resource MultiClusterResource, mcStatus *clustersv1alpha1.MultiClusterResourceStatus, placement clustersv1alpha1.Placement, newCondition clustersv1alpha1.Condition, clusterName string, agentChannel chan StatusUpdateMessage, updateFunc func() error) (controllerruntime.Result, error)

UpdateStatus determines whether a status update is needed for the specified mcStatus, given the new Condition to be added, and if so, computes the state and calls the callback function to perform the status update

Types

type ElasticsearchDetails

type ElasticsearchDetails struct {
	URL        string
	SecretName string
}

ElasticsearchDetails represents all the details needed to determine how to connect to an Elasticsearch instance

type MultiClusterResource

type MultiClusterResource interface {
	runtime.Object
	GetName() string
	GetNamespace() string
	GetPlacement() clustersv1alpha1.Placement
	GetStatus() clustersv1alpha1.MultiClusterResourceStatus
}

MultiClusterResource interface abstracts methods common to all MultiClusterXXX resource types It is defined outside the api resources package since deep-copy code generation cannot handle interface types

type StatusUpdateMessage

type StatusUpdateMessage struct {
	NewCondition     clustersv1alpha1.Condition
	NewClusterStatus clustersv1alpha1.ClusterLevelStatus
	Resource         MultiClusterResource
}

StatusUpdateMessage represents a message sent to the Multi Cluster agent by the controllers when a MultiCluster Resource's status is updated, with the updates

Jump to

Keyboard shortcuts

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