Documentation ¶
Overview ¶
memberclusterannounce_controller is for leader cluster only.
Package multicluster is a generated GoMock package.
Index ¶
- Variables
- func GetResourceImportName(resExport *mcsv1alpha1.ResourceExport) types.NamespacedName
- func RemoveDeletedResourceExports(items []mcsv1alpha1.ResourceExport) []mcsv1alpha1.ResourceExport
- func SvcPortsConverter(svcPort []corev1.ServicePort) []mcs.ServicePort
- type ClusterClaimReconciler
- type GatewayReconciler
- type LeaderClusterSetReconciler
- type MemberClusterAnnounceReconciler
- func (r *MemberClusterAnnounceReconciler) AddMember(MemberId common.ClusterID)
- func (r *MemberClusterAnnounceReconciler) GetMemberClusterStatuses() []multiclusterv1alpha1.ClusterStatus
- func (r *MemberClusterAnnounceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *MemberClusterAnnounceReconciler) RemoveMember(MemberId common.ClusterID)
- func (r *MemberClusterAnnounceReconciler) SetupWithManager(mgr ctrl.Manager) error
- type MemberClusterSetReconciler
- func (r *MemberClusterSetReconciler) GetRemoteCommonAreaAndLocalID() (commonarea.RemoteCommonArea, string, error)
- func (r *MemberClusterSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *MemberClusterSetReconciler) SetRemoteCommonAreaManager(mgr commonarea.RemoteCommonAreaManager) commonarea.RemoteCommonAreaManager
- func (r *MemberClusterSetReconciler) SetupWithManager(mgr ctrl.Manager) error
- type MemberClusterStatusManager
- type MockMemberClusterStatusManager
- func (m *MockMemberClusterStatusManager) AddMember(MemberId common.ClusterID)
- func (m *MockMemberClusterStatusManager) EXPECT() *MockMemberClusterStatusManagerMockRecorder
- func (m *MockMemberClusterStatusManager) GetMemberClusterStatuses() []v1alpha1.ClusterStatus
- func (m *MockMemberClusterStatusManager) RemoveMember(MemberId common.ClusterID)
- type MockMemberClusterStatusManagerMockRecorder
- type NodeReconciler
- type RemoteCommonAreaGetter
- type ResourceExportReconciler
- type ServiceExportReconciler
- type StaleResCleanupController
Constants ¶
This section is empty.
Variables ¶
var ( ReasonNeverConnected = "NeverConnected" ReasonConnected = "Connected" ReasonDisconnected = "Disconnected" ReasonElectedLeader = "ElectedLeader" ReasonNotElectedLeader = "NotElectedLeader" TimerInterval = 5 * time.Second ConnectionTimeout = 3 * TimerInterval )
var (
NoReadyCluster = "NoReadyCluster"
)
Functions ¶
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 ClusterClaimReconciler ¶
ClusterClaimReconciler reconciles a ClusterClaim object
func (*ClusterClaimReconciler) Reconcile ¶
func (r *ClusterClaimReconciler) 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. TODO(user): Modify the Reconcile function to compare the state specified by the ClusterClaim object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile
func (*ClusterClaimReconciler) SetupWithManager ¶
func (r *ClusterClaimReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
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, 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) SetupWithManager ¶ added in v1.7.0
func (r *GatewayReconciler) 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 ¶
func (r *LeaderClusterSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
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) AddMember ¶
func (r *MemberClusterAnnounceReconciler) AddMember(MemberId common.ClusterID)
func (*MemberClusterAnnounceReconciler) GetMemberClusterStatuses ¶
func (r *MemberClusterAnnounceReconciler) GetMemberClusterStatuses() []multiclusterv1alpha1.ClusterStatus
func (*MemberClusterAnnounceReconciler) Reconcile ¶
func (r *MemberClusterAnnounceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile implements cluster status management on the leader cluster
func (*MemberClusterAnnounceReconciler) RemoveMember ¶
func (r *MemberClusterAnnounceReconciler) RemoveMember(MemberId common.ClusterID)
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 (*MemberClusterSetReconciler) GetRemoteCommonAreaAndLocalID ¶ added in v1.7.0
func (r *MemberClusterSetReconciler) GetRemoteCommonAreaAndLocalID() (commonarea.RemoteCommonArea, string, error)
func (*MemberClusterSetReconciler) Reconcile ¶
func (r *MemberClusterSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile ClusterSet changes
func (*MemberClusterSetReconciler) SetRemoteCommonAreaManager ¶ added in v1.7.0
func (r *MemberClusterSetReconciler) SetRemoteCommonAreaManager(mgr commonarea.RemoteCommonAreaManager) commonarea.RemoteCommonAreaManager
SetRemoteCommonAreaManager 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 { AddMember(MemberId common.ClusterID) RemoveMember(MemberId common.ClusterID) 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 ¶
func (m *MockMemberClusterStatusManager) EXPECT() *MockMemberClusterStatusManagerMockRecorder
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 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. It will create a Gateway object if a Node has an annotation `multicluster.antrea.io/gateway:true` and update corresponding Gateway if any subnets changes.
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 object changes and create a corresponding Gateway if the Node has the annotation `multicluster.antrea.io/gateway:true`.
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 ¶
ResourceExportReconciler reconciles a ResourceExport object in the leader cluster.
func NewResourceExportReconciler ¶
func NewResourceExportReconciler( client client.Client, scheme *runtime.Scheme) *ResourceExportReconciler
func (*ResourceExportReconciler) Reconcile ¶
func (r *ResourceExportReconciler) 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. 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) *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 resource. 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 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. It will only run in the member cluster.
func NewStaleResCleanupController ¶ added in v1.7.0
func NewStaleResCleanupController( Client client.Client, Scheme *runtime.Scheme, namespace string, commonAreaGetter RemoteCommonAreaGetter) *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
Source Files ¶
- clusterclaim_controller.go
- clusterinfoexport_handler.go
- controller_utils.go
- gateway_controller.go
- leader_clusterset_controller.go
- member_clusterset_controller.go
- memberclusterannounce_controller.go
- mock_membercluster_status_manager.go
- node_controller.go
- resourceexport_controller.go
- serviceexport_controller.go
- stale_controller.go
- test_data.go