Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding API calls to create a Fleet #1160

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

JunyuQian
Copy link

This is the initial pull request, implementing the API call for fleet creation and the callback function triggered by the user’s right-click on the ‘Create Fleet’ button.

The entry point (the ‘Create Fleet’ button) for this function is not yet available in the UI. This ensures that users will not encounter features still under development, enabling seamless and incremental integrations.

@Tatsinnit
Copy link
Member

💡 🥷 Note only please: (for help for broken build) Build is broken because the package @azure/arm-containerservicefleet is missing from the package.json please add it and it will work magically :) (obviously under the hood it will find the package from package manager)

Screenshot 2025-01-08 at 12 37 21 PM

}

const client = new ContainerServiceFleetClient(getCredential(sessionProvider.result), subscriptionId);
createFleet(client, "junyuqian", "vscode-fleet", { location: "Australia East" });
Copy link
Member

Choose a reason for hiding this comment

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

Since the scope of this PR is now so much smaller, can we make a user-input right away?

Copy link
Member

Choose a reason for hiding this comment

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

@Tatsinnit I'll leave it to you. I don't know how much complexity that would add. fine to merge and deal with it later.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed. Nice idea, It is not that complicated, in the earlier version demo shared, it was all flowing through the quickpick et. al.

Since it's all backend, and anonymised - lets either at least make clear //TODO Comment please here for anyone else trying to understand why this createFleet function is trying to do here, in case of folks want to help.

Future PR note: Also, from U/X we should make it simple pass it on from the web view of just quick pick kind of thing.

Copy link
Member

Choose a reason for hiding this comment

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

This is what I would do to make sure this is basically super early stage work and really avoid the hard-coded bits: :)

// Temporary code for incremental check-in.
// TODO: Replace hardcoded values with dynamic parameters or configuration settings.

// Initialize the ContainerServiceFleetClient with session credentials and subscription ID.
// Hardcoded 'subscriptionId' should be parameterized in future updates.
const client = new ContainerServiceFleetClient(
    getCredential(sessionProvider.result), // Retrieve credentials from session provider.
    subscriptionId // TODO: Ensure subscriptionId is dynamically passed or configured.
);

// Create a fleet using hardcoded parameters.
// TODO: Replace hardcoded 'junyuqian', 'vscode-fleet', and 'Australia East' with configurable inputs.
createFleet(
    client,
    "Fleet-Resrource-Name", // Fleet resource group name (hardcoded).
    "Fleet-Name", // Fleet name (hardcoded).
    { location: "Australia East" } // Location (hardcoded).
);

// NOTE: This temporary implementation assumes static context for testing purposes.
// Ensure these hardcoded values are replaced with appropriate dynamic configurations
// before finalizing this code for production level work which will be user focused.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you so much Tats! It's so pleasant to read your code with all these neat comments! This will be the standard I'll align to when I write explanatory comments later :)

package.json Outdated
@@ -331,6 +331,10 @@
{
"command": "aks.aksKaitoTest",
"title": "Test KAITO models"
},
{
"command": "aks.aksCreateFleet",
Copy link

Choose a reason for hiding this comment

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

Might be better to remove these command/title changes from the PR (since they're related to the menu, not the API), and leave only the new package on line 646.

package.json Outdated
@@ -541,6 +549,12 @@
"command": "aks.aksReconcileCluster",
"group": "navigation"
}
],
"aks.fleetMangerSubMenu": [
Copy link
Member

Choose a reason for hiding this comment

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

💡Note please: I thought you are not hooking the command yet. and this is backend only kind of PR?

package.json Outdated
@@ -442,6 +446,10 @@
"submenu": "aks.kaitoInstallSubMenu",
"when": "view == kubernetes.cloudExplorer && viewItem =~ /aks\\.cluster/i",
"group": "9@3"
},
{
"submenu": "aks.fleetMangerSubMenu",
Copy link
Member

Choose a reason for hiding this comment

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

💡 Please note: same goes here, as a reference to this comment: https://github.com/Azure/vscode-aks-tools/pull/1160/files#r1906207748

I thought you are just adding backend code for now and classes and there submenu hooks are not needed?

package.json Outdated
},
{
"command": "aks.aksCreateFleet",
"title": "Create Fleet"
Copy link
Member

@Tatsinnit Tatsinnit Jan 8, 2025

Choose a reason for hiding this comment

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

💡 Please note: Why do we need this with this checkin please? I think this change is not needed for this PR, only thing you need is the @azure/arm-containerservicefleet": "^1.1.0 which will get your supporting backend changes working. Please do correct me or add thoughts.

@Tatsinnit Tatsinnit added enhancement 🚀 New feature or request or improvements on existing code. Incremental Build 🏗️ labels Jan 8, 2025
@JunyuQian
Copy link
Author

Hi @Tatsinnit @serbrech @dvadas, thank you all for your comments! All the problems have been addressed and please let me know if there is anything I can improve :)

// TODO: Replace hardcoded 'junyuqian', 'vscode-fleet', and 'Australia East' with configurable inputs.
createFleet(
client,
"Fleet-Resrource-Name", // Fleet resource group name (hardcoded).
Copy link
Member

@Tatsinnit Tatsinnit Jan 8, 2025

Choose a reason for hiding this comment

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

💡 Minor: Please take care in the latter PR, spelling Fleet-Resource-Name rather then Fleet-Resrource-Name :) Thanks.

Tatsinnit
Tatsinnit previously approved these changes Jan 8, 2025
Copy link
Member

@Tatsinnit Tatsinnit left a comment

Choose a reason for hiding this comment

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

💡 ❤️ Looks good to me, this is skeleton only PR, nothing is hooked yet for the work under create fleet idea of integration to VSC.

@ReinierCC
Copy link
Collaborator

ReinierCC commented Jan 8, 2025

Good work so far! It looks like your commits are unsigned so you might have some difficulty when you go to merge your PR.

You'll likely need to generate a new GPG key and resign your commits.

I dealt with this same issue recently, so if you have any questions feel free to reach out!

@Tatsinnit
Copy link
Member

Good work so far! It looks like your commits are unsigned so you might have some difficulty when you go to merge your PR.

You'll likely need to generate a new GPG key and resign your commits.

I dealt with this same issue recently, so if you have any questions feel free to reach out!

❤️ Thank you so much @ReinierCC , nice catch, yes please lets get your commit signed @JunyuQian

Here are few docs as to how to sign your commits.

Please feel free to reach out if you get stuck,

Just as example by verification all your commit will have this verified tag

Screenshot 2025-01-09 at 11 43 39 AM

Thanks heaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🚀 New feature or request or improvements on existing code. Incremental Build 🏗️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants