Add pre-bootstrap customisation to install docs

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
pull/1300/head
Stefan Prodan 4 years ago committed by Hidde Beydals
parent 4a4af94d6c
commit 5df9118365

@ -337,16 +337,23 @@ please see [fluxcd/terraform-provider-flux](https://github.com/fluxcd/terraform-
## Customize Flux manifests ## Customize Flux manifests
You can customize the Flux components in the Git repository where you've run bootstrap with Kustomize patches. You can customize the Flux components before or after running bootstrap.
First clone the repository locally and generate a `kustomization.yaml` file with: Assuming you want to customise the Flux controllers before they get deployed on the cluster,
first you'll need to create a Git repository and clone it locally.
Create the file structure required by bootstrap with:
```sh ```sh
cd ./clusters/production && kustomize create --autodetect mkdir -p clusters/my-cluster/flux-system
touch clusters/my-cluster/flux-system/gotk-components.yaml \
clusters/my-cluster/flux-system/gotk-patches.yaml \
clusters/my-cluster/flux-system/gotk-sync.yaml \
clusters/my-cluster/flux-system/kustomization.yaml
``` ```
Assuming you want to add custom annotations and labels to the Flux controllers in `clusters/production`. Assuming you want to add custom annotations and labels to the Flux controllers,
Create a Kustomize patch and set the metadata for source-controller and kustomize-controller pods: edit `clusters/my-cluster/gotk-patches.yaml` and set the metadata for source-controller and kustomize-controller pods:
```yaml ```yaml
apiVersion: apps/v1 apiVersion: apps/v1
@ -376,26 +383,37 @@ spec:
custom: label custom: label
``` ```
Save the above file as `flux-system-patch.yaml` inside the `clusters/production` dir. Edit `clusters/my-cluster/kustomization.yaml` and set the resources and patches:
Edit `clusters/production/kustomization.yaml` and add the patch:
```yaml ```yaml
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- flux-system - gotk-components.yaml
- gotk-sync.yaml
patchesStrategicMerge: patchesStrategicMerge:
- flux-system-patch.yaml - gotk-patches.yaml
``` ```
Push the changes to main branch: Push the changes to main branch:
```sh ```sh
git add -A && git commit -m "add production metadata" && git push git add -A && git commit -m "add flux customisations" && git push
``` ```
Flux will detect the change and will update itself on the production cluster. Now run the bootstrap for `clusters/my-cluster`:
```sh
flux bootstrap git \
--url=ssh://git@<host>/<org>/<repository> \
--branch=main \
--path=clusters/my-cluster
```
When the controllers are deployed for the first time on your cluster, they will contain all
the customisations from `gotk-patches.yaml`.
You can make changes to the patches after bootstrap and Flux will apply them in-cluster on its own.
## Dev install ## Dev install

@ -30,21 +30,15 @@ import (
"strings" "strings"
"text/template" "text/template"
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
imageautov1 "github.com/fluxcd/image-automation-controller/api/v1alpha2"
imagereflectv1 "github.com/fluxcd/image-reflector-controller/api/v1alpha2"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1"
"github.com/fluxcd/pkg/runtime/dependency"
"github.com/fluxcd/pkg/version"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
"github.com/olekukonko/tablewriter" "github.com/olekukonko/tablewriter"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1" networkingv1 "k8s.io/api/networking/v1"
rbacv1 "k8s.io/api/rbac/v1" rbacv1 "k8s.io/api/rbac/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
apiruntime "k8s.io/apimachinery/pkg/runtime" apiruntime "k8s.io/apimachinery/pkg/runtime"
sigyaml "k8s.io/apimachinery/pkg/util/yaml"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd"
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"

Loading…
Cancel
Save