-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Flux v2 support #3066
Flux v2 support #3066
Conversation
6a22b14
to
add5f56
Compare
add5f56
to
b001ff8
Compare
|
51b2a0e
to
93a3c67
Compare
We do severals releases per week for flux2, unless eksctl plans to do the same to keep up with Flux changes I suggest we stick to using Flux CLI instead of a package. I don't expect users to just bootstrap a cluster, they will have to download Flux CLI anyway to build their GitOps pipelines. |
@stefanprodan We are using the CLI. We required users to have the CLI on the path, and then we shell out. From the description:
|
@Callisto13 maybe it's not clear from my comment, I did read the code changes in this PR and I'm in favour of using the Flux CLI. We could provide a bootstrap package but then eksctl would need to keep up with flux2 releases as well as Kubernetes. |
Sorry, morning brain! So to clarify, you are saying to stick with the approach I have here because providing a library in Flux would in reality not be useful to us? |
This is not about usefulness but about velocity. |
000963f
to
83af5fe
Compare
83af5fe
to
2d2af46
Compare
@markramm are you happy with the subcommand on this? |
oh yes good catch 👍 |
e1d620e
to
da3f38f
Compare
@Callisto13 With fluxv2 do any of the 3 existing fields under |
agreed 👍 as discussed in standup and with feedback from Mark Ramm; we are gonna abandon the So the config would look like: gitops:
flux:
gitProvider: github # required. options are github or gitlab
owner: dr-who # required
repository: my-cluster-gitops # required
personal: true # optional. if left false, assumes 'owner' is an org
branch: main # optional
namespace: "flux-system" # optional
path: "clusters/cluster-27" # optional With the command being: eksctl enable flux -f config.yaml While Gonna mark as a draft while I move over. I wont be changing any logic, just moving types around and renaming. |
da3f38f
to
7892574
Compare
cc3ddbe
to
0d63fd4
Compare
0d63fd4
to
3727b39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Part of the work to add Flux 2. It makes more sense to have this outside the git package (which will disappear with flux v1). Having the ENV passed in as a map, and having the executor do the work, is nicer than using an array.
Part of the work to add Flux 2. This type will eventually supersede the existing Git type, scheduled to be deprecated later this year.
A simple client to process the configuration into flags, and shell out to the Flux binary. Certain env vars need to be carried from the starting env to the command env for Flux to work properly.
The library connecting the configuration to the execution. For now this also verifies whether v1 components are already installed on the cluster.
There are some minor alterations to existing Git code. This has been done to avoid confusion. Those old pieces were built along dated plans for gitops, which are soon to be removed.
Refactoring to bring in line with the plan to move everything into a library.
3727b39
to
f8c2ef1
Compare
please nobody squash-merge this. i want small commits for this otherwise future us will be mad
also nobody click "Update branch". i hate that thing
TLDR, Files to look at:
New stuff:
Reorganised/Refactored old stuff:
Description
This PR lets users define Flux v2 (aka gitops toolkit) configuration in their cluster config. The config can be applied in one of two commands:
As discussed in planning, I have introduced a new subcommand to
enable
because the flags for v2 in no way line up with those in v1, therefore simply adding a--use-v2
style flag to the existing subcommand would have given a rubbish UX.Edit: We landed on creating a new top-level config object since the old
git.
paths are soon to become redundant and have no relevance in the current plans for GitOps.gitops
gives us room to add more toolkit options underneath later, and means we can cleanly build alongsidegit
codepaths without interaction which will make removing things easier. There may be some confusion for users ("was the previous config not flux/gitops?") but hopefully we can counter that will docs.Implementation-wise, I went with simply shelling out to Flux. Ensuring that the binary is there is something we already insist on for the aws-cli and kubectl. Also, the Flux code doesn't wrap their bootstrap functionality in a library, and copy-pasting ~300 lines from there to here is worse.
Flags:
There are no additional flags for this command (beyond
--config-file
). The reasons for this are:eksctl
providing flags for v1 is that it turned a multi-step process into just 1 for users. There is no need for users to run one command witheksctl
, with flags delegated toflux
when they can just useflux
directly. The valueeksctl
delivers here is in allowing users to specify a config file with the possibility of having it run automatically after a create, so that is what I have implemented. (If users want flags later we can do that for them maybe.)Config:
I have implemented the bare minimum of Flux2 config options and left many things to default in this first pass. We can expand and add more features as we need them. Whether we intend to 1:1 pass all config options through is a discussion for another time.
The config file looks like this:
Refactoring:
I have moved some of the Flux v1 (aka
repo
) stuff around so that a) it fits with theactions
organisation and b) the implementation sits alongside the new interface (I know it doesn't need to but it is nice).I have done some minimal refactoring and fixing of existing tests, but kept it to a minimum since the diff was already quite large (and that code will all be gone by the summer anyway).
Still to come in other PRs:
Checklist
README.md
, or theuserdocs
directory)area/nodegroup
), target version (e.g.version/0.12.0
) and kind (e.g.kind/improvement
)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯