End-to-End Testing - fluxcd/flux2-kustomize-helm-example

End-to-End Testing for flux2-kustomize-helm-example

This document explains the end-to-end testing workflow for the project flux2-kustomize-helm-example using the key technologies and dependencies: Flux, Helm, Kustomize, GitHub, Cert-Manager, Ingress-NGINX, Kubernetes, HelmRepository, HelmRelease, Kustomize API, and CI environment.

End-to-End Test Workflow

The end-to-end testing workflow involves testing the entire system, including all components and their interactions. The following workflow is based on the documentation provided by Akri:

  1. Prepare a clean Kubernetes cluster: Ensure you have a clean Kubernetes cluster to run the tests.
  2. Install and configure the required tools: Install and configure kubectl, helm, and other necessary tools.
  3. Install Akri: Install Akri using Helm with the necessary discovery handlers.
  4. Run tests: Run tests using the Python-based test framework with pytest.
  5. Uninstall Akri: Uninstall Akri from the Kubernetes cluster after testing.

Testing Components

Flux Drift Detection

To enable Helm drift detection in Flux, add the --feature-gates=DetectDrift=true flag to the helm-controller Deployment. This will cause the controller to check for drift on all Helm releases using a dry-run Server Side Apply, triggering an upgrade if a change is detected. For detailed information, refer to the Flux drift detection documentation.

Troubleshooting

Use the Flux troubleshooting cheatsheet to get more information out of Flux controllers to debug potential problems. The cheatsheet includes commands for getting basic information, showing Flux objects that are not ready, and checking for warning events. For more information, refer to the Flux troubleshooting documentation.

Flagger Development

When developing Flagger, use Kind to create a Kind cluster and build the Flagger container image and load it on the cluster. Run the Istio e2e tests using the ./test/istio/run.sh script. For each service mesh and ingress controller, there is a dedicated e2e test suite. For more information, refer to the Flagger development documentation.

Flagger Installation

To install Flagger, define a Flux OCIRepository that points to where the Flagger Kustomize overlays are stored. Deploy Flagger load tester with Flux, which generates traffic during analysis when configured as a webhook. For more information, refer to the Flagger installation documentation.

Flux Vertical Scaling

Enable Helm repositories caching to reduce the memory footprint of source-controller. For more information, refer to the Flux vertical scaling documentation.

FluxCD with KubeVela

The FluxCD addon is built based on FluxCD and can be installed using the vela addon enable fluxcd command. This addon is used to deploy Helm applications from a git repo, Helm repo, or S3-compatible bucket. For more information, refer to the FluxCD documentation on KubeVela.

Conclusion

End-to-end testing is an essential part of the development process, ensuring that all components of the system work together as expected. By following the workflow and using the tools and techniques described in this document, you can effectively test the entire system in a CI environment.