Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mayooot
Copy link

@mayooot mayooot commented Jun 12, 2025

Multiple namespaces can be offloaded.

Description

Added the liqoctl offload namespaces command. Matching namespaces can be found using --label-selector.

Fixes #(issue)

#3057

How Has This Been Tested?

Yes, I hava tested it locally.

 $ liqoctl offload namespaces --label-selector='app=namespaces'
 INFO  Offloading of namespace "need01" correctly enabled
 INFO  Offloading completed successfully
 INFO  Offloading of namespace "need03" correctly enabled
 INFO  Offloading completed successfully

@github-actions github-actions bot added the feat Adds a new feature to the codebase label Jun 12, 2025
@adamjensenbot
Copy link
Collaborator

Hi @mayooot. 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

@frisso
Copy link
Member

frisso commented Jun 12, 2025

This looks very good to me, thanks!
Final words to @claudiolor , who has a deeper understanding of the source code.

@mayooot
Copy link
Author

mayooot commented Jun 16, 2025

@claudiolor Please check it.

@claudiolor
Copy link
Contributor

Hi @mayooot thank you so much for your PR :D

I would not create a new command with a single letter of difference to another as it seems to me really prone to user errors, while instead I would reuse the same command with some aliases so that liqoctl offload namespace can be liqoctl offload namespaces or liqoctl offload ns and add the --selector option to it.
So according to this, we can allow the user to provide more than one namespace name removing this option from the command.
At this point we can move the logic of offload/handler.go from line 75 below on a separate function, so that we iterate over the namespaces indicated by the user or the ones retrieved via the label selector and call this function for each of the namespaces.

Of course, we should return an error if the user specified both the name of the namespaces of the label selectors or none of them.

In this way I think we are reducing the possibility that a user makes a mistake, we are giving the possibility to offload more than one namespace by name at a time and there is no need to duplicate code in order to introduce a new command.
Let me know what you think about it :)

@mayooot
Copy link
Author

mayooot commented Jun 16, 2025

@claudiolor You're right, namespace and namespaces do make it easy to get confused.
I tried to minimize changes to the source code during development, so I added a new command that minimizes the impact on the original functionality.

It's right to make changes to the namespace command directly, so that the processing of a single namespace and multiple namespaces can be put into a Run function, and it's more optimized for the user.

I will update the code as we discussed.
Thanks a lot!

@github-actions github-actions bot added the refactor Reorganizes or optimizes code without changing its behavior label Jun 18, 2025
@mayooot
Copy link
Author

mayooot commented Jun 18, 2025

@claudiolor I've done that.
It can be used below:

$ liqoctl offload namespace lowkey01
 INFO  Offloading of namespace "lowkey01" correctly enabled
 INFO  Offloading completed successfully

$ liqoctl offload namespace lowkey02 lowkey03 lowkey04
 INFO  Offloading of namespace "lowkey02" correctly enabled
 INFO  Offloading completed successfully
 INFO  Offloading of namespace "lowkey03" correctly enabled
 INFO  Offloading completed successfully
 INFO  Offloading of namespace "lowkey04" correctly enabled
 INFO  Offloading completed successfully

$ liqoctl offload namespace --label-selector="bunch=yes"
 INFO  Offloading of namespace "highkey01" correctly enabled
 INFO  Offloading completed successfully
 INFO  Offloading of namespace "highkey02" correctly enabled
 INFO  Offloading completed successfully
 INFO  Offloading of namespace "highkey03" correctly enabled
 INFO  Offloading completed successfully

@claudiolor
Copy link
Contributor

claudiolor commented Jun 18, 2025

Hi @mayooot thanks a lot! :) I will check it ASAP

Copy link
Contributor

@claudiolor claudiolor left a comment

Choose a reason for hiding this comment

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

Overall the PR is ok, just a couple of comments that need to be addressed

@mayooot mayooot requested review from claudiolor and frisso June 19, 2025 11:12
@frisso
Copy link
Member

frisso commented Jun 20, 2025

@mayooot This looks very good to me (@claudiolor for more precise notes on the code).
To be completed, we would need two more steps:

Copy link
Contributor

@claudiolor claudiolor left a comment

Choose a reason for hiding this comment

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

Some changes needs to be done as:

  • The manifest output is broken (the namespace name is not provided so everything is created in the default namespace)
  • We need to add an additional check to avoid that --remote-namespace-name is provided when multiple namespace are targeted for offloading

Once these changes are done I believe the code of the offload command can be considered complete :)

@github-actions github-actions bot added the fix Fixes a bug in the codebase. label Jun 23, 2025
@mayooot
Copy link
Author

mayooot commented Jun 23, 2025

@claudiolor All done. Cloud you check it when you have a moment?

Copy link
Contributor

@claudiolor claudiolor left a comment

Choose a reason for hiding this comment

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

Thank you for fixing the issues I reported! πŸ’―
Once the small issue I underlined is fixed we can consider the offload command completed.
To merge this PR we still need to implement a similar behavior with the unoffload command and the documentation needs to be updated accordingly.

@mayooot
Copy link
Author

mayooot commented Jun 23, 2025

Thank you for fixing the issues I reported! πŸ’― Once the small issue I underlined is fixed we can consider the offload command completed. To merge this PR we still need to implement a similar behavior with the unoffload command and the documentation needs to be updated accordingly.

Ok, I've fixed the bugs, and I'll implement unoffload command ASAP.

@mayooot
Copy link
Author

mayooot commented Jun 24, 2025

@claudiolor All is done. Please check it and let me know your suggestions about the code and docs :)

@claudiolor
Copy link
Contributor

Thanks @mayooot, I will check these changes ASAP

Copy link
Contributor

@claudiolor claudiolor left a comment

Choose a reason for hiding this comment

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

Thank you for implementing also unoffload!

  • I left just a couple of comment.
  • Before merging we also need to update the automatically generated liqoctl documentation, you can update the documentation by launching make ctldocs, then you can commit the updated files.

Once those two points are addressed I believe we can merge

@mayooot
Copy link
Author

mayooot commented Jun 26, 2025

Thank you for implementing also unoffload!

  • I left just a couple of comment.
  • Before merging we also need to update the automatically generated liqoctl documentation, you can update the documentation by launching make ctldocs, then you can commit the updated files.

Once those two points are addressed I believe we can merge

@claudiolor I'm done here :)

@claudiolor
Copy link
Contributor

@mayooot thank you! @aleoli can you please check and merge this?

@claudiolor claudiolor requested a review from aleoli July 1, 2025 07:30
@aleoli
Copy link
Member

aleoli commented Jul 1, 2025

/test

1 similar comment
@claudiolor
Copy link
Contributor

/test

@aleoli
Copy link
Member

aleoli commented Jul 2, 2025

Hi @mayooot! It looks good to me.

Could you please squash all your commits into a single commit? Then we can proceed with the merge. Thanks!

@github-actions github-actions bot removed fix Fixes a bug in the codebase. refactor Reorganizes or optimizes code without changing its behavior labels Jul 2, 2025
@mayooot
Copy link
Author

mayooot commented Jul 2, 2025

Hi @mayooot! It looks good to me.

Could you please squash all your commits into a single commit? Then we can proceed with the merge. Thanks!

Sure, I just squashed them.

@aleoli
Copy link
Member

aleoli commented Jul 2, 2025

/rebase test=true

@aleoli
Copy link
Member

aleoli commented Jul 2, 2025

/merge

@adamjensenbot adamjensenbot added the merge-requested Request bot merging (automatically managed) label Jul 2, 2025
@adamjensenbot adamjensenbot merged commit 2b128e7 into liqotech:master Jul 2, 2025
14 checks passed
@adamjensenbot adamjensenbot removed the merge-requested Request bot merging (automatically managed) label Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat Adds a new feature to the codebase size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants