synchronizer

package
v0.0.0-...-25e6f9d Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOrUpdateGateway

func AddOrUpdateGateway(gatewayState GatewayState, state string) (string, error)

AddOrUpdateGateway adds/update a Gateway to the XDS server.

func DeleteGateway

func DeleteGateway(gateway *gwapiv1b1.Gateway) (string, error)

DeleteGateway deletes a Gateway from the XDS server.

func HandleAPILifeCycleEvents

func HandleAPILifeCycleEvents(ch *chan *APIEvent, successChannel *chan SuccessEvent)

HandleAPILifeCycleEvents handles the API events generated from OperatorDataStore

func HandleGatewayLifeCycleEvents

func HandleGatewayLifeCycleEvents(ch *chan GatewayEvent)

HandleGatewayLifeCycleEvents handles the Gateway events generated from OperatorDataStore

func SendEventToPartitionServer

func SendEventToPartitionServer()

SendEventToPartitionServer sends the API create/update/delete event to the partition server.

func UpdateInternalMapsFromHTTPRoute

func UpdateInternalMapsFromHTTPRoute(apiState APIState, httpRoute *HTTPRouteState, envType string) (*model.AdapterInternalAPI, map[string]struct{}, error)

UpdateInternalMapsFromHTTPRoute extracts the API details from the HTTPRoute.

Types

type APIEvent

type APIEvent struct {
	EventType     string
	Events        []APIState
	UpdatedEvents []string
}

APIEvent holds the data structure used for passing API lifecycle events from controller go routine to synchronizer go routine.

type APIState

type APIState struct {
	APIDefinition             *v1alpha2.API
	ProdHTTPRoute             *HTTPRouteState
	SandHTTPRoute             *HTTPRouteState
	ProdGQLRoute              *GQLRouteState
	SandGQLRoute              *GQLRouteState
	Authentications           map[string]v1alpha2.Authentication
	RateLimitPolicies         map[string]v1alpha1.RateLimitPolicy
	ResourceAuthentications   map[string]v1alpha2.Authentication
	ResourceRateLimitPolicies map[string]v1alpha1.RateLimitPolicy
	ResourceAPIPolicies       map[string]v1alpha2.APIPolicy
	APIPolicies               map[string]v1alpha2.APIPolicy
	InterceptorServiceMapping map[string]v1alpha1.InterceptorService
	BackendJWTMapping         map[string]v1alpha1.BackendJWT
	APIDefinitionFile         []byte
	SubscriptionValidation    bool
	MutualSSL                 *v1alpha2.MutualSSL
}

APIState holds the state of the deployed APIs. This state is compared with the state of the Kubernetes controller cache to detect updates. +k8s:deepcopy-gen=true

func (*APIState) DeepCopy

func (in *APIState) DeepCopy() *APIState

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIState.

func (*APIState) DeepCopyInto

func (in *APIState) DeepCopyInto(out *APIState)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GQLRouteState

type GQLRouteState struct {
	GQLRouteCombined   *v1alpha2.GQLRoute
	GQLRoutePartitions map[string]*v1alpha2.GQLRoute
	BackendMapping     map[string]*v1alpha1.ResolvedBackend
	Scopes             map[string]v1alpha1.Scope
}

GQLRouteState holds the state of the deployed gqlRoutes. This state is compared with the state of the Kubernetes controller cache to detect updates. +k8s:deepcopy-gen=true

func (*GQLRouteState) DeepCopy

func (in *GQLRouteState) DeepCopy() *GQLRouteState

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GQLRouteState.

func (*GQLRouteState) DeepCopyInto

func (in *GQLRouteState) DeepCopyInto(out *GQLRouteState)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GatewayEvent

type GatewayEvent struct {
	EventType string
	Event     GatewayState
}

GatewayEvent holds the data structure used for passing Gateway events from controller go routine to synchronizer go routine.

type GatewayState

type GatewayState struct {
	GatewayDefinition *gwapiv1b1.Gateway
	GatewayStateData  *GatewayStateData
}

GatewayState holds the state of the deployed Gateways. This state is compared with the state of the Kubernetes controller cache to detect updates. +k8s:deepcopy-gen=true

func (*GatewayState) DeepCopy

func (in *GatewayState) DeepCopy() *GatewayState

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayState.

func (*GatewayState) DeepCopyInto

func (in *GatewayState) DeepCopyInto(out *GatewayState)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GatewayStateData

type GatewayStateData struct {
	GatewayResolvedListenerCerts     map[string]map[string][]byte
	GatewayAPIPolicies               map[string]v1alpha2.APIPolicy
	GatewayBackendMapping            map[string]*v1alpha1.ResolvedBackend
	GatewayInterceptorServiceMapping map[string]v1alpha1.InterceptorService
	GatewayCustomRateLimitPolicies   map[string]*v1alpha1.RateLimitPolicy
}

GatewayStateData holds the state data of the deployed Gateways resolved listener certs. +k8s:deepcopy-gen=true

func (*GatewayStateData) DeepCopy

func (in *GatewayStateData) DeepCopy() *GatewayStateData

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayStateData.

func (*GatewayStateData) DeepCopyInto

func (in *GatewayStateData) DeepCopyInto(out *GatewayStateData)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HTTPRouteState

type HTTPRouteState struct {
	HTTPRouteCombined   *gwapiv1b1.HTTPRoute
	HTTPRoutePartitions map[string]*gwapiv1b1.HTTPRoute
	BackendMapping      map[string]*v1alpha1.ResolvedBackend
	Scopes              map[string]v1alpha1.Scope
}

HTTPRouteState holds the state of the deployed httpRoutes. This state is compared with the state of the Kubernetes controller cache to detect updates. +k8s:deepcopy-gen=true

func (*HTTPRouteState) DeepCopy

func (in *HTTPRouteState) DeepCopy() *HTTPRouteState

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteState.

func (*HTTPRouteState) DeepCopyInto

func (in *HTTPRouteState) DeepCopyInto(out *HTTPRouteState)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type OperatorDataStore

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

OperatorDataStore holds the APIStore and API, HttpRoute mappings

func GetOperatorDataStore

func GetOperatorDataStore() *OperatorDataStore

GetOperatorDataStore creates a new OperatorDataStore.

func (*OperatorDataStore) AddAPIState

func (ods *OperatorDataStore) AddAPIState(apiNamespacedName types.NamespacedName, apiState *APIState)

AddAPIState stores a new API in the OperatorDataStore.

func (*OperatorDataStore) AddGatewayState

func (ods *OperatorDataStore) AddGatewayState(gateway gwapiv1b1.Gateway,
	gatewayStateData *GatewayStateData) GatewayState

AddGatewayState stores a new Gateway in the OperatorDataStore.

func (*OperatorDataStore) DeleteCachedAPI

func (ods *OperatorDataStore) DeleteCachedAPI(apiName types.NamespacedName)

DeleteCachedAPI delete from apistate cache

func (*OperatorDataStore) DeleteCachedGateway

func (ods *OperatorDataStore) DeleteCachedGateway(gatewayName types.NamespacedName)

DeleteCachedGateway delete from gatewaystate cache

func (*OperatorDataStore) GetCachedAPI

func (ods *OperatorDataStore) GetCachedAPI(apiName types.NamespacedName) (APIState, bool)

GetCachedAPI get cached apistate

func (*OperatorDataStore) GetCachedGateway

func (ods *OperatorDataStore) GetCachedGateway(gatewayName types.NamespacedName) (GatewayState, bool)

GetCachedGateway get cached gatewaystate

func (*OperatorDataStore) IsGatewayAvailable

func (ods *OperatorDataStore) IsGatewayAvailable(gatewayName types.NamespacedName) bool

IsGatewayAvailable get cached gatewaystate

func (*OperatorDataStore) UpdateAPIState

func (ods *OperatorDataStore) UpdateAPIState(apiNamespacedName types.NamespacedName, apiState *APIState) (APIState, []string, bool)

UpdateAPIState update/create the APIState on ref updates

func (*OperatorDataStore) UpdateGatewayState

func (ods *OperatorDataStore) UpdateGatewayState(gatewayDef *gwapiv1b1.Gateway,
	gatewayStateData *GatewayStateData) (GatewayState, []string, bool)

UpdateGatewayState update/create the GatewayState on ref updates

type PartitionEvent

type PartitionEvent struct {
	EventType    string   `json:"eventType"`
	APIName      string   `json:"apiName"`
	APIVersion   string   `json:"apiVersion"`
	BasePath     string   `json:"basePath"`
	Organization string   `json:"organization"`
	Partition    string   `json:"partition"`
	APIUUID      string   `json:"apiId"`
	Vhosts       []string `json:"vhosts"`
}

PartitionEvent is the event sent to the partition server.

type SuccessEvent

type SuccessEvent struct {
	// APINamespacedName updated api namespaced names
	APINamespacedName []types.NamespacedName
	State             string
	Events            []string
}

SuccessEvent holds the data structure used for aknowledgement of a successful API deployment

Jump to

Keyboard shortcuts

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