dualstack

package
v1.30.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsCollector

type MetricsCollector interface {
	CollectDualStackMigrationMetrics(key types.NegSyncerKey, committedEndpoints map[string]types.NetworkEndpointSet, migrationCount int)
}

type Migrator

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

Migrator exposes functions to control the migration of single-stack NEG endpoints to dual-stack NEG endpoints (and vice versa)

Single-stack vs Dual-stack

  • A NEG endpoint is said to be single-stack if it just has an IPv4 or IPv6 address (but not both.)

  • A NEG endpoint is said to be dual-stack if it has both IPv4 and IPv6 address.

Migration endpoint

An endpoint is said to be a migration-endpoint if its current state is single-stack but desired state is dual-stack (and vice versa.)

func NewMigrator

func NewMigrator(enableDualStackNEG bool, syncer syncable, syncerKey types.NegSyncerKey, metricsCollector MetricsCollector, errorStateChecker errorStateChecker, logger klog.Logger) *Migrator

func (*Migrator) Continue

func (d *Migrator) Continue(err error)

Continue will unpause the migration. It expects an error as input which specifies the result of the NEG-endpoint detach operation. Depending on whether the detach operation passed or failed, the effect of unpause could be delayed:

  • If the NEG detach operation failed, the migration will be unpaused immediately before Continue returns. This would allow any resyncs to reattempt the migration. The migrator itself doesn't trigger any sync in this case.
  • If the NEG detach operation succeeded, a migrationWaitDuration timer will be started, which upon completion will unpause the migration and also trigger another sync. Continue will not keep the caller blocked for the completion of the timer. If Continue is invoked multiple times, only the first continue will trigger a resync.

func (*Migrator) Filter

func (d *Migrator) Filter(addEndpoints, removeEndpoints, committedEndpoints map[string]types.NetworkEndpointSet) string

Filter will modify the `addEndpoints` and `removeEndpoints` in TWO DISTINCT ways:

  1. Remove all migration-endpoints, irrespective of whether the migrator is paused or not.
  2. If the migrator is not currently paused, it will also start the detachment of a subset of migration-endpoints from a single zone.

The returned string represents the zone for which detachment was started. An empty return value signifies that detachment was not started (which is the case when there were no migration-endpoints to begin with, or the migrator was paused.)

func (*Migrator) Pause

func (d *Migrator) Pause()

Pause will prevent any subsequent Filter() invocations from starting detachment of migration-endpoints. Pause should be invoked before starting any NEG-endpoint detach operations that include migration-endpoints.

Invoking Pause on a migrator which is already paused will be a no-op.

Pause is usually paired with a Continue() invocation once the NEG-endpoint detach operation completes.

Jump to

Keyboard shortcuts

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