state

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeProcessor

type ChangeProcessor interface {
	// CaptureUpsertChange captures an upsert change to a resource.
	// It panics if the resource is of unsupported type or if the passed Gateway is different from the one this
	// ChangeProcessor was created for.
	CaptureUpsertChange(obj client.Object)
	// CaptureDeleteChange captures a delete change to a resource.
	// The method panics if the resource is of unsupported type or if the passed Gateway is different from the one
	// this ChangeProcessor was created for.
	CaptureDeleteChange(resourceType client.Object, nsname types.NamespacedName)
	// Process produces a graph-like representation of GatewayAPI resources.
	// If no changes were captured, the changed return argument will be NoChange and graph will be empty.
	Process() (changeType ChangeType, graphCfg *graph.Graph)
	// GetLatestGraph returns the latest Graph.
	GetLatestGraph() *graph.Graph
}

ChangeProcessor processes the changes to resources and produces a graph-like representation of the Gateway configuration. It only supports one GatewayClass resource.

type ChangeProcessorConfig

type ChangeProcessorConfig struct {
	// Validators validate resources according to data-plane specific rules.
	Validators validation.Validators
	// EventRecorder records events for Kubernetes resources.
	EventRecorder record.EventRecorder
	// Scheme is the Kubernetes scheme.
	Scheme *runtime.Scheme
	// ProtectedPorts are the ports that may not be configured by a listener with a descriptive name of the ports.
	ProtectedPorts graph.ProtectedPorts
	// Logger is the logger for this Change Processor.
	Logger logr.Logger
	// GatewayCtlrName is the name of the Gateway controller.
	GatewayCtlrName string
	// GatewayClassName is the name of the GatewayClass resource.
	GatewayClassName string
}

ChangeProcessorConfig holds configuration parameters for ChangeProcessorImpl.

type ChangeProcessorImpl

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

ChangeProcessorImpl is an implementation of ChangeProcessor.

func NewChangeProcessorImpl

func NewChangeProcessorImpl(cfg ChangeProcessorConfig) *ChangeProcessorImpl

NewChangeProcessorImpl creates a new ChangeProcessorImpl for the Gateway resource with the configured namespace name.

func (*ChangeProcessorImpl) CaptureDeleteChange

func (c *ChangeProcessorImpl) CaptureDeleteChange(resourceType client.Object, nsname types.NamespacedName)

func (*ChangeProcessorImpl) CaptureUpsertChange

func (c *ChangeProcessorImpl) CaptureUpsertChange(obj client.Object)

func (*ChangeProcessorImpl) GetLatestGraph added in v1.2.0

func (c *ChangeProcessorImpl) GetLatestGraph() *graph.Graph

func (*ChangeProcessorImpl) Process

func (c *ChangeProcessorImpl) Process() (ChangeType, *graph.Graph)

type ChangeType added in v1.2.0

type ChangeType int

ChangeType is the type of change that occurred based on a k8s object event.

const (
	// NoChange means that nothing changed.
	NoChange ChangeType = iota
	// EndpointsOnlyChange means that only the endpoints changed.
	// If using NGINX Plus, this update can be done using the API without a reload.
	EndpointsOnlyChange
	// ClusterStateChange means that something other than endpoints changed. This requires an NGINX reload.
	ClusterStateChange
)

type Updater

type Updater interface {
	Upsert(obj client.Object)
	Delete(objType client.Object, nsname types.NamespacedName)
}

Updater updates the cluster state.

Directories

Path Synopsis
Package dataplane translates Graph representation of the cluster state into an intermediate representation of data plane configuration.
Package dataplane translates Graph representation of the cluster state into an intermediate representation of data plane configuration.
Package graph translates the cluster state (Gateway API and Kubernetes resources) into a graph-like representation, for which: - Resources are validated.
Package graph translates the cluster state (Gateway API and Kubernetes resources) into a graph-like representation, for which: - Resources are validated.
resolverfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
validationfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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