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

feat: add VRF support #271

Closed
wants to merge 0 commits into from
Closed

feat: add VRF support #271

wants to merge 0 commits into from

Conversation

irusoeqx
Copy link
Contributor

@irusoeqx irusoeqx commented May 24, 2023

VRF support

Hi

Go rookie here trying my hand and adding some VRF support to the metal-cli. I mostly just tried to just build off other functions and structure the code so that it uses the correct parameters and expects the right things to be fed to it. Really hoping to get some feedback here, I know my code is far from perfect but I am hoping to get some working knowledge of GoLang out of this. Any and all feedback is very welcome!

Import for "github.com/equinix/metal-cli-vrfsupport/internal/vrf" in the cli.go file is meant to be just temporary for testing just so the whole things gets put together correctly. Not sure if this is necessary. Would also like to know if there is a better way to unit test the functions without manually downloading them, or including them in the main packages directory.

Fixes #268

cmd/cli.go Outdated Show resolved Hide resolved
internal/vrf/create.go Outdated Show resolved Hide resolved
internal/vrf/create.go Outdated Show resolved Hide resolved
internal/vrf/create.go Outdated Show resolved Hide resolved
internal/vrf/create.go Outdated Show resolved Hide resolved
internal/vrf/create.go Outdated Show resolved Hide resolved
@irusoeqx
Copy link
Contributor Author

irusoeqx commented Jun 8, 2023

I committed the changes you recommended and reviewed everything, I am going to mark this as "Ready for Review".

@irusoeqx irusoeqx marked this pull request as ready for review June 8, 2023 09:21
@displague
Copy link
Member

displague commented Jun 20, 2023

@irusoeqx Have a look at the comments GitHub Actions left. These should help guide development to some extent. Continue to look at the other resources for inspiration.

Something to be aware of is that we've been migrating resources in this provider from packngo to metal-go.
With that work and other work to introduce VRF features in integrations, others may eventually be available to assist more substantially with this PR (cc @Vasubabu @ctreatma).

Thanks again for opening this PR, responding to the feedback, and learning Go in the process 🚀

cmd.SilenceUsage = true

req := &packngo.VRFCreateRequest{
Metro: metro,
Copy link
Contributor

Choose a reason for hiding this comment

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

Metro in which to create the VLAN. Mutually exclusive with Facility. We are supporting Facility too.

Copy link
Contributor

Choose a reason for hiding this comment

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

VRFs can only be created in metros. The underlying API for this feature doesn't support facility.

root.PersistentPreRun(cmd, args)
}
}
c.Service = c.Servicer.API(cmd).ProjectVRFs //Not sure about this endpoint
Copy link
Contributor

Choose a reason for hiding this comment

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

@irusoeqx if you're up for it, you can convert your PR to use metal-go by rebasing on the latest commit from the metal-cli main branch. As of that commit, there is a MetalAPI function that provides a metal-go client.

With metal-go, this line would become something like

c.Service = c.Servicer.MetalAPI(cmd).VRFsAPI

Docs for VRFsApi are here (note that the code examples in docs are auto-generated and serve as examples of syntax, not of fully-working code): https://github.com/equinix-labs/metal-go/blob/main/docs/VRFsApi.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes il do that, I just need a little time.

@cprivitere
Copy link
Member

Yes il do that, I just need a little time.

Hey there, was wondering if you were going to be able to come back to this or not. It's fine if not, we'll just close this and do a new PR for VRF support on our own.

@irusoeqx
Copy link
Contributor Author

irusoeqx commented Oct 2, 2023 via email

@displague displague closed this Oct 3, 2023
@displague displague changed the title update to vrf feat: add VRF support Oct 3, 2023
@displague
Copy link
Member

I'm not sure how this was closed. I force pushed some changes and then the convention commits bot chimed in.

We'll see if we can pull these commits in to the work when we revisit the VRF features in Metal CLI, soon.

@displague
Copy link
Member

I see what I did wrong:
git push https://github.com/irusoeqx/metal-cli-vrfsupport main vs
git push https://github.com/irusoeqx/metal-cli-vrfsupport irusoeqx/main:main.

I reset the PR to match main, so the PR was closed as a no-op.

@displague
Copy link
Member

displague commented Oct 3, 2023

Here's the branch with my changes to get VRF create basically working: https://github.com/equinix/metal-cli/compare/main...displague:irusoeqx/main?expand=1

I didn't run a full test because my project did not seem to have permission to create a VRF.

@displague displague mentioned this pull request Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for VRF features
5 participants