synchronizer

package
v0.0.0-...-c10446a Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

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 *gwapiv1.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             *v1alpha3.API
	ProdHTTPRoute             *HTTPRouteState
	SandHTTPRoute             *HTTPRouteState
	ProdGQLRoute              *GQLRouteState
	SandGQLRoute              *GQLRouteState
	ProdGRPCRoute             *GRPCRouteState
	SandGRPCRoute             *GRPCRouteState
	Authentications           map[string]v1alpha2.Authentication
	RateLimitPolicies         map[string]v1alpha3.RateLimitPolicy
	ResourceAuthentications   map[string]v1alpha2.Authentication
	ResourceRateLimitPolicies map[string]v1alpha3.RateLimitPolicy
	ResourceAPIPolicies       map[string]v1alpha3.APIPolicy
	APIPolicies               map[string]v1alpha3.APIPolicy
	AIProvider                *v1alpha3.AIProvider
	InterceptorServiceMapping map[string]v1alpha1.InterceptorService
	BackendJWTMapping         map[string]v1alpha1.BackendJWT
	APIDefinitionFile         []byte
	SubscriptionValidation    bool
	MutualSSL                 *v1alpha2.MutualSSL
	ProdAIRL                  *v1alpha3.AIRateLimitPolicy
	SandAIRL                  *v1alpha3.AIRateLimitPolicy
}

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]*v1alpha2.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 GRPCRouteState

type GRPCRouteState struct {
	GRPCRouteCombined   *gwapiv1.GRPCRoute
	GRPCRoutePartitions map[string]*gwapiv1.GRPCRoute
	BackendMapping      map[string]*v1alpha2.ResolvedBackend
	Scopes              map[string]v1alpha1.Scope
}

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

func (*GRPCRouteState) DeepCopy

func (in *GRPCRouteState) DeepCopy() *GRPCRouteState

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

func (*GRPCRouteState) DeepCopyInto

func (in *GRPCRouteState) DeepCopyInto(out *GRPCRouteState)

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 *gwapiv1.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]v1alpha3.APIPolicy
	GatewayBackendMapping            map[string]*v1alpha2.ResolvedBackend
	GatewayInterceptorServiceMapping map[string]v1alpha1.InterceptorService
	GatewayCustomRateLimitPolicies   map[string]*v1alpha3.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                 *gwapiv1.HTTPRoute
	HTTPRoutePartitions               map[string]*gwapiv1.HTTPRoute
	BackendMapping                    map[string]*v1alpha2.ResolvedBackend
	Scopes                            map[string]v1alpha1.Scope
	RuleIdxToAiRatelimitPolicyMapping map[int]*v1alpha3.AIRateLimitPolicy
}

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 gwapiv1.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 *gwapiv1.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