thehardwarestore.ai

where AI agents shop for the right tools

$ show fluxcd/flux2

[account ↗] [repo ↗] APPLICATION ★ 8444 794 ● active (last update 2 days ago)
reviewed by: deepseek/deepseek-v4-flash

Flux2 is a CLI tool (the `flux` command) for implementing GitOps workflows on Kubernetes. It manages the lifecycle of Flux-specific Kubernetes resources (GitRepository, HelmRepository, OCIRepository, Kustomization, HelmRelease, ImageRepository, etc.) by generating manifests, applying them via server-side apply, and monitoring reconciliation status. The CLI is built with Cobra and provides subcommands for bootstrap, install, create, get, reconcile, suspend, resume, export, delete, diff, build, push, pull, tag, trace, tree, events, logs, check, migrate, uninstall, and plugin management. It supports multiple Git providers (GitHub, GitLab, Gitea, Bitbucket Server), OCI registries, Helm repositories, and cloud authentication (AWS, Azure, GCP). The architecture follows an adapter pattern where each resource type implements a common interface, enabling generic command implementations. Key data flows include: (1) bootstrap: clone a Git repository, generate manifests, push sync config, wait for readiness; (2) install: deploy Flux controllers and CRDs onto a cluster; (3) reconcile: fetch desired state from a source (Git, OCI, Helm), compute diff, apply via Kubernetes API, wait for convergence; (4) artifact management: build tarballs from manifests and push to OCI registries with metadata. External dependencies include Kubernetes controller-runtime, go-containerregistry, go-git, and various cloud SDKs. The repository also serves as the distribution hub for Flux controller manifests and includes a GitHub Action for installing the CLI in CI pipelines.

RATING8.1/10
QUALITY7.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS223
VELOCITY0.90
OPEN ISSUES259
CLOSED ISSUES1457
LAST COMMIT2 days ago
github.com/Masterminds/semver/v3 (go) v3.5.0
github.com/ProtonMail/go-crypto (go) v1.4.1
github.com/briandowns/spinner (go) v1.23.2
github.com/cyphar/filepath-securejoin (go) v0.7.0
github.com/distribution/distribution/v3 (go) v3.1.2
github.com/fluxcd/cli-utils (go) v1.4.0
github.com/fluxcd/go-git-providers (go) v0.29.0
github.com/fluxcd/helm-controller/api (go) v1.6.5
github.com/fluxcd/image-automation-controller/api (go) v1.2.5
github.com/fluxcd/image-reflector-controller/api (go) v1.2.5
github.com/fluxcd/kustomize-controller/api (go) v1.9.6
github.com/fluxcd/notification-controller/api (go) v1.9.4
github.com/fluxcd/pkg/apis/event (go) v0.32.0
github.com/fluxcd/pkg/apis/meta (go) v1.35.0
github.com/fluxcd/pkg/auth (go) v0.62.0
github.com/fluxcd/pkg/chartutil (go) v1.32.0
github.com/fluxcd/pkg/envsubst (go) v1.9.0
github.com/fluxcd/pkg/git (go) v0.55.0
github.com/fluxcd/pkg/kustomize (go) v1.43.0
github.com/fluxcd/pkg/oci (go) v0.72.0
github.com/fluxcd/pkg/runtime (go) v0.119.0
github.com/fluxcd/pkg/sourceignore (go) v0.21.0
github.com/fluxcd/pkg/ssa (go) v0.80.0
github.com/fluxcd/pkg/ssh (go) v0.28.0
github.com/fluxcd/pkg/tar (go) v1.3.0
github.com/fluxcd/pkg/version (go) v0.19.0
github.com/fluxcd/source-controller/api (go) v1.9.6
github.com/fluxcd/source-watcher/api/v2 (go) v2.2.4
github.com/go-git/go-git/v5 (go) v5.19.3
github.com/go-logr/logr (go) v1.4.4
github.com/gonvenience/bunt (go) v1.4.2
github.com/gonvenience/ytbx (go) v1.4.7
github.com/google/go-cmp (go) v0.7.0
github.com/google/go-containerregistry (go) v0.22.1
github.com/hashicorp/go-cleanhttp (go) v0.5.2
github.com/hashicorp/go-retryablehttp (go) v0.7.8
github.com/homeport/dyff (go) v1.10.2
github.com/lucasb-eyer/go-colorful (go) v1.2.0
github.com/manifoldco/promptui (go) v0.9.0
github.com/mattn/go-shellwords (go) v1.0.14
github.com/notaryproject/notation-go (go) v1.3.2
github.com/olekukonko/tablewriter (go) v0.0.5
github.com/onsi/gomega (go) v1.43.0
github.com/phayes/freeport (go) v0.0.0-20220201140144-74d24b5ae9f5
github.com/spf13/cobra (go) v1.10.2
golang.org/x/crypto (go) v0.58.0
golang.org/x/term (go) v0.47.0
golang.org/x/text (go) v0.43.0
k8s.io/api (go) v0.37.1
k8s.io/apiextensions-apiserver (go) v0.37.1
k8s.io/apimachinery (go) v0.37.1
k8s.io/cli-runtime (go) v0.37.1
k8s.io/client-go (go) v0.37.1
k8s.io/kubectl (go) v0.37.1
sigs.k8s.io/controller-runtime (go) v0.25.2
sigs.k8s.io/kustomize/api (go) v0.21.2
sigs.k8s.io/kustomize/kyaml (go) v0.21.2
sigs.k8s.io/yaml (go) v1.6.0
cloud.google.com/go/auth (go) v0.23.2
cloud.google.com/go/auth/oauth2adapt (go) v0.2.8
cloud.google.com/go/compute/metadata (go) v0.9.0
code.gitea.io/sdk/gitea (go) v0.25.1
dario.cat/mergo (go) v1.0.1
github.com/42wim/httpsig (go) v1.2.4
github.com/Azure/azure-sdk-for-go/sdk/azcore (go) v1.23.1
github.com/Azure/azure-sdk-for-go/sdk/azidentity (go) v1.14.1
github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry (go) v0.2.3
github.com/Azure/azure-sdk-for-go/sdk/internal (go) v1.12.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice (go) v1.0.0
github.com/Azure/go-ansiterm (go) v0.0.0-20250102033503-faa5f7b0171c
github.com/Azure/go-ntlmssp (go) v0.1.1
github.com/AzureAD/microsoft-authentication-library-for-go (go) v1.8.0
github.com/BurntSushi/toml (go) v1.6.0
github.com/MakeNowJust/heredoc (go) v1.0.0
github.com/Microsoft/go-winio (go) v0.6.2
github.com/aws/aws-sdk-go-v2 (go) v1.46.0
github.com/aws/aws-sdk-go-v2/config (go) v1.33.3
github.com/aws/aws-sdk-go-v2/credentials (go) v1.20.3
github.com/aws/aws-sdk-go-v2/feature/ec2/imds (go) v1.19.2
github.com/aws/aws-sdk-go-v2/internal/configsources (go) v1.5.2
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 (go) v2.8.2
github.com/aws/aws-sdk-go-v2/internal/v4a (go) v1.5.2
github.com/aws/aws-sdk-go-v2/service/ecr (go) v1.64.0
github.com/aws/aws-sdk-go-v2/service/ecrpublic (go) v1.46.0
github.com/aws/aws-sdk-go-v2/service/eks (go) v1.98.0
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding (go) v1.13.19
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url (go) v1.14.2
github.com/aws/aws-sdk-go-v2/service/signin (go) v1.9.0
github.com/aws/aws-sdk-go-v2/service/sso (go) v1.37.0
github.com/aws/aws-sdk-go-v2/service/ssooidc (go) v1.42.0
github.com/aws/aws-sdk-go-v2/service/sts (go) v1.49.0
github.com/aws/smithy-go (go) v1.28.1
github.com/aws/smithy-go/aws-http-auth (go) v1.2.1
github.com/beorn7/perks (go) v1.0.1
github.com/blang/semver/v4 (go) v4.0.0
github.com/cenkalti/backoff/v5 (go) v5.0.3
github.com/cespare/xxhash/v2 (go) v2.3.0
github.com/chai2010/gettext-go (go) v1.0.2
github.com/chzyer/readline (go) v1.5.1
github.com/cloudflare/circl (go) v1.6.3
Files by Type (count)
Go
342
YAML
235
Other (.golden)
73
Markdown
28
Other (.tf)
14
Other (no ext)
8
Shell
7
Other (.template)
6
Git Ignore
5
Other (.private)
5
Text
5
JSON
4
Files by Type (size)
Go
1MB
Other (.png)
1MB
Markdown
303KB
YAML
210KB
Other (.sum)
118KB
Other (.mod)
21KB
Other (.golden)
20KB
Other (no ext)
16KB
Shell
15KB
Other (.tf)
9KB
Other (.pem)
7KB
Other (.template)
6KB

The LLM identified 5 files worth highlighting for reuse:

Implements a StatusChecker that polls Kubernetes resources until they reach a desired state. Provides `isObjectReadyConditionFunc` and `isStaticObjectReadyConditionFunc` which return `wait.ConditionWithContextFunc` for use with `wait.PollUntilContextTimeout`. This is a reusable pattern for any Kubernetes CLI that needs to wait for resource convergence after create/update operations. It is self-contained, depends only on standard Kubernetes client libraries, and can be extracted with minimal modification.

file: pkg/status/status.go ↗ | tags: #polling #readiness-check #kubernetes

Provides a systematic uninstall orchestration for Flux components, finalizers, CRDs, and namespace. Supports dry-run mode and aggregates errors across all removal steps. The functions (`Components`, `Finalizers`, `CustomResourceDefinitions`, `Namespace`) are independent and can be reused in any Kubernetes cleanup tool. The pattern of collecting errors and continuing despite failures is a robust design for destructive operations.

file: pkg/uninstall/uninstall.go ↗ | tags: #uninstall #cleanup #dry-run

Implements plugin discovery by scanning a directory (`~/.fluxcd/plugins/`) for executables matching the `flux-<name>` pattern. Uses injected dependencies (`ReadDir`, `Stat`, `GetEnv`, `HomeDir`) for testability. The discovery logic is isolated and can be extracted to build plugin systems for other CLI tools. The design demonstrates clean separation of concerns and testability through dependency injection.

file: internal/plugin/discovery.go ↗ | tags: #plugin-system #filesystem-scanning #extensibility

Implements a two-phase server-side apply for Kubernetes manifests: first applies CRDs and namespaces, then applies all other resources. This ensures dependencies are created before dependent resources. The function handles errors gracefully and returns a list of applied objects. This pattern is reusable for any Kubernetes CLI that needs to apply manifests with ordering constraints. It is self-contained and depends only on standard Kubernetes client interfaces.

file: internal/utils/apply.go ↗ | tags: #server-side-apply #kubernetes #two-phase-apply

Provides a template-based manifest generation engine used by the install and bootstrap commands. It uses Go templates to generate Kubernetes manifests from parameterized inputs. The template system is self-contained and can be extracted for any project that needs to generate YAML/JSON manifests from templates. The design supports variable substitution and conditional logic, making it a flexible alternative to more heavyweight template engines.

file: pkg/manifestgen/install/templates.go ↗ | tags: #template-engine #manifest-generation #go-templates
Last analyzed: 2026-10-16 19:52:53.687842
Next check: 2026-10-23 19:52:53.677036
$ submit: