- .github
- action
-
cmd
-
flux
-
testdata
- build-kustomization
- check
- cluster_info
- create_secret
- create_source_git
- create_source_helm
- diff-artifact
-
diff-kustomization
- deployment.yaml
- diff-with-deployment.golden
- diff-with-dockerconfigjson-sops-secret.golden
- diff-with-drifted-key-sops-secret.golden
- diff-with-drifted-secret.golden
- diff-with-drifted-service.golden
- diff-with-drifted-stringdata-sops-secret.golden
- diff-with-drifted-value-sops-secret.golden
- dockerconfigjson-sops-secret.yaml
- flux-kustomization-multiobj.yaml
- key-sops-secret.yaml
- kustomization.yaml
- nothing-is-deployed.golden
- secret.yaml
- service.yaml
- stringdata-sops-secret.yaml
- value-sops-secret.yaml
- envsubst
- export
- get
- helmrelease
- image
-
kustomization
- create_kustomization_from_git.golden
- create_source_git.golden
- delete_kustomization_from_git.golden
- get_kustomization_from_git.golden
- reconcile_kustomization_from_git.golden
- resume_kustomization_from_git.golden
- resume_kustomization_from_git_multiple_args.golden
- resume_kustomization_from_git_multiple_args_wait.golden
- suspend_kustomization_from_git.golden
- suspend_kustomization_from_git_multiple_args.golden
- logs
- oci
- trace
- tree
- alert.go
- alert_provider.go
- bootstrap.go
- bootstrap_bitbucket_server.go
- bootstrap_git.go
- bootstrap_gitea.go
- bootstrap_github.go
- bootstrap_gitlab.go
- build.go
- build_artifact.go
- build_artifact_test.go
- build_kustomization.go
- build_kustomization_test.go
- check.go
- check_test.go
- cluster_info.go
- cluster_info_test.go
- completion.go
- completion_bash.go
- completion_fish.go
- completion_powershell.go
- completion_zsh.go
- create.go
- create_alert.go
- create_alertprovider.go
- create_helmrelease.go
- create_image.go
- create_image_policy.go
- create_image_repository.go
- create_image_update.go
- create_kustomization.go
- create_receiver.go
- create_secret.go
- create_secret_git.go
- create_secret_git_test.go
- create_secret_helm.go
- create_secret_helm_test.go
- create_secret_oci.go
- create_secret_oci_test.go
- create_secret_tls.go
- create_secret_tls_test.go
- create_source.go
- create_source_bucket.go
- create_source_git.go
- create_source_git_test.go
- create_source_helm.go
- create_source_helm_test.go
- create_source_oci.go
- create_source_oci_test.go
- create_tenant.go
- create_test.go
- delete.go
- delete_alert.go
- delete_alertprovider.go
- delete_helmrelease.go
- delete_image.go
- delete_image_policy.go
- delete_image_repository.go
- delete_image_update.go
- delete_kustomization.go
- delete_receiver.go
- delete_source.go
- delete_source_bucket.go
- delete_source_git.go
- delete_source_helm.go
- delete_source_oci.go
- diff.go
- diff_artifact.go
- diff_artifact_test.go
- diff_kustomization.go
- diff_kustomization_test.go
- docgen.go
- envsubst.go
- envsubst_test.go
- events.go
- events_test.go
- export.go
- export_alert.go
- export_alertprovider.go
- export_helmrelease.go
- export_image.go
- export_image_policy.go
- export_image_repository.go
- export_image_update.go
- export_kustomization.go
- export_receiver.go
- export_secret.go
- export_source.go
- export_source_bucket.go
- export_source_git.go
- export_source_helm.go
- export_source_oci.go
- export_test.go
- get.go
- get_alert.go
- get_alertprovider.go
- get_all.go
- get_helmrelease.go
- get_image.go
- get_image_all.go
- get_image_policy.go
- get_image_repository.go
- get_image_update.go
- get_kustomization.go
- get_receiver.go
- get_source.go
- get_source_all.go
- get_source_bucket.go
- get_source_chart.go
- get_source_git.go
- get_source_helm.go
- get_source_oci.go
- get_test.go
- helmrelease.go
- helmrelease_test.go
- image.go
- image_test.go
- install.go
- install_test.go
- kustomization.go
- kustomization_test.go
- list.go
- list_artifact.go
- log.go
- logs.go
- logs_e2e_test.go
- logs_unit_test.go
- main.go
- main_e2e_test.go
- main_test.go
- main_unit_test.go
- manifests.embed.go
- object.go
- pull.go
- pull_artifact.go
- push.go
- push_artifact.go
- readiness.go
- readiness_test.go
- receiver.go
- reconcile.go
- reconcile_helmrelease.go
- reconcile_image.go
- reconcile_image_repository.go
- reconcile_image_updateauto.go
- reconcile_kustomization.go
- reconcile_receiver.go
- reconcile_source.go
- reconcile_source_bucket.go
- reconcile_source_chart.go
- reconcile_source_git.go
- reconcile_source_helm.go
- reconcile_source_oci.go
- reconcile_with_source.go
- resume.go
- resume_alert.go
- resume_alertprovider.go
- resume_helmrelease.go
- resume_image.go
- resume_image_repository.go
- resume_image_updateauto.go
- resume_kustomization.go
- resume_receiver.go
- resume_source.go
- resume_source_bucket.go
- resume_source_chart.go
- resume_source_git.go
- resume_source_helm.go
- resume_source_oci.go
- source.go
- source_oci_test.go
- stats.go
- status.go
- suspend.go
- suspend_alert.go
- suspend_alertprovider.go
- suspend_helmrelease.go
- suspend_image.go
- suspend_image_repository.go
- suspend_image_updateauto.go
- suspend_kustomization.go
- suspend_receiver.go
- suspend_source.go
- suspend_source_bucket.go
- suspend_source_chart.go
- suspend_source_git.go
- suspend_source_helm.go
- suspend_source_oci.go
- tag.go
- tag_artifact.go
- trace.go
- trace_test.go
- tree.go
- tree_kustomization.go
- tree_kustomization_test.go
- uninstall.go
- version.go
- version_test.go
- version_utils.go
- version_utils_test.go
-
testdata
-
flux
- docs
- install
-
internal
- build
-
flags
- crds.go
- crds_test.go
- decryption_provider.go
- decryption_provider_test.go
- ecdsa_curve.go
- ecdsa_curve_test.go
- helm_chart_source.go
- helm_chart_source_test.go
- kustomization_source.go
- kustomization_source_test.go
- log_level.go
- log_level_test.go
- public_key_algorithm.go
- public_key_algorithm_test.go
- rsa_key_bits.go
- rsa_key_bits_test.go
- safe_relative_path.go
- safe_relative_path_test.go
- source_bucket_provider.go
- source_bucket_provider_test.go
- source_oci_provider.go
- source_oci_verify_provider.go
- source_oci_verify_provider_test.go
- tree
- utils
-
manifests
- bases
- crds
- install
- integrations
- monitoring
- openshift
- policies
- rbac
- scripts
- pkg
- rfcs
- tests
- .gitignore
- .goreleaser.yml
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- DCO
- Dockerfile
- LICENSE
- MAINTAINERS
- Makefile
- README.md
- go.mod
- go.sum
- netlify.toml
Explanation
The code in tests/integration/util_test.go
provides utility functions for integration testing Flux, a GitOps tool. These functions streamline the process of setting up and managing test environments, interacting with Git repositories, and verifying the behavior of Flux components.
Key Functions:
installFlux
: Installs the core Flux components (like the Flux controller) to a Kubernetes cluster. It uses thebuild/flux
binary and the provided kubeconfig path to perform the installation. It also handles setting up a Git secret and optionally configuring a Kustomization for Flux components.uninstallFlux
: Removes Flux components from the cluster by running thebuild/flux uninstall
command.verifyGitAndKustomization
: Checks that a Git repository and Kustomization are properly working. It retrieves the GitRepository and Kustomization resources from the cluster and verifies their ready conditions.setUpFluxConfig
: Creates a namespace, a Git secret, a GitRepository resource, and a Kustomization resource within that namespace. It allows customization of the Kustomization spec through themodifyKsSpec
function.tearDownFluxConfig
: Deletes the resources created bysetUpFluxConfig
, including the namespace, Git secret, GitRepository, and Kustomization.getRepository
: Creates a new Git client using thegogit
library and clones the specified Git repository into a local directory. It handles setting up the necessary authentication based on provided credentials.commitAndPushAll
: Checks out a specified branch, adds files to the repository, commits them, and pushes the changes to the remote repository. It leverages thegogit
client to perform these actions.createTagAndPush
: Creates a new tag on the specified branch and pushes it to the remote repository.pushImagesFromURL
: Pulls a container image from a URL, tags it with specified tags, and pushes the image to a container registry.getTransportURL
: Determines the appropriate Git transport URL (HTTP or SSH) based on the configured transport type.authOpts
: Constructs Git authentication options based on a provided URL and authentication data.checkReadyCondition
: Checks for a “Ready” condition on a given resource and returns an error if the condition is not met.
Overall, this code provides a comprehensive set of tools for integration testing Flux by:
- Setting up and cleaning up test environments.
- Interacting with Git repositories and pushing changes.
- Verifying the status of Flux components.
- Managing Kustomization configurations.
These functions enable developers to automate testing procedures, ensure the reliability of Flux, and simplify the process of verifying its functionalities in different scenarios.
Graph
The graph shows the usage of functions within the codebase.
Select a code symbol to view it's graph