-
Notifications
You must be signed in to change notification settings - Fork 2
feat: allow configuring in which network instances are created #1
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: allow configuring in which network instances are created #1
Conversation
ea3f24a to
69cc23d
Compare
|
Hi there, thank you for your contribution. We have this on our roadmap as well, but might do a slightly different implementation: We will require multiple networks to be specifyable (so the runner has access to multiple networks), with one network being the one that is returned to the GitLab runner manager. Or at least, that's how I envision it currently. I haven't done all the leg-work yet. Work on this should commence within the next two weeks, as we have other customers interested in this. So I hope you don't mind I hold off on this for a bit, until I know for certain what we need the implementation to look like. |
|
I don't mind; This is just how I made it work because we just need one network. FYI: I have another PR pending for creating instances in parallel, as we are using the plugin with the instance executor type, and creating machines sequentially significantly slows down our pipelines. (also, docs for howto do that incomming) |
|
Actually, it was rather easy to make it accept multiple networks |
|
Its currently implemented like this:
|
41a93af to
d5377fa
Compare
|
That looks reasonable. Let me have a closer look at this next week and I'll get back to you. Parallel creation also sounds interesting, looking forward to getting into that once you have a PR 🙂 |
|
I took a look at this, and I think this is a pretty good solution already, though I have some feedback I'd like to see implemented: Combine Network Config I think combining the network config into a single item as follows, would be preferrable: networks = [
"public"
]The first network would be the one meant for the GitLab controller, the others would be extra networks. I think this makes it slightly cleaner conceptually, and ties in into my next point. Use Interfaces Objects In the API, we have a number of ways to define interfaces for servers: For example, we might start a server with the following interfaces config: [
{"network": "UUID3", "addresses": [{"subnet": "UUID4"}]}
]I think in many cases, passing the network UUID alone is sufficient, but we might end up with customers that want something more specific down the line, and then we would have to deprecate the old config, and move to a new one. So ideally, the config just resolves into the Go SDKs interface objects: This way, we would be able to support all kinds of configurations down the line. Consequently, we would end up with something like this in the config (I think interfaces = [{ network = "UUID3", addresses = [{ subnet = "UUID4" }] }]This would be the default: interfaces = [{ network = "public" }]Support Legacy Config We want to support updating the fleeting plugin in this manner: For this to work, the existing config should still work. Currently this fails, because the new fleeting image does not have a default network config. That is to say: Writing the default into the Since this adds some complexity that might not be relevant for your use-case, let me know if you'd like me to take on some, if not all of these changes. I'm happy to review any further changes as well though. So let me know what you think, and how you would like to proceed. |
d5377fa to
51816e7
Compare
|
So, i've implemented the This currently sits on top of #2, but if needed i can rebase it to be standalone as well. What i'm not quite sure about is when one would want to specify an address. Wouldn't that limit your scale to 1 instance, as everything else gives ip collisions? Also, the actual implementation was surprisingly simple |
51816e7 to
e35ad7a
Compare
|
Thanks, I think this is about good to go. Since I have some things to remark on the other PR, I would indeed appreciate it if you could separate them again (then we can go ahead and merge this one first). One comment, and this ties into your observation:
I could see some use-case where this might be useful (say someone wants to scale from 0 to one single beefy runner at certain times, and wants to set the IP for that), but I think it's far fetched. And so I would actually remove the example you give about setting the IP address. My main point about this implementation is to be forwards-compatible. For example, currently networks have but one subnet. But that may change in the future, and we could support this in Fleeting without a breaking change. We might also support running without DHCP (which happens if you set |
e35ad7a to
c07e143
Compare
|
Ok, i've separated them again, and removed the example with the explicitly specified address |
|
I'm ready to merge this once small fix above is implemented. |
|
Note: I tried to enable github workflow builds for all pull requests targeting |
|
Since the tests are successful with the little fix mentioned above, I'll go ahead and merge this, then fix it in |
|
FYI, there is now a beta release that we'll be testing, in case if you want to run this on your infrastructure: And thanks again for your contributions! 🙂 |
|
Nice, i'll be testing the beta version somewhen next week! |
For our usecase, we needed the runner instances to be created in a private network.
If no network is specified, will use the public by default