Documentation
¶
Index ¶
- Constants
- Variables
- type CloudResourceNpTracker
- type InProgress
- type NetworkPolicyController
- type NetworkPolicyReconciler
- func (r *NetworkPolicyReconciler) ExternalEntityStart(_ context.Context) error
- func (r *NetworkPolicyReconciler) GetNpTrackerIndexer() cache.Indexer
- func (r *NetworkPolicyReconciler) LocalEvent(event watch.Event)
- func (r *NetworkPolicyReconciler) Reconcile(_ context.Context, _ ctrl.Request) (ctrl.Result, error)
- func (r *NetworkPolicyReconciler) SetupWithManager(mgr ctrl.Manager, antreaKubeconfig string) error
- func (r *NetworkPolicyReconciler) Start(stop context.Context) error
- type PendingItem
- type PendingItemQueue
- func (q *PendingItemQueue) Add(id string, p PendingItem)
- func (q *PendingItemQueue) CheckToRun(forceRetry bool)
- func (q *PendingItemQueue) GetRetryCount(id string) int
- func (q *PendingItemQueue) Has(id string) bool
- func (q *PendingItemQueue) Remove(id string)
- func (q *PendingItemQueue) Update(id string, checkRun bool, updates ...interface{}) error
Constants ¶
const ( NpTrackerIndexerByNamespace = "Namespace" NpTrackerIndexerByNamespacedName = "NamespacedName" )
const ( InProgressStr = "in-progress" NoneStr = "<none>" )
const ( NetworkPolicyStatusApplied = "Applied" AppliedSecurityGroupDeleteError = "Detaching/Deleting security group %v: %v" )
Variables ¶
var ( AntreaProtocolMap = map[antreanetworking.Protocol]int{ antreanetworking.ProtocolTCP: 6, antreanetworking.ProtocolUDP: 17, antreanetworking.ProtocolSCTP: 132, } )
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 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.
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.