Skip to content
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

Add docs for development and testing #59

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ load-image: ## Load image into a Kind cluster.
.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
mkdir -p config/dev && cp config/default/* config/dev
cd config/dev && $(KUSTOMIZE) edit set image ghcr.io/controlplaneio-fluxcd/flux-operator=${IMG}
cd config/dev && $(KUSTOMIZE) edit set image flux-operator=${IMG}
$(KUSTOMIZE) build config/dev | $(KUBECTL) apply -f -
rm -rf config/dev

Expand Down
72 changes: 70 additions & 2 deletions docs/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

## Manifests Release Procedure

## Manifests Update for a New Flux Version
### Manifests Update for a New Flux Version

1. Create a new branch from `main`, e.g. `flux-v2.x.x` in the [`controlplaneio-fluxcd/flux-operator` repository](https://github.com/controlplaneio-fluxcd/flux-operator).
2. Generate the manifests for the latest Flux version by running `make vendor-flux`.
Expand All @@ -41,9 +41,77 @@
5. Commit changes and open a PR.
6. After the PR is merged, publish the OCI artifact with the manifests by running the [`push-manifests` GitHub Workflow](https://github.com/controlplaneio-fluxcd/flux-operator/actions/workflows/push-manifests.yml).

## Manifests Update for Enterprise CVE Fixes
### Manifests Update for Enterprise CVE Fixes

1. Create a new branch from `main`, e.g. `enterprise-cve-fixes` in the [`controlplaneio-fluxcd/flux-operator` repository](https://github.com/controlplaneio-fluxcd/flux-operator).
2. Rebuild the Flux manifests with the latest image patches by running `make build-manifests`.
3. Commit changes and open a PR.
4. After the PR is merged, publish the OCI artifact with the manifests by running the [`push-manifests` GitHub Workflow](https://github.com/controlplaneio-fluxcd/flux-operator/actions/workflows/push-manifests.yml).

## Local Development

### Prerequisites

- [Go](https://golang.org/doc/install) 1.22+
- [Docker](https://docs.docker.com/get-docker/)
- [Kind](https://kind.sigs.k8s.io/docs/user/quick-start/)
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)

### Building

After code changes, run the following command:

```sh
make tidy build lint
```

### Unit Testing

Unit tests can be run with:

```sh
make test
```

### End-to-End Testing

First, create a cluster named `kind`:

```sh
kind create cluster
```

End-to-end tests can be run with:

```sh
make test-e2e
```

### Manual Testing

Build and run the operator in a Kind cluster:

```sh
IMG=flux-operator:test1 make docker-build load-image deploy
```

Make sure to increment the `test1` tag for each new build.

Apply the instance from the `config/samples` dir:

```sh
kubectl -n flux-system apply -f config/samples/fluxcd_v1_fluxinstance.yaml
```

Check the logs:

```sh
kubectl -n flux-system logs deployment/flux-operator --follow
```

To clean up the resources, run:

```sh
kubectl -n flux-system delete fluxinstance/flux
make undeploy
```