multicluster

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package multicluster is a generated GoMock package.

Package multicluster implements the Kubernetes client for the resources in the flomesh.io API group

Index

Constants

View Source
const (
	// ServiceImportClusterKeyAnnotation is the annotation used to configure context path for imported service
	ServiceImportClusterKeyAnnotation = "flomesh.io/ServiceImport/ClusterKey/%s/%d"

	// ServiceImportContextPathAnnotation is the annotation used to configure context path for imported service
	ServiceImportContextPathAnnotation = "flomesh.io/ServiceImport/ContextPath/%s/%d"

	// ServiceImportLBTypeAnnotation is the annotation used to configure load balancer type for imported service
	ServiceImportLBTypeAnnotation = "flomesh.io/ServiceImport/LBType/%s/%d"

	// ServiceImportLBWeightAnnotation is the annotation used to configure load balancer weight for imported service
	ServiceImportLBWeightAnnotation = "flomesh.io/ServiceImport/LBWeight/%s/%d"

	// AnyServiceAccount defines wildcard service account
	AnyServiceAccount = "*"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the type used to represent the Kubernetes Client for the flomesh.io API group

func NewMultiClusterController

func NewMultiClusterController(informerCollection *informers.InformerCollection, kubeClient kubernetes.Interface, kubeController k8s.Controller, msgBroker *messaging.Broker) *Client

NewMultiClusterController returns a multicluster.Controller interface related to functionality provided by the resources in the flomesh.io API group

func (*Client) GetEndpoints

func (c *Client) GetEndpoints(svc service.MeshService) (*corev1.Endpoints, error)

GetEndpoints returns the endpoint for a given service, otherwise returns nil if not found or error if the API errored out.

func (*Client) GetExportedRule

GetExportedRule retrieves the export rule for the given MeshService

func (*Client) GetIngressControllerServices

func (c *Client) GetIngressControllerServices() []service.MeshService

GetIngressControllerServices returns ingress controller services.

func (*Client) GetLbWeightForService

func (c *Client) GetLbWeightForService(svc service.MeshService) (aa, fo, lc bool, weight int, clusterKeys map[string]int)

GetLbWeightForService retrieves load balancer type and weight for service

func (*Client) GetNamespace

func (c *Client) GetNamespace(ns string) *corev1.Namespace

GetNamespace returns a Namespace resource if found, nil otherwise.

func (*Client) GetService

func (c *Client) GetService(svc service.MeshService) *corev1.Service

GetService retrieves the Kubernetes Services resource for the given MeshService

func (*Client) GetTargetPortForServicePort

func (c *Client) GetTargetPortForServicePort(namespacedSvc types.NamespacedName, port uint16) map[uint16]bool

GetTargetPortForServicePort returns the TargetPort corresponding to the Port used by clients to communicate with it.

func (*Client) ListPods

func (c *Client) ListPods() []*corev1.Pod

ListPods returns a list of pods part of the mesh Kubecontroller does not currently segment pod notifications, hence it receives notifications for all k8s Pods.

func (*Client) ListServiceIdentitiesForService

func (c *Client) ListServiceIdentitiesForService(svc service.MeshService) ([]identity.K8sServiceAccount, error)

ListServiceIdentitiesForService lists ServiceAccounts associated with the given service

func (*Client) ListServices

func (c *Client) ListServices() []*corev1.Service

ListServices returns a list of services that are imported from other clusters.

type Controller

type Controller interface {
	// ListServices returns a list of all (monitored-namespace filtered) services in the mesh
	ListServices() []*corev1.Service

	// GetService returns a corev1 Service representation if the MeshService exists in cache, otherwise nil
	GetService(service.MeshService) *corev1.Service

	// ListPods returns a list of pods part of the mesh
	ListPods() []*corev1.Pod

	// ListServiceIdentitiesForService lists ServiceAccounts associated with the given service
	ListServiceIdentitiesForService(service.MeshService) ([]identity.K8sServiceAccount, error)

	// GetEndpoints returns the endpoints for a given service, if found
	GetEndpoints(service.MeshService) (*corev1.Endpoints, error)

	// GetIngressControllerServices returns ingress controller services.
	GetIngressControllerServices() []service.MeshService

	// GetExportedRule retrieves the export rule for the given MeshService
	GetExportedRule(svc service.MeshService) (*multiclusterv1alpha1.ServiceExportRule, error)

	//GetTargetPortForServicePort retrieves target for service
	GetTargetPortForServicePort(types.NamespacedName, uint16) map[uint16]bool

	// GetLbWeightForService retrieves load balancer type and weight for service
	GetLbWeightForService(svc service.MeshService) (aa, fo, lc bool, weight int, clusterKeys map[string]int)
}

Controller is the interface for the functionality provided by the resources part of the flomesh.io API group

type MockController

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

MockController is a mock of Controller interface.

func NewMockController

func NewMockController(ctrl *gomock.Controller) *MockController

NewMockController creates a new mock instance.

func (*MockController) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockController) GetEndpoints

func (m *MockController) GetEndpoints(arg0 service.MeshService) (*v1.Endpoints, error)

GetEndpoints mocks base method.

func (*MockController) GetExportedRule

func (m *MockController) GetExportedRule(arg0 service.MeshService) (*v1alpha1.ServiceExportRule, error)

GetExportedRule mocks base method.

func (*MockController) GetIngressControllerServices

func (m *MockController) GetIngressControllerServices() []service.MeshService

GetIngressControllerServices mocks base method.

func (*MockController) GetLbWeightForService

func (m *MockController) GetLbWeightForService(arg0 service.MeshService) (bool, bool, bool, int, map[string]int)

GetLbWeightForService mocks base method.

func (*MockController) GetService

func (m *MockController) GetService(arg0 service.MeshService) *v1.Service

GetService mocks base method.

func (*MockController) GetTargetPortForServicePort

func (m *MockController) GetTargetPortForServicePort(arg0 types.NamespacedName, arg1 uint16) map[uint16]bool

GetTargetPortForServicePort mocks base method.

func (*MockController) ListPods

func (m *MockController) ListPods() []*v1.Pod

ListPods mocks base method.

func (*MockController) ListServiceIdentitiesForService

func (m *MockController) ListServiceIdentitiesForService(arg0 service.MeshService) ([]identity.K8sServiceAccount, error)

ListServiceIdentitiesForService mocks base method.

func (*MockController) ListServices

func (m *MockController) ListServices() []*v1.Service

ListServices mocks base method.

type MockControllerMockRecorder

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

MockControllerMockRecorder is the mock recorder for MockController.

func (*MockControllerMockRecorder) GetEndpoints

func (mr *MockControllerMockRecorder) GetEndpoints(arg0 interface{}) *gomock.Call

GetEndpoints indicates an expected call of GetEndpoints.

func (*MockControllerMockRecorder) GetExportedRule

func (mr *MockControllerMockRecorder) GetExportedRule(arg0 interface{}) *gomock.Call

GetExportedRule indicates an expected call of GetExportedRule.

func (*MockControllerMockRecorder) GetIngressControllerServices

func (mr *MockControllerMockRecorder) GetIngressControllerServices() *gomock.Call

GetIngressControllerServices indicates an expected call of GetIngressControllerServices.

func (*MockControllerMockRecorder) GetLbWeightForService

func (mr *MockControllerMockRecorder) GetLbWeightForService(arg0 interface{}) *gomock.Call

GetLbWeightForService indicates an expected call of GetLbWeightForService.

func (*MockControllerMockRecorder) GetService

func (mr *MockControllerMockRecorder) GetService(arg0 interface{}) *gomock.Call

GetService indicates an expected call of GetService.

func (*MockControllerMockRecorder) GetTargetPortForServicePort

func (mr *MockControllerMockRecorder) GetTargetPortForServicePort(arg0, arg1 interface{}) *gomock.Call

GetTargetPortForServicePort indicates an expected call of GetTargetPortForServicePort.

func (*MockControllerMockRecorder) ListPods

func (mr *MockControllerMockRecorder) ListPods() *gomock.Call

ListPods indicates an expected call of ListPods.

func (*MockControllerMockRecorder) ListServiceIdentitiesForService

func (mr *MockControllerMockRecorder) ListServiceIdentitiesForService(arg0 interface{}) *gomock.Call

ListServiceIdentitiesForService indicates an expected call of ListServiceIdentitiesForService.

func (*MockControllerMockRecorder) ListServices

func (mr *MockControllerMockRecorder) ListServices() *gomock.Call

ListServices indicates an expected call of ListServices.

Jump to

Keyboard shortcuts

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