Skip to content

Commit 11f3a15

Browse files
committed
Add bootstrap alternative with Flux Operator
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
1 parent 7b9196e commit 11f3a15

File tree

1 file changed

+55
-30
lines changed

1 file changed

+55
-30
lines changed

README.md

Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ from the contents of the **apps/base** and **apps/staging** dirs.
295295
The `ArtifactGenerator` allows us to split the monorepo into smaller artifacts that can be synced independently.
296296
Changes to files outside the **apps/** dirs will not trigger a reconciliation of the apps Kustomization.
297297

298-
## Bootstrap
298+
## Bootstrap with Flux CLI
299299

300300
Fork this repository on your personal GitHub account and export your GitHub access token, username and repo name:
301301

@@ -375,50 +375,75 @@ infra-configs latest@sha256:c0ac3648 True Applied revision: la
375375
apps latest@sha256:26785ee4 True Applied revision: latest@sha256:26785ee4
376376
```
377377

378-
### Add clusters
378+
## Bootstrap with Flux Operator
379379

380-
If you want to add a cluster to your fleet, first clone your repo locally:
380+
The [Flux Operator](https://github.com/controlplaneio-fluxcd/flux-operator) offers an alternative
381+
to the Flux CLI bootstrap procedure. It removes the operational burden of managing Flux across fleets
382+
of clusters by fully automating the installation, configuration, and upgrade of the Flux controllers
383+
based on a declarative API called [FluxInstance](https://fluxcd.control-plane.io/operator/fluxinstance/).
381384

382-
```sh
383-
git clone https://github.com/${GITHUB_USER}/${GITHUB_REPO}.git
384-
cd ${GITHUB_REPO}
385-
```
386-
387-
Create a dir inside `clusters` with your cluster name:
385+
Install the Flux Operator CLI with Homebrew:
388386

389387
```sh
390-
mkdir -p clusters/dev
388+
brew install controlplaneio/tap/flux-operator
391389
```
392390

393-
Copy the sync manifests from staging:
391+
Install the Flux Operator on the staging cluster and bootstrap Flux with:
394392

395393
```sh
396-
cp clusters/staging/artifacts.yaml clusters/dev
397-
cp clusters/staging/infrastructure.yaml clusters/dev
398-
cp clusters/staging/apps.yaml clusters/dev
394+
flux-operator install \
395+
--kube-context=staging \
396+
--instance-components-extra=source-watcher \
397+
--instance-sync-url=https://github.com/${GITHUB_USER}/${GITHUB_REPO} \
398+
--instance-sync-ref=refs/heads/main \
399+
--instance-sync-path=clusters/staging \
400+
--instance-sync-creds=git:${GITHUB_TOKEN}
399401
```
400402

401-
You could create a dev overlay inside `apps`, make sure
402-
to change the `spec.path` inside `clusters/dev/apps.yaml` to `path: ./apps/dev`.
403+
The command deploys the Flux Operator and creates a `FluxInstance` resource that manages
404+
the Flux controllers lifecycle and syncs the manifests from the specified GitHub repository path.
405+
You can also provide a `FluxInstance` manifest file to the command with `flux-operator install -f fluxinstance.yaml`.
403406

404-
Push the changes to the main branch:
407+
> [!TIP]
408+
> On production systems, the Flux Operator can be installed with Helm, Terraform/OpenTofu or directly from OperatorHub.
409+
> For more details, please refer to the [Flux Operator documentation](https://fluxcd.control-plane.io/operator/install/).
405410
406-
```sh
407-
git add -A && git commit -m "add dev cluster" && git push
411+
To list all the resources managed by the Flux on the cluster, use:
412+
413+
```console
414+
$ flux-operator -n flux-system tree ks flux-system
415+
Kustomization/flux-system/flux-system
416+
├── Kustomization/flux-system/apps
417+
│ ├── Namespace/podinfo
418+
│ ├── HelmRelease/podinfo/podinfo
419+
│ │ ├── ConfigMap/podinfo/podinfo-redis
420+
│ │ ├── Service/podinfo/podinfo-redis
421+
│ │ ├── Service/podinfo/podinfo
422+
│ │ ├── Deployment/podinfo/podinfo
423+
│ │ ├── Deployment/podinfo/podinfo-redis
424+
│ │ └── Ingress/podinfo/podinfo
425+
│ └── HelmRepository/podinfo/podinfo
426+
├── Kustomization/flux-system/infra-configs
427+
│ └── ClusterIssuer/letsencrypt
428+
├── Kustomization/flux-system/infra-controllers
429+
│ ├── Namespace/cert-manager
430+
│ ├── Namespace/ingress-nginx
431+
│ ├── HelmRelease/cert-manager/cert-manager
432+
│ ├── HelmRelease/ingress-nginx/ingress-nginx
433+
│ ├── HelmRepository/ingress-nginx/ingress-nginx
434+
│ └── OCIRepository/cert-manager/cert-manager
435+
└── ArtifactGenerator/flux-system/flux-system
408436
```
409437

410-
Set the kubectl context and path to your dev cluster and bootstrap Flux:
438+
Using Flux Operator to bootstrap Flux comes with several benefits:
411439

412-
```sh
413-
flux bootstrap github \
414-
--components-extra=source-watcher \
415-
--context=dev \
416-
--owner=${GITHUB_USER} \
417-
--repository=${GITHUB_REPO} \
418-
--branch=main \
419-
--personal \
420-
--path=clusters/dev
421-
```
440+
- The operator does not require write access to the Git repository and works with [GitHub Apps](https://fluxcd.control-plane.io/operator/flux-sync/#sync-from-a-git-repository-using-github-app-auth) and other OIDC providers.
441+
- The upgrade of Flux controllers and their CRDs is fully automated (can be customized via the `FluxInstance` [distribution](https://fluxcd.control-plane.io/operator/fluxinstance/#distribution-version) field).
442+
- The `FluxInstance` API allows configuring multi-tenancy lockdown, network policies, persistent storage, sharding, and vertical scaling of the Flux controllers.
443+
- The operator allows bootstrapping Flux in a [GitLess mode](https://fluxcd.control-plane.io/operator/flux-sync/#sync-from-a-container-registry), where the cluster state is stored as OCI artifacts in container registries.
444+
- The operator extends Flux with self-service capabilities via the [ResourceSet](https://fluxcd.control-plane.io/operator/resourcesets/) API which is designed to reduce the complexity of GitOps workflows.
445+
446+
To migrate an existing Flux installation to Flux Operator, please refer to the [bootstrap migration guide](https://fluxcd.control-plane.io/operator/flux-bootstrap-migration/).
422447

423448
## Testing
424449

0 commit comments

Comments
 (0)