trafficrouting

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGraceSeconds added in v0.6.0

func GetGraceSeconds(refs []v1beta1.TrafficRoutingRef, defaultSeconds int32) (graceSeconds int32)

func UpdateRecheckDuration added in v0.6.0

func UpdateRecheckDuration(c *TrafficRoutingContext, remaining time.Duration)

Types

type Manager

type Manager struct {
	client.Client
}

Manager responsible for adjusting network resources such as Service, Ingress, Gateway API, etc., to achieve traffic grayscale.

func NewTrafficRoutingManager

func NewTrafficRoutingManager(c client.Client) *Manager

func (*Manager) DoTrafficRouting

func (m *Manager) DoTrafficRouting(c *TrafficRoutingContext) (bool, error)

func (*Manager) FinalisingTrafficRouting

func (m *Manager) FinalisingTrafficRouting(c *TrafficRoutingContext) (bool, error)

func (*Manager) InitializeTrafficRouting

func (m *Manager) InitializeTrafficRouting(c *TrafficRoutingContext) error

InitializeTrafficRouting determine if the network resources(service & ingress & gateway api) exist. If it is Ingress, init method will create the canary ingress resources, and set weight=0.

func (*Manager) PatchStableService added in v0.6.0

func (m *Manager) PatchStableService(c *TrafficRoutingContext) (bool, error)

returns:

  • if error is not nil, usually we need to retry later. Only if error is nil, we consider the bool.
  • The bool value indicates whether retry is needed. If true, it usually means stable service has been updated (ie. patched) and we need to wait for `graceSeconds`.

only if error is nil AND retry is false, this calling can be considered as completed

func (*Manager) RemoveCanaryService added in v0.6.0

func (m *Manager) RemoveCanaryService(c *TrafficRoutingContext) (bool, error)

returns:

  • if error is not nil, usually we need to retry later. Only if error is nil, we consider the bool.
  • The bool value indicates whether retry is needed. If true, it usually means canary service has been deleted and we need to wait for `graceSeconds`.

only if error is nil AND retry is false, this calling can be considered as completed

func (*Manager) RestoreGateway added in v0.6.0

func (m *Manager) RestoreGateway(c *TrafficRoutingContext) (bool, error)

returns:

  • if error is not nil, usually we need to retry later. Only if error is nil, we consider the bool.
  • The bool value indicates whether retry is needed. If true, it usually means gateway resources have been updated and we need to wait for `graceSeconds`.

only if error is nil AND retry is false, this calling can be considered as completed

func (*Manager) RestoreStableService added in v0.6.0

func (m *Manager) RestoreStableService(c *TrafficRoutingContext) (bool, error)

remove stable service the pod revision selector, so stable service will be selector all version pods. returns:

  • if error is not nil, usually we need to retry later. Only if error is nil, we consider the bool.
  • The bool value indicates whether retry is needed. If true, it usually means stable service has been updated (ie. restored) and we need to wait for `graceSeconds`.

only if error is nil AND retry is false, this calling can be considered as completed

func (*Manager) RouteAllTrafficToNewVersion added in v0.6.0

func (m *Manager) RouteAllTrafficToNewVersion(c *TrafficRoutingContext) (bool, error)

returns:

  • if error is not nil, usually we need to retry later. Only if error is nil, we consider the bool.
  • The bool value indicates whether retry is needed. If true, it usually means gateway resources have been updated and we need to wait for `graceSeconds`.

only if error is nil AND retry is false, this calling can be considered as completed

type TrafficRoutingContext added in v0.4.0

type TrafficRoutingContext struct {
	// only for log info
	Key                        string
	Namespace                  string
	ObjectRef                  []v1beta1.TrafficRoutingRef
	Strategy                   v1beta1.TrafficRoutingStrategy
	CanaryServiceSelectorPatch map[string]string
	// OnlyTrafficRouting
	OnlyTrafficRouting bool
	OwnerRef           metav1.OwnerReference
	// workload.RevisionLabelKey
	RevisionLabelKey string
	// status.CanaryStatus.StableRevision
	StableRevision string
	// status.CanaryStatus.PodTemplateHash
	CanaryRevision string
	// newStatus.canaryStatus.LastUpdateTime
	LastUpdateTime *metav1.Time
	// won't work for Ingress and Gateway
	DisableGenerateCanaryService bool
	// recheck time
	RecheckDuration time.Duration
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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