Skip to content

Commit

Permalink
Cleanup Flux Integration (#6836)
Browse files Browse the repository at this point in the history
  • Loading branch information
TiberiuGC authored Jul 24, 2023
1 parent ac9d75f commit 34fc38c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 34 deletions.
2 changes: 2 additions & 0 deletions integration/tests/gitops/flux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package integration_test

import (
"fmt"
"strconv"
"testing"

. "github.com/weaveworks/eksctl/integration/matchers"
Expand Down Expand Up @@ -77,6 +78,7 @@ var _ = Describe("Enable GitOps", func() {
"owner": params.GitopsOwner,
"branch": branch,
"repository": repository,
"personal": strconv.FormatBool(params.IsGitopsOwnerPersonal),
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions integration/tests/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type Params struct {
SkipDelete bool
KubeconfigPath string
GitopsOwner string
IsGitopsOwnerPersonal bool
KubeconfigTemp bool
TestDirectory string
EksctlCmd runner.Cmd
Expand Down Expand Up @@ -212,6 +213,7 @@ func NewParams(clusterNamePrefix string) *Params {
flag.BoolVar(&params.SkipDelete, "eksctl.skip.delete", false, "Skip the cleanup after the tests have run")
flag.StringVar(&params.KubeconfigPath, "eksctl.kubeconfig", "", "Path to kubeconfig (default: create a temporary file)")
flag.StringVar(&params.GitopsOwner, "eksctl.owner", "", "User or org name to create gitops repo under")
flag.BoolVar(&params.IsGitopsOwnerPersonal, "eksctl.personal", false, "Whether the gitops repo is associated to an org or not")

// go1.13+ testing flags regression fix: https://github.com/golang/go/issues/31859
flag.Parse()
Expand Down
2 changes: 1 addition & 1 deletion pkg/flux/flux.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

const (
fluxBin = "flux"
minSupportedVersion = "0.13.3"
minSupportedVersion = "0.32.0"
)

type Client struct {
Expand Down
6 changes: 3 additions & 3 deletions pkg/flux/flux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ var _ = Describe("Flux", func() {
})

Context("checking the flux version", func() {
When("the flux version is < 0.13.3", func() {
When("the flux version is < 0.32.0", func() {
BeforeEach(func() {
fakeExecutor.ExecWithOutReturns([]byte("flux version 0.13.2\n"), nil)
fakeExecutor.ExecWithOutReturns([]byte("flux version 0.31.5\n"), nil)
})

It("returns an error saying older versions are not supported", func() {
Expect(fluxClient.PreFlight()).To(MatchError(ContainSubstring("found flux version 0.13.2, eksctl requires >= 0.13.3")))
Expect(fluxClient.PreFlight()).To(MatchError(ContainSubstring("found flux version 0.31.5, eksctl requires >= 0.32.0")))
})
})

Expand Down
38 changes: 8 additions & 30 deletions userdocs/src/usage/gitops-v2.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,24 @@
# New: GitOps with Flux v2

!!! warning "Flux v2 `eksctl` integration is **experimental**"
Partial experimental support for [Flux v2 (part of the GitOps Toolkit)](https://toolkit.fluxcd.io/)
was made available in `eksctl` version `0.38.0`.

Complete, but still **experimental**, support for Flux v2 is available in `eksctl` from version `0.53.0`.
There are significant API changes from the `0.38.0-0.52.0` support with this release, please refer to this documentation.

Disruptions are still likely until development has stabilised.
All changes will be noted in [releases](https://github.com/eksctl-io/eksctl/releases).

[Gitops][gitops] is a way to do Kubernetes application delivery. It
[Gitops](https://www.weave.works/technologies/gitops/) is a way to do Kubernetes application delivery. It
works by using Git as a single source of truth for Kubernetes resources
and everything else. With Git at the center of your delivery pipelines,
you and your team can make pull requests to accelerate and simplify
application deployments and operations tasks to Kubernetes.

[gitops]: https://www.weave.works/technologies/gitops/

## Installing Flux v2 (GitOps Toolkit)

_Initial Flux v2 support was released in `0.38.0`, but the API has undergone significant changes. An older
example can be found [here](https://github.com/eksctl-io/eksctl/blob/a854bdbd3e47059d860a78600c2c1813281f4ebf/examples/12-gitops-toolkit.yaml)._

From version `0.53.0`, `eksctl` provides an option to alternatively bootstrap [Flux v2](https://toolkit.fluxcd.io/)
components into an EKS cluster, with the `enable flux` subcommand.
Starting with version `0.53.0`, `eksctl` provides the option to bootstrap [Flux v2](https://fluxcd.io/flux/) components into an EKS cluster, with the `enable flux` subcommand.

```console
eksctl enable flux --config-file <config-file>
```

The `enable flux` command will shell out to the `flux` binary and run the `flux bootstrap` command
against the cluster.
The `enable flux` command will shell out to the `flux` binary and run the `flux bootstrap` command against the cluster.

In order to allow users to specify whichever `bootstrap` flags they like, the `eksctl`
API exposes an arbitrary `map[string]string` of `flags`. To find out which flags you need
to bootstrap your cluster, refer to the [Flux docs](https://fluxcd.io/docs/),
or run `flux bootstrap --help`.
to bootstrap your cluster, simply run `flux bootstrap --help`.

Example:
```YAML
Expand All @@ -54,7 +36,6 @@ gitops:
flux:
gitProvider: github # required. options are github, gitlab or git
flags: # required. arbitrary map[string]string for all flux args.
# these args are not controlled by eksctl. see https://fluxcd.io/docs/get-started/ for all available flags
owner: "dr-who"
repository: "our-org-gitops-repo"
private: "true"
Expand Down Expand Up @@ -82,7 +63,7 @@ source-controller-7f856877cf-jgwdk 1/1 Running 0 3m39s
```

For instructions on how to use your newly installed Gitops Toolkit,
refer to the [official docs](https://fluxcd.io/docs/get-started/).
refer to the [official docs](https://fluxcd.io/flux/).

### Bootstrap after cluster create

Expand All @@ -97,19 +78,16 @@ eksctl create cluster --config-file <config-file>

#### Environment variables

Before running `eksctl enable flux`, ensure that you have read the [Flux bootstrap docs](https://fluxcd.io/docs/get-started/).
If you are using Github or Gitlab as your git provider, either `GITHUB_TOKEN` or `GITLAB_TOKEN`
must be exported with your Personal Access Token in your session. Please refer to the Flux docs
for any other requirements.
Before running `eksctl enable flux`, ensure that you have read the [Flux getting started docs](https://fluxcd.io/docs/get-started/). If you are using Github or Gitlab as your git provider, either `GITHUB_TOKEN` or `GITLAB_TOKEN` must be exported with your Personal Access Token in your session. Please refer to the Flux docs for any other requirements.

#### Flux version

Eksctl requires a minimum Flux version of `0.13.3`.
Eksctl requires a minimum Flux version of `0.32.0`.

## Quickstart profiles

Quickstart profiles will **not** be supported with Flux v2.

## Further reading

To learn more about gitops and Flux, check the Flux [documentation](https://fluxcd.io/).
To learn more about gitops and Flux, check out [Flux official webpage](https://fluxcd.io/).

0 comments on commit 34fc38c

Please sign in to comment.