networkpolicy

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NpTrackerIndexerByNamespace      = "Namespace"
	NpTrackerIndexerByNamespacedName = "NamespacedName"
)
View Source
const (
	InProgressStr = "in-progress"
	NoneStr       = "<none>"
)
View Source
const (
	NetworkPolicyStatusApplied      = "Applied"
	AppliedSecurityGroupDeleteError = "Detaching/Deleting security group %v: %v"
)

Variables

Functions

This section is empty.

Types

type CloudResourceNpTracker added in v0.6.0

type CloudResourceNpTracker struct {
	// CloudResource is a cloud resource.
	CloudResource cloudresource.CloudResource
	// NamespacedName of the cloud resource.
	NamespacedName types.NamespacedName

	// NpStatus map of network policy (ANP) name to their realization status.
	NpStatus map[string]*runtimev1alpha1.NetworkPolicyStatus
	// contains filtered or unexported fields
}

CloudResourceNpTracker tracks NetworkPolicies applied on cloud resource.

type InProgress

type InProgress struct{}

InProgress indicates a securityGroup operation is in progress.

func (*InProgress) Error

func (i *InProgress) Error() string

func (*InProgress) String

func (i *InProgress) String() string

type NetworkPolicyController

type NetworkPolicyController interface {
	LocalEvent(watch.Event)
}

type NetworkPolicyReconciler

type NetworkPolicyReconciler struct {
	client.Client
	Log    logr.Logger
	Scheme *runtime.Scheme

	Inventory inventory.Interface

	// CloudSyncInterval specifies the interval (in seconds) to be used for syncing cloud resources with controller.
	CloudSyncInterval int64
	// contains filtered or unexported fields
}

NetworkPolicyReconciler reconciles a NetworkPolicy object.

func (*NetworkPolicyReconciler) ExternalEntityStart

func (r *NetworkPolicyReconciler) ExternalEntityStart(_ context.Context) error

ExternalEntityStart performs the initialization of the controller. A controller is said to be initialized only when the dependent controllers are synced, and it keeps a count of pending CRs to be reconciled.

func (*NetworkPolicyReconciler) GetNpTrackerIndexer added in v0.6.0

func (r *NetworkPolicyReconciler) GetNpTrackerIndexer() cache.Indexer

func (*NetworkPolicyReconciler) LocalEvent

func (r *NetworkPolicyReconciler) LocalEvent(event watch.Event)

LocalEvent adds a network policy event from local stack.

func (*NetworkPolicyReconciler) Reconcile

Reconcile exists to cache ExternalEntities in shared informer.

func (*NetworkPolicyReconciler) SetupWithManager

func (r *NetworkPolicyReconciler) SetupWithManager(mgr ctrl.Manager, antreaKubeconfig string) error

SetupWithManager sets up NetworkPolicyReconciler with manager.

func (*NetworkPolicyReconciler) Start

Start starts NetworkPolicyReconciler.

type PendingItem

type PendingItem interface {
	// RunPendingItem runs this pending item, it returns true if item
	// should be removed.
	RunPendingItem(id string, context interface{}) bool
	// UpdatePendingItem updates ths pending item, returns
	UpdatePendingItem(id string, context interface{}, updates ...interface{})
	// RunOrDeletePendingItem returns run as true, if this item can be run;
	// returns delete as true, if this item shall be removed.
	RunOrDeletePendingItem(id string, context interface{}) (run bool, delete bool)
	// ClearPendingState clears item state when removing item from pending queue.
	ClearPendingState()
}

type PendingItemQueue

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

func NewPendingItemQueue

func NewPendingItemQueue(context interface{}, retryCount *int) *PendingItemQueue

NewPendingItemQueue returns a new PendingItemQueue. If retryCount is not provided, item is removed if item.RunOrDeletePendingItem returns true; if retryCount is provided, item is also removed when item.RunPendingItem is called.

func (*PendingItemQueue) Add

func (q *PendingItemQueue) Add(id string, p PendingItem)

Add a pending item to queue.

func (*PendingItemQueue) CheckToRun

func (q *PendingItemQueue) CheckToRun(forceRetry bool)

CheckToRun check and run all items on queue.

func (*PendingItemQueue) GetRetryCount

func (q *PendingItemQueue) GetRetryCount(id string) int

GetRetryCount returns remaining retryCount of item if applicable.

func (*PendingItemQueue) Has

func (q *PendingItemQueue) Has(id string) bool

Has returns true if an item in the queue.

func (*PendingItemQueue) Remove

func (q *PendingItemQueue) Remove(id string)

Remove a pending item from queue.

func (*PendingItemQueue) Update

func (q *PendingItemQueue) Update(id string, checkRun bool, updates ...interface{}) error

Update item and check to run item.

Jump to

Keyboard shortcuts

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