multicluster

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

memberclusterannounce_controller is for leader cluster only.

Package multicluster is a generated GoMock package.

Package multicluster is a generated GoMock package.

Index

Constants

View Source
const (
	LeaderCluster = "leader"
	MemberCluster = "member"
)

Variables

View Source
var (
	ReasonConnected    = "Connected"
	ReasonDisconnected = "Disconnected"

	MemberClusterAnnounceFinalizer = "memberclusterannounce.finalizer.antrea.io"

	TimerInterval     = 10 * time.Second
	ConnectionTimeout = 3 * TimerInterval
)
View Source
var (
	NoReadyCluster = "NoReadyCluster"
)

Functions

func GetNormalizedLabel added in v1.10.0

func GetNormalizedLabel(nsLabels, podLabels map[string]string, ns string) string

func GetResourceImportName

func GetResourceImportName(resExport *mcsv1alpha1.ResourceExport) types.NamespacedName

func RemoveDeletedResourceExports

func RemoveDeletedResourceExports(items []mcsv1alpha1.ResourceExport) []mcsv1alpha1.ResourceExport

We use finalizers as ResourceExport pre-delete hooks, which means when we list the ResourceExports, it will also return deleted items. RemoveDeletedResourceExports remove any ResourceExports with non-zero DeletionTimestamp which is actually deleted object.

func SvcPortsConverter

func SvcPortsConverter(svcPort []corev1.ServicePort) []mcs.ServicePort

Types

type GatewayReconciler added in v1.7.0

type GatewayReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

GatewayReconciler is for member cluster only.

func NewGatewayReconciler added in v1.7.0

func NewGatewayReconciler(
	client client.Client,
	scheme *runtime.Scheme,
	namespace string,
	serviceCIDR string,
	podCIDRs []string,
	commonAreaGetter RemoteCommonAreaGetter) *GatewayReconciler

NewGatewayReconciler creates a GatewayReconciler which will watch Gateway events and create a ClusterInfo kind of ResourceExport in the leader cluster.

func (*GatewayReconciler) Reconcile added in v1.7.0

func (r *GatewayReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*GatewayReconciler) SetupWithManager added in v1.7.0

func (r *GatewayReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type LabelIdentityExportReconciler added in v1.9.0

type LabelIdentityExportReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

LabelIdentityExportReconciler watches LabelIdentity ResourceExport events in the Common Area, computes if such event cause a new LabelIdentity to become present/stale in the entire ClusterSet, and update ResourceImports accordingly.

func NewLabelIdentityExportReconciler added in v1.9.0

func NewLabelIdentityExportReconciler(
	client client.Client,
	scheme *runtime.Scheme,
	namespace string) *LabelIdentityExportReconciler

func (*LabelIdentityExportReconciler) Reconcile added in v1.9.0

+kubebuilder:rbac:groups=multicluster.crd.antrea.io,resources=resourceexports,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups=multicluster.crd.antrea.io,resources=resourceexports/status,verbs=get;update;patch

func (*LabelIdentityExportReconciler) Run added in v1.9.0

func (r *LabelIdentityExportReconciler) Run(stopCh <-chan struct{})

Run begins syncing of ResourceImports for label identities.

func (*LabelIdentityExportReconciler) SetupWithManager added in v1.9.0

func (r *LabelIdentityExportReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type LabelIdentityReconciler added in v1.9.0

type LabelIdentityReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

LabelIdentityReconciler watches relevant Pod and Namespace events in the member cluster, computes the label identities added to and deleted from the cluster, and exports them to the leader cluster for further processing.

func NewLabelIdentityReconciler added in v1.9.0

func NewLabelIdentityReconciler(
	client client.Client,
	scheme *runtime.Scheme,
	commonAreaGetter RemoteCommonAreaGetter) *LabelIdentityReconciler

func (*LabelIdentityReconciler) Reconcile added in v1.9.0

func (r *LabelIdentityReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

+kubebuilder:rbac:groups=multicluster.crd.antrea.io,resources=resourceexports,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups="",resources=pods,verbs=get;list;watch +kubebuilder:rbac:groups="",resources=namespaces,verbs=get;list;watch

func (*LabelIdentityReconciler) Run added in v1.9.0

func (r *LabelIdentityReconciler) Run(stopCh <-chan struct{})

Run begins syncing of ResourceExports for label identities.

func (*LabelIdentityReconciler) SetupWithManager added in v1.9.0

func (r *LabelIdentityReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type LeaderClusterSetReconciler

type LeaderClusterSetReconciler struct {
	client.Client
	Scheme *runtime.Scheme

	StatusManager MemberClusterStatusManager
	// contains filtered or unexported fields
}

LeaderClusterSetReconciler reconciles a ClusterSet object in the leader cluster deployment. There will be one MC Controller running in each Namespace of the leader for multiple ClusterSet support. So each MC Controller will only be handling a single ClusterSet in the given Namespace.

func (*LeaderClusterSetReconciler) Reconcile

Reconcile ClusterSet changes

func (*LeaderClusterSetReconciler) SetupWithManager

func (r *LeaderClusterSetReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type MemberClusterAnnounceReconciler

type MemberClusterAnnounceReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

MemberClusterAnnounceReconciler reconciles a MemberClusterAnnounce object

func NewMemberClusterAnnounceReconciler

func NewMemberClusterAnnounceReconciler(client client.Client, scheme *runtime.Scheme) *MemberClusterAnnounceReconciler

func (*MemberClusterAnnounceReconciler) GetMemberClusterStatuses

func (r *MemberClusterAnnounceReconciler) GetMemberClusterStatuses() []multiclusterv1alpha1.ClusterStatus

func (*MemberClusterAnnounceReconciler) Reconcile

Reconcile implements cluster status management on the leader cluster

func (*MemberClusterAnnounceReconciler) SetupWithManager

func (r *MemberClusterAnnounceReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type MemberClusterSetReconciler

type MemberClusterSetReconciler struct {
	client.Client
	Scheme    *runtime.Scheme
	Namespace string
	// contains filtered or unexported fields
}

MemberClusterSetReconciler reconciles a ClusterSet object in the member cluster deployment.

func NewMemberClusterSetReconciler added in v1.7.0

func NewMemberClusterSetReconciler(client client.Client,
	scheme *runtime.Scheme,
	namespace string,
	enableStretchedNetworkPolicy bool,
) *MemberClusterSetReconciler

func (*MemberClusterSetReconciler) GetRemoteCommonAreaAndLocalID added in v1.7.0

func (r *MemberClusterSetReconciler) GetRemoteCommonAreaAndLocalID() (commonarea.RemoteCommonArea, string, error)

func (*MemberClusterSetReconciler) Reconcile

Reconcile ClusterSet changes

func (*MemberClusterSetReconciler) SetRemoteCommonArea added in v1.8.0

SetRemoteCommonArea is for testing only

func (*MemberClusterSetReconciler) SetupWithManager

func (r *MemberClusterSetReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type MemberClusterStatusManager

type MemberClusterStatusManager interface {
	GetMemberClusterStatuses() []multiclusterv1alpha1.ClusterStatus
}

type MockMemberClusterStatusManager

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

MockMemberClusterStatusManager is a mock of MemberClusterStatusManager interface.

func NewMockMemberClusterStatusManager

func NewMockMemberClusterStatusManager(ctrl *gomock.Controller) *MockMemberClusterStatusManager

NewMockMemberClusterStatusManager creates a new mock instance.

func (*MockMemberClusterStatusManager) AddMember

func (m *MockMemberClusterStatusManager) AddMember(memberID common.ClusterID)

AddMember mocks base method.

func (*MockMemberClusterStatusManager) EXPECT

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

func (*MockMemberClusterStatusManager) GetMemberClusterStatuses

func (m *MockMemberClusterStatusManager) GetMemberClusterStatuses() []v1alpha1.ClusterStatus

GetMemberClusterStatuses mocks base method.

func (*MockMemberClusterStatusManager) RemoveMember

func (m *MockMemberClusterStatusManager) RemoveMember(memberID common.ClusterID)

RemoveMember mocks base method.

type MockMemberClusterStatusManagerMockRecorder

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

MockMemberClusterStatusManagerMockRecorder is the mock recorder for MockMemberClusterStatusManager.

func (*MockMemberClusterStatusManagerMockRecorder) AddMember

func (mr *MockMemberClusterStatusManagerMockRecorder) AddMember(memberID interface{}) *gomock.Call

AddMember indicates an expected call of AddMember.

func (*MockMemberClusterStatusManagerMockRecorder) GetMemberClusterStatuses

func (mr *MockMemberClusterStatusManagerMockRecorder) GetMemberClusterStatuses() *gomock.Call

GetMemberClusterStatuses indicates an expected call of GetMemberClusterStatuses.

func (*MockMemberClusterStatusManagerMockRecorder) RemoveMember

func (mr *MockMemberClusterStatusManagerMockRecorder) RemoveMember(memberID interface{}) *gomock.Call

RemoveMember indicates an expected call of RemoveMember.

type MockRemoteCommonAreaGetter added in v1.10.0

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

MockRemoteCommonAreaGetter is a mock of RemoteCommonAreaGetter interface.

func NewMockRemoteCommonAreaGetter added in v1.10.0

func NewMockRemoteCommonAreaGetter(ctrl *gomock.Controller) *MockRemoteCommonAreaGetter

NewMockRemoteCommonAreaGetter creates a new mock instance.

func (*MockRemoteCommonAreaGetter) EXPECT added in v1.10.0

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

func (*MockRemoteCommonAreaGetter) GetRemoteCommonAreaAndLocalID added in v1.10.0

func (m *MockRemoteCommonAreaGetter) GetRemoteCommonAreaAndLocalID() (commonarea.RemoteCommonArea, string, error)

GetRemoteCommonAreaAndLocalID mocks base method.

func (*MockRemoteCommonAreaGetter) GetRemoteCommonAreaPre added in v1.10.0

func (m *MockRemoteCommonAreaGetter) GetRemoteCommonAreaPre(secretObj *v1.Secret, url string, clusterID common.ClusterID, clusterSet *v1alpha1.ClusterSet) (*rest.Config, manager.Manager, client.Client, error)

GetRemoteCommonAreaPre mocks base method.

type MockRemoteCommonAreaGetterMockRecorder added in v1.10.0

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

MockRemoteCommonAreaGetterMockRecorder is the mock recorder for MockRemoteCommonAreaGetter.

func (*MockRemoteCommonAreaGetterMockRecorder) GetRemoteCommonAreaAndLocalID added in v1.10.0

func (mr *MockRemoteCommonAreaGetterMockRecorder) GetRemoteCommonAreaAndLocalID() *gomock.Call

GetRemoteCommonAreaAndLocalID indicates an expected call of GetRemoteCommonAreaAndLocalID.

func (*MockRemoteCommonAreaGetterMockRecorder) GetRemoteCommonAreaPre added in v1.10.0

func (mr *MockRemoteCommonAreaGetterMockRecorder) GetRemoteCommonAreaPre(secretObj, url, clusterID, clusterSet interface{}) *gomock.Call

GetRemoteCommonAreaPre indicates an expected call of GetRemoteCommonAreaPre.

type NodeReconciler added in v1.7.0

type NodeReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

NodeReconciler is for member cluster only.

func NewNodeReconciler added in v1.7.0

func NewNodeReconciler(
	client client.Client,
	scheme *runtime.Scheme,
	namespace string,
	precedence mcsv1alpha1.Precedence) *NodeReconciler

NewNodeReconciler creates a NodeReconciler to watch Node resource changes. It's responsible for creating a Gateway for the first ready Node with annotation `multicluster.antrea.io/gateway:true` if there is no existing Gateway. It guarantees there is always only one Gateway CR when there are multiple Nodes with annotation `multicluster.antrea.io/gateway:true`.

func (*NodeReconciler) Reconcile added in v1.7.0

func (r *NodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*NodeReconciler) SetupWithManager added in v1.7.0

func (r *NodeReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type RemoteCommonAreaGetter added in v1.7.0

type RemoteCommonAreaGetter interface {
	GetRemoteCommonAreaAndLocalID() (commonarea.RemoteCommonArea, string, error)
}

type ResourceExportReconciler

type ResourceExportReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

ResourceExportReconciler reconciles a ResourceExport object in the leader cluster.

func NewResourceExportReconciler

func NewResourceExportReconciler(
	client client.Client,
	scheme *runtime.Scheme) *ResourceExportReconciler

func (*ResourceExportReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. Reconcile will process all kinds of ResourceExport. Service and Endpoint kinds of ResourceExport will be handled in this file, and all other kinds will have their own handler files, eg: newkind_handler.go

func (*ResourceExportReconciler) SetupWithManager

func (r *ResourceExportReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type ServiceExportReconciler

type ServiceExportReconciler struct {
	client.Client

	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

ServiceExportReconciler reconciles a ServiceExport object in the member cluster.

func NewServiceExportReconciler

func NewServiceExportReconciler(
	client client.Client,
	scheme *runtime.Scheme,
	commonAreaGetter RemoteCommonAreaGetter,
	endpointIPType string) *ServiceExportReconciler

func (*ServiceExportReconciler) Reconcile

func (r *ServiceExportReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. For ServiceExport Reconcile, it watches events of ServiceExport resources, and also Services/Endpoints resources. It will create/update/remove ResourceExport in a leader cluster for corresponding ServiceExport from a member cluster.

func (*ServiceExportReconciler) SetupWithManager

func (r *ServiceExportReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type StaleResCleanupController added in v1.7.0

type StaleResCleanupController struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

StaleResCleanupController will clean up ServiceImport, MC Service, ACNP, ClusterInfoImport and LabelIdentity resources if no corresponding ResourceImports in the leader cluster and remove stale ResourceExports in the leader cluster if no corresponding ServiceExport or Gateway in the member cluster when it runs in the member cluster. It will clean up stale MemberClusterAnnounce resources in the leader cluster if no corresponding member cluster in the ClusterSet.Spec.Members when it runs in the leader cluster.

func NewStaleResCleanupController added in v1.7.0

func NewStaleResCleanupController(
	Client client.Client,
	Scheme *runtime.Scheme,
	namespace string,
	commonAreaGetter RemoteCommonAreaGetter,
	clusterRole string,
) *StaleResCleanupController

func (*StaleResCleanupController) Enqueue added in v1.7.0

func (c *StaleResCleanupController) Enqueue()

Enqueue will be called after StaleResCleanupController is initialized.

func (*StaleResCleanupController) Run added in v1.7.0

func (c *StaleResCleanupController) Run(stopCh <-chan struct{})

Run starts the StaleResCleanupController and blocks until stopCh is closed. it will run only once to clean up stale resources if no error happens.

func (*StaleResCleanupController) RunOnce added in v1.7.0

func (c *StaleResCleanupController) RunOnce() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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