model

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SyncStatusResources

func SyncStatusResources(
	s riskifiedv1alpha1.ResourceStatus,
	currentStatuses []riskifiedv1alpha1.ResourceStatus,
) (modified bool, result []riskifiedv1alpha1.ResourceStatus)

Types

type CleanupManager

type CleanupManager struct {
	client.Client
	Log logr.Logger
	DE  *riskifiedv1alpha1.DynamicEnv
}

CleanupManager is a handler that deals with removing DynamicEnv resources.

func (*CleanupManager) CheckForRemovedSubsetsAndConsumers

func (cm *CleanupManager) CheckForRemovedSubsetsAndConsumers(subsetsAndConsumers []SubsetType) SubsetsAndConsumersMap

Checks for subsets and consumers that should be removed because of spec update.

func (*CleanupManager) DeleteAllResources

func (cm *CleanupManager) DeleteAllResources(ctx context.Context) (ctrl.Result, error)

DeleteAllResources handles the removal of all resources created by the controller + the finalizers.

func (*CleanupManager) RemoveSubsetsAndConsumers

func (cm *CleanupManager) RemoveSubsetsAndConsumers(ctx context.Context, subsetsAndConsumers SubsetsAndConsumersMap) (inProgress bool, _ error)

Removes the provided subsets and consumers. Returns whether there are deletions in progress and an error if occurred. You can use the output of CheckForRemovedSubsetsAndConsumers as an input.

type DynamicEnvReconcileData

type DynamicEnvReconcileData struct {
	// The name/namespace of the current custom resource.
	Identifier types.NamespacedName
	// The deployment we're creating subsets for.
	BaseDeployment *appsv1.Deployment
	// The current subset/consumer we're processing
	Subset riskifiedv1alpha1.Subset
	// StatusManager
	StatusManager *StatusManager
	// The matches used for this resource
	Matches []riskifiedv1alpha1.IstioMatch
}

A data structure that contains a lot of the state that is passed from `Reconcile` to various handlers / processors. Used to reduce clutter.

type NonMaskingError

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

A struct to prevent masking one error with different (less important) one

func (*NonMaskingError) ForceError

func (err *NonMaskingError) ForceError(e error)

Set error regardless on current error

func (*NonMaskingError) Get

func (err *NonMaskingError) Get() error

func (*NonMaskingError) IsNil

func (err *NonMaskingError) IsNil() bool

func (*NonMaskingError) SetIfNotMasking

func (err *NonMaskingError) SetIfNotMasking(e error)

Only set the error if error is nil

type StatusManager

type StatusManager struct {
	client.Client
	DynamicEnv *riskifiedv1alpha1.DynamicEnv
}

A handler for managing `DynamicEnv` Status.

func (*StatusManager) AddDeploymentStatusEntry

func (sm *StatusManager) AddDeploymentStatusEntry(ctx context.Context, subset string, newStatus riskifiedv1alpha1.ResourceStatus, tpe riskifiedv1alpha1.SubsetOrConsumer) error

Adds (or updates) a status entry to the *Deployments* status section (if not exists).

func (*StatusManager) AddDestinationRuleStatusEntry

func (sm *StatusManager) AddDestinationRuleStatusEntry(ctx context.Context, subset string, newStatus riskifiedv1alpha1.ResourceStatus) error

Add a status entry to the *DestinationRules* status section (if not exists).

func (*StatusManager) AddGlobalVirtualServiceError

func (sm *StatusManager) AddGlobalVirtualServiceError(ctx context.Context, subset, msg string) error

func (*StatusManager) AddVirtualServiceStatusEntry

func (sm *StatusManager) AddVirtualServiceStatusEntry(ctx context.Context, subset string, newStatus riskifiedv1alpha1.ResourceStatus) error

Add a status entry to the *VirtualServices* status section (if not exists).

func (*StatusManager) ApplyHash

func (sm *StatusManager) ApplyHash(ctx context.Context, name string, hash uint64, tpe riskifiedv1alpha1.SubsetOrConsumer) error

func (*StatusManager) GetHashForConsumer

func (sm *StatusManager) GetHashForConsumer(name string) uint64

func (*StatusManager) GetHashForSubset

func (sm *StatusManager) GetHashForSubset(name string) uint64

func (*StatusManager) SetGlobalState

func (sm *StatusManager) SetGlobalState(ctx context.Context, state riskifiedv1alpha1.GlobalReadyStatus, totalCount int, notReadyCount int) error

func (*StatusManager) SyncConsumerMessagesToStatus

func (sm *StatusManager) SyncConsumerMessagesToStatus(messages map[string][]string)

func (*StatusManager) SyncSubsetMessagesToStatus

func (sm *StatusManager) SyncSubsetMessagesToStatus(messages map[string]riskifiedv1alpha1.SubsetMessages)

type SubsetType

type SubsetType struct {
	Type   riskifiedv1alpha1.SubsetOrConsumer
	Subset riskifiedv1alpha1.Subset
}

type SubsetsAndConsumersMap

type SubsetsAndConsumersMap = map[string]riskifiedv1alpha1.SubsetOrConsumer

Jump to

Keyboard shortcuts

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