Skip to content

Commit

Permalink
fixup! fixup! fix: added unique names to all controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
fra98 committed Oct 14, 2024
1 parent d140a49 commit 2ccae2c
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 32 deletions.
3 changes: 2 additions & 1 deletion cmd/liqo-controller-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import (
identitymanager "github.com/liqotech/liqo/pkg/identityManager"
"github.com/liqotech/liqo/pkg/ipam"
remoteresourceslicecontroller "github.com/liqotech/liqo/pkg/liqo-controller-manager/authentication/remoteresourceslice-controller"
foreignclustercontroller "github.com/liqotech/liqo/pkg/liqo-controller-manager/foreigncluster-controller"
foreignclustercontroller "github.com/liqotech/liqo/pkg/liqo-controller-manager/core/foreigncluster-controller"
ipmapping "github.com/liqotech/liqo/pkg/liqo-controller-manager/ipmapping"
quotacreatorcontroller "github.com/liqotech/liqo/pkg/liqo-controller-manager/quotacreator-controller"
virtualnodecreatorcontroller "github.com/liqotech/liqo/pkg/liqo-controller-manager/virtualnodecreator-controller"
Expand Down Expand Up @@ -393,6 +393,7 @@ func main() {
}
}

// CORE OPERATORS
// Configure the foreigncluster controller.
idManager := identitymanager.NewCertificateIdentityManager(ctx, mgr.GetClient(), clientset, mgr.GetConfig(), clusterID, namespaceManager)
foreignClusterReconciler := &foreignclustercontroller.ForeignClusterReconciler{
Expand Down
2 changes: 1 addition & 1 deletion internal/crdReplicator/crdReplicator-operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (c *Controller) SetupWithManager(mgr ctrl.Manager) error {
return err
}

return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlSecretsCRDReplicator).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlSecretCRDReplicator).
For(&corev1.Secret{}, builder.WithPredicates(secretsFilter)).
WithEventFilter(resourceToBeProccesedPredicate).
Complete(c)
Expand Down
38 changes: 19 additions & 19 deletions pkg/consts/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,22 @@ package consts
// with the prefix "Ctrl".
const (
// Core.
CtrlForeignCluster = "foreigncluster"
CtrlSecretsCRDReplicator = "secrets_crdreplicator"
CtrlForeignCluster = "foreigncluster"
CtrlSecretCRDReplicator = "secret_crdreplicator" //nolint:gosec // not a credential

// Networking.
CtrlConfigurationExternal = "configuration_external"
CtrlConfigurationInternal = "configuration_internal"
CtrlConfigurationIPMapping = "configuration_ipmapping"
CtrlConfigurationRemapping = "configuration_remapping"
CtrlConfigurationRoute = "configuration_route"
CtrlConnections = "connections"
CtrlConnection = "connection"
CtrlFirewallConfiguration = "firewallconfiguration"
CtrlGatewayClientExternal = "gatewayclient_external"
CtrlGatewayClientInternal = "gatewayclient_internal"
CtrlGatewayServerExternal = "gatewayserver_external"
CtrlGatewayServerInternal = "gatewayserver_internal"
CtrlInternalFabricsCM = "internalfabrics_cm"
CtrlInternalFabricsFabric = "internalfabrics_fabric"
CtrlInternalFabricCM = "internalfabric_cm"
CtrlInternalFabricFabric = "internalfabric_fabric"
CtrlInternalNodeGeneve = "internalnode_geneve"
CtrlInternalNodeRoute = "internalnode_route"
CtrlIP = "ip"
Expand All @@ -50,31 +49,32 @@ const (
CtrlPodGateway = "pod_gateway"
CtrlPodGwMasq = "pod_gw_masq"
CtrlPodInternalNet = "pod_internalnet"
CtrlPodIPMapping = "pod_ipmapping"
CtrlPulicKeys = "publickeys"
CtrlPulicKey = "publickey"
CtrlRouteConfiguration = "routeconfiguration"
CtrlWGGatewayClient = "wggatewayclient"
CtrlWGGatewayServer = "wggatewayserver"

// Authentication.
CtrlIdentity = "identity"
CtrlIdentityCreator = "identity_creator"
CtrlNonceCreator = "nonce_creator"
CtrlNonceSigner = "nonce_signer"
CtrlResourceSlicesLocal = "resourceslices_local"
CtrlResourceSlicesRemote = "resourceslices_remote"
CtrlTenant = "tenant"
CtrlIdentity = "identity"
CtrlIdentityCreator = "identity_creator"
CtrlSecretNonceCreator = "secret_noncecreator"
CtrlSecretNonceSigner = "secret_noncesigner"
CtrlResourceSliceLocal = "resourceslice_local"
CtrlResourceSliceRemote = "resourceslice_remote"
CtrlTenant = "tenant"

// Offloading.
CtrlNamespaceMap = "namespace_map"
CtrlNamespaceMap = "namespacemap"
CtrlNamespaceOffloading = "namespaceoffloading"
CtrlNodeFailure = "node_failure"
CtrlPodStatus = "pod_status"
CtrlShadowEndpointSlice = "shadowendpointslice"
CtrlShadowPods = "shadowpods"
CtrlShadowPod = "shadowpod"
CtrlVirtualNode = "virtualnode"
CtrlVirtualNodeCreator = "virtualnode_creator"

// Cross modules.
CtrlResourceSlicesQuotaCreator = "resourceslices_quotacreator"
CtrlResourceSliceQuotaCreator = "resourceslice_quotacreator"
CtrlResourceSliceVNCreator = "resourceslice_vncreator"
CtrlPodIPMapping = "pod_ipmapping"
CtrlConfigurationIPMapping = "configuration_ipmapping"
)
2 changes: 1 addition & 1 deletion pkg/fabric/internalfabric_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (r *InternalFabricReconciler) Reconcile(ctx context.Context, req ctrl.Reque

// SetupWithManager register the InternalFabricReconciler to the manager.
func (r *InternalFabricReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlInternalFabricsFabric).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlInternalFabricFabric).
For(&networkingv1beta1.InternalFabric{}).
Complete(r)
}
2 changes: 1 addition & 1 deletion pkg/gateway/connection/connections_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (r *ConnectionsReconciler) SetupWithManager(mgr ctrl.Manager) error {
if err != nil {
return err
}
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlConnections).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlConnection).
For(&networkingv1beta1.Connection{}, builder.WithPredicates(filterByLabelsPredicate)).
Complete(r)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/gateway/tunnel/wireguard/publickeys_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (r *PublicKeysReconciler) Reconcile(ctx context.Context, req ctrl.Request)

// SetupWithManager register the ConfigurationReconciler to the manager.
func (r *PublicKeysReconciler) SetupWithManager(mgr ctrl.Manager, src <-chan event.GenericEvent) error {
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlPulicKeys).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlPulicKey).
For(&networkingv1beta1.PublicKey{}, r.Predicates()).
WatchesRawSource(NewDNSSource(src, NewDNSEventHandler(r.Client, r.Options))).
Complete(r)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (r *LocalResourceSliceReconciler) SetupWithManager(mgr ctrl.Manager) error
return err
}

return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlResourceSlicesLocal).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlResourceSliceLocal).
For(&authv1beta1.ResourceSlice{}, builder.WithPredicates(localResSliceFilter)).
Complete(r)
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (r *NonceCreatorReconciler) SetupWithManager(mgr ctrl.Manager) error {
return selector.Matches(labels.Set(o.GetLabels()))
})

return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlNonceCreator).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlSecretNonceCreator).
For(&corev1.Secret{}, builder.WithPredicates(filter)).
Complete(r)
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (r *NonceSignerReconciler) SetupWithManager(mgr ctrl.Manager) error {
return selector.Matches(labels.Set(o.GetLabels()))
})

return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlNonceSigner).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlSecretNonceSigner).
For(&corev1.Secret{}, builder.WithPredicates(filter)).
Complete(r)
}
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (r *RemoteResourceSliceReconciler) SetupWithManager(mgr ctrl.Manager) error
return err
}

return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlResourceSlicesRemote).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlResourceSliceRemote).
For(&authv1beta1.ResourceSlice{}, builder.WithPredicates(predicate.And(remoteResSliceFilter, withCSR()))).
Watches(&authv1beta1.Tenant{}, handler.EnqueueRequestsFromMapFunc(r.resourceSlicesEnquer())).
Complete(r)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (r *InternalFabricReconciler) SetupWithManager(mgr ctrl.Manager) error {
},
)

return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlInternalFabricsCM).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlInternalFabricCM).
For(&networkingv1beta1.InternalFabric{}).
Watches(&networkingv1beta1.InternalNode{}, internalNodeEnqueuer).
Owns(&networkingv1beta1.RouteConfiguration{}).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager, workers int) error {
UpdateFunc: func(_ event.UpdateEvent) bool { return true },
GenericFunc: func(_ event.GenericEvent) bool { return false },
}
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlShadowPods).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlShadowPod).
For(&offloadingv1beta1.ShadowPod{}).
Owns(&corev1.Pod{}, builder.WithPredicates(reconciledPredicates)).
WithOptions(controller.Options{MaxConcurrentReconciles: workers}).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (r *QuotaCreatorReconciler) SetupWithManager(mgr ctrl.Manager) error {
klog.Error(err)
return err
}
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlResourceSlicesQuotaCreator).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlResourceSliceQuotaCreator).
For(&authv1beta1.ResourceSlice{}, builder.WithPredicates(remoteResSliceFilter)).
Owns(&offloadingv1beta1.Quota{}).
Complete(r)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (r *VirtualNodeCreatorReconciler) SetupWithManager(mgr ctrl.Manager) error
klog.Error(err)
return err
}
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlVirtualNodeCreator).
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlResourceSliceVNCreator).
For(&authv1beta1.ResourceSlice{}, builder.WithPredicates(predicate.And(localResSliceFilter, withConditionsAccepeted()))).
Owns(&offloadingv1beta1.VirtualNode{}).
Owns(&authv1beta1.Identity{}).
Expand Down

0 comments on commit 2ccae2c

Please sign in to comment.