Skip to content

Conversation

@cheina97
Copy link
Member

@cheina97 cheina97 commented Jul 15, 2025

Description

This public relations change replaces the Gateway name with the unique remote cluster ID used for Internalfabric.

This addresses a bug that arises when two gateways share the same name. The internal fabrics are created with the same name, and subsequently, their names are utilized to establish two distinct routing tables. However, the routing configuration webhook validates the uniqueness of the routing table names.

@adamjensenbot
Copy link
Collaborator

Hi @cheina97. Thanks for your PR!

I am @adamjensenbot.
You can interact with me issuing a slash command in the first line of a comment.
Currently, I understand the following commands:

  • /rebase: Rebase this PR onto the master branch (You can add the option test=true to launch the tests
    when the rebase operation is completed)
  • /merge: Merge this PR into the master branch
  • /build Build Liqo components
  • /test Launch the E2E and Unit tests
  • /hold, /unhold Add/remove the hold label to prevent merging with /merge

Make sure this PR appears in the liqo changelog, adding one of the following labels:

  • feat: 🚀 New Feature
  • fix: 🐛 Bug Fix
  • refactor: 🧹 Code Refactoring
  • docs: 📝 Documentation
  • style: 💄 Code Style
  • perf: 🐎 Performance Improvement
  • test: ✅ Tests
  • chore: 🚚 Dependencies Management
  • build: 📦 Builds Management
  • ci: 👷 CI/CD
  • revert: ⏪ Reverts Previous Changes

@github-actions github-actions bot added the refactor Reorganizes or optimizes code without changing its behavior label Jul 15, 2025
@cheina97
Copy link
Member Author

/rebase test=true

@cheina97 cheina97 force-pushed the frc/internalfabric branch from 2c9577d to 9f7be3a Compare July 15, 2025 18:34
@cheina97
Copy link
Member Author

/build

@cheina97 cheina97 force-pushed the frc/internalfabric branch from 9f7be3a to 1f0a19e Compare July 16, 2025 06:39
@cheina97 cheina97 marked this pull request as ready for review July 16, 2025 08:15
@cheina97 cheina97 force-pushed the frc/internalfabric branch from 1f0a19e to 8766fd5 Compare July 16, 2025 08:17
@cheina97
Copy link
Member Author

/rebase

@cheina97
Copy link
Member Author

/rebase test=true

@cheina97 cheina97 requested review from aleoli, claudiolor and fra98 July 16, 2025 15:51
@cheina97 cheina97 force-pushed the frc/internalfabric branch 3 times, most recently from 28ae603 to a389fd6 Compare July 16, 2025 16:59
@pull-request-size pull-request-size bot added size/L and removed size/M labels Jul 16, 2025
@cheina97 cheina97 force-pushed the frc/internalfabric branch from a389fd6 to 2e4a799 Compare July 16, 2025 17:01
@frisso
Copy link
Member

frisso commented Jul 16, 2025

@cheina97 First, thanks for this nice contribution.
A suggestion: if possible, it would be nice to have the name as "gw-clusterid" or something similar, in order to easily understand that this is a gateway pod, and not just the "clusterid".
Finally, a note: in the future we may have multiple gateways connected to the same cluster, e.g., for load balancing, so even a name that includes the "remote cluster id" may not be enough to distinguish the pods.

@cheina97 cheina97 force-pushed the frc/internalfabric branch 2 times, most recently from 07f6e67 to c2b5d1c Compare July 16, 2025 17:41
@cheina97
Copy link
Member Author

@cheina97 First, thanks for this nice contribution. A suggestion: if possible, it would be nice to have the name as "gw-clusterid" or something similar, in order to easily understand that this is a gateway pod, and not just the "clusterid". Finally, a note: in the future we may have multiple gateways connected to the same cluster, e.g., for load balancing, so even a name that includes the "remote cluster id" may not be enough to distinguish the pods.

The name for gateway is still fully customizable, the only resource that is changing name is the InternalFabric that will use the remote cluster ID

@cheina97 cheina97 force-pushed the frc/internalfabric branch 3 times, most recently from b140dd9 to 7c806b8 Compare July 17, 2025 07:51
@cheina97
Copy link
Member Author

/rebase test=true

@cheina97 cheina97 force-pushed the frc/internalfabric branch from 3f84205 to 92211df Compare July 17, 2025 13:51
@cheina97
Copy link
Member Author

/rebase test=true

@cheina97
Copy link
Member Author

/merge

@adamjensenbot adamjensenbot added the merge-requested Request bot merging (automatically managed) label Jul 17, 2025
@adamjensenbot adamjensenbot merged commit f085da4 into liqotech:master Jul 17, 2025
24 of 26 checks passed
@adamjensenbot adamjensenbot removed the merge-requested Request bot merging (automatically managed) label Jul 17, 2025
@cheina97 cheina97 deleted the frc/internalfabric branch July 17, 2025 15:20
Comment on lines +110 to +113
internalFabricName, err := netutils.ForgeInternalFabricName(ctx, r.Client, &gwClient.ObjectMeta)
if err != nil {
return fmt.Errorf("unable to retrieve the cluster ID from the gateway client %q", gwClient.Name)
}
Copy link
Member

@fra98 fra98 Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: why are we getting the remote cluster ID from the object if we have it already here? I think we can just return the string statically (e.g., func ForgeInternalFabricName(remoteClusterID liqov1beta1.ClusterID) { return remoteClusterID }).
It seems safer (no possible errors raised, no contacting the apiserver).

Comment on lines +27 to +38
// getInternalFabric retrieves the InternalFabric resource associated with the given GatewayServer.
// WARNING: this function contains 2 calls to the Kubernetes API using 2 different names.
// This is intended to avoid breaking changes, since the InternalFabric name has changed from GatewayServer name to the GatewayServer cluster ID.
func getInternalFabric(ctx context.Context, cl client.Client, gatewayName, remoteID, ns string) (*networkingv1beta1.InternalFabric, error) {
internalFabric := &networkingv1beta1.InternalFabric{}
err := cl.Get(ctx, client.ObjectKey{
Name: remoteID,
Namespace: ns,
}, internalFabric)
if client.IgnoreNotFound(err) != nil {
return nil, fmt.Errorf("unable to get the internal fabric %q: %w", remoteID, err)
}
Copy link
Member

@fra98 fra98 Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The real reason for the above comment arises since here it is not clear why we are using the remoteID, and it is harder to maintain or lead to bugs if we change the logic of the ForgeInternalFabric() name again. Instead, we can call the forge method again, passing as argument only the remoteClusterID (also here we have it directly in the function)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Reorganizes or optimizes code without changing its behavior size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants