fluxcd / flux2

Open and extensible continuous delivery solution for Kubernetes. Powered by GitOps Toolkit.
https://fluxcd.io
Apache License 2.0
6.18k stars 574 forks source link

The "owner" argument for flux bootstrap gitlab (probably others too) does not make sense if URL includes groups/subgroups #3817

Open aleksandaratanasov opened 1 year ago

aleksandaratanasov commented 1 year ago

The research institute I am working for has its own GitLab instance. My team has its own group and inside we have subgroups and what not. The repository I would like to use has the following URL (placeholders used due to privacy):

https://gitlab.example.com/institute/department/research-group/cloud-computing/administration/k8s-playground.git

As you can see the structure is nested:

I am quite new to GitOps and Kubernetes in general but I do believe that flux is rather confusing when it comes to anything that is not in the form of

https://gitlab.example.com/USER/REPOSITORY.git

The URL I have used at the beginning needs to be split into chunks that, given the name of the argument --owner, is anything but helpful. It took me half an hour trying to figure out what's going on:

flux bootstrap gitlab --hostname=https://gitlab.example.com --repository=k8s-playground --branch=main --path=./clusters/playground/ --token-auth --owner=institute/department/research-group/cloud-computing/administration

Notice the absence of trailing/leading /, which is an extra thing the user needs to consider not to mention the absence of .git suffix. I do realize that internally a lot of concatenation is going on and this is how I managed to figure out what to put where.

However in the end --owner=institute/department/research-group/cloud-computing/administration is not really the owner but rather a nested structure.

I would suggest to rename the owner to something like url-path or similar. Best would be remove that completely and just go with the full URL for the --repository argument since most people are familiar with that anyway. I would further suggest to remove the requirement to discard the .git suffix and remove --hostname:

flux bootstrap gitlab --repository=https://gitlab.example.com/institute/department/research-group/cloud-computing/administration/k8s-playground.git --branch=main --path=./clusters/playground/ --token-auth

In the end hostname can be extracted inside flux itself (plenty of regexes out there for doing that).

simonfelding commented 4 months ago

fully agree. it's really hard to figure out whats going on when the variable names are so blatantly incorrect and the output from the CLI is misleading too.

nagyv commented 3 months ago

I opened an issue in the GitLab issue tracker to get GitLab involved in improving the UX. I recommend to continue the discussion there, and finally create an RFC here.

nagyv commented 1 month ago

@simonfelding @aleksandaratanasov @razvanphp @elehcim We discussed at GitLab the flux bootstrap gitlab command arguments / UX, and came up with the following proposal. I'd like to ask for your feedback about it:

We recommend two GitLab specific flags:

Together with implementing the above changes, we recommend to:

Together with the above we discussed that --path and -–project-path might be confusing. Still, we recommend going forward with both flags as there is a description with usage, and both names are typical across GitLab.

Please, let me know what you think!

elehcim commented 1 month ago

I think it's a great proposal. Thanks

simonfelding commented 1 month ago

It's good but it would be even greater if it supported using a pre-existing repo (all it should do is set up the token).

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: Michele Mastropietro @.> Sent: Sunday, June 23, 2024 11:45:04 AM To: fluxcd/flux2 @.> Cc: simonfelding @.>; Mention @.> Subject: Re: [fluxcd/flux2] The "owner" argument for flux bootstrap gitlab (probably others too) does not make sense if URL includes groups/subgroups (Issue #3817)

I think it's a great proposal. Thanks

— Reply to this email directly, view it on GitHubhttps://github.com/fluxcd/flux2/issues/3817#issuecomment-2184922288, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKYOW73VGWDOVGPOMEUUNS3ZI2KKBAVCNFSM6AAAAAAXDVSY5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBUHEZDEMRYHA. You are receiving this because you were mentioned.Message ID: @.***>

nagyv commented 1 month ago

It's good but it would be even greater if it supported using a pre-existing repo (all it should do is set up the token).

@simonfelding Did you meant that when running from a gitlab project checkout directory, the --hostname and --project-path should default to those of the current repo? I like this idea! Thanks!

simonfelding commented 1 month ago

Wow that would be really cool and easy! I actually meant the use case where you have a project repo already and you want Flux to sync with it. The bootstrap command only works with setting up a new project (that doesn't already exist).

If it's not entirely clear, the only way to use it right now is to have it create a new project. I want to use it with a project that already has everything, it just needs the token set up by the bootstrap command. Does that make sense?

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: Viktor Nagy @.> Sent: Monday, June 24, 2024 9:20:55 PM To: fluxcd/flux2 @.> Cc: simonfelding @.>; Mention @.> Subject: Re: [fluxcd/flux2] The "owner" argument for flux bootstrap gitlab (probably others too) does not make sense if URL includes groups/subgroups (Issue #3817)

It's good but it would be even greater if it supported using a pre-existing repo (all it should do is set up the token).

@simonfeldinghttps://github.com/simonfelding Did you meant that when running from a gitlab project checkout directory, the --hostname and --project-path should default to those of the current repo? I like this idea! Thanks!

— Reply to this email directly, view it on GitHubhttps://github.com/fluxcd/flux2/issues/3817#issuecomment-2187247363, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKYOW75BQGQKAK6P62A2UA3ZJBWRPAVCNFSM6AAAAAAXDVSY5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBXGI2DOMZWGM. You are receiving this because you were mentioned.Message ID: @.***>

stefanprodan commented 1 month ago

The bootstrap command only works with setting up a new project (that doesn't already exist).

Never heard this before from GitLab users, Flux bootstrap should detect if a repo exists and uses it. How did you come to this conclusion?

makkes commented 1 month ago

The bootstrap command only works with setting up a new project (that doesn't already exist).

This is wrong! The bootstrap gitlab command works just fine with a pre-existing project. I just did exactly that.

simonfelding commented 1 month ago

Oh! My bad then. I had an issue with it but I don't have the time to try to recreate the issue.

On Tue, Jun 25, 2024 at 3:20 PM Max Jonas Werner @.***> wrote:

The bootstrap command only works with setting up a new project (that doesn't already exist).

This is wrong! The bootstrap gitlab command works just fine with a pre-existing project. I just did exactly that.

— Reply to this email directly, view it on GitHub https://github.com/fluxcd/flux2/issues/3817#issuecomment-2188949131, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKYOW7ZWADCCBSROOXRF5JLZJFVDLAVCNFSM6AAAAAAXDVSY5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBYHE2DSMJTGE . You are receiving this because you were mentioned.Message ID: @.***>