Documentation
¶
Overview ¶
Package flux provides a Flux client implementation using Flux Kubernetes APIs.
This package wraps Flux CD controller APIs (HelmRelease, Kustomization, Sources) and provides client functionality for creating and managing Flux resources on Kubernetes clusters.
Index ¶
- Constants
- Variables
- type Client
- type ReconcileOptions
- type Reconciler
- func (r *Reconciler) Reconcile(ctx context.Context, opts ReconcileOptions) error
- func (r *Reconciler) TriggerKustomizationReconciliation(ctx context.Context) error
- func (r *Reconciler) TriggerOCIRepositoryReconciliation(ctx context.Context) error
- func (r *Reconciler) WaitForKustomizationReady(ctx context.Context, timeout time.Duration) error
- func (r *Reconciler) WaitForOCIRepositoryReady(ctx context.Context) error
Constants ¶
const ( // DefaultNamespace is the default namespace for Flux resources. DefaultNamespace = "flux-system" // SplitParts is the number of parts when splitting strings like "namespace/name" or "name.namespace". SplitParts = 2 )
Variables ¶
var ( // ErrTypeMismatch is returned when type assertion fails in copySpec. ErrTypeMismatch = errors.New("type mismatch in copySpec") // ErrUnsupportedResourceType is returned when an unsupported resource type is passed to copySpec. ErrUnsupportedResourceType = errors.New("unsupported resource type") )
var ( // ErrReconcileTimeout is returned when reconciliation times out. ErrReconcileTimeout = errors.New( "timeout waiting for flux kustomization reconciliation - " + "verify cluster health, Flux controllers status, and network/connectivity to the cluster", ) // ErrOCIRepositoryNotReady is returned when the OCIRepository is not ready. ErrOCIRepositoryNotReady = errors.New( "flux OCIRepository is not ready - ensure you have pushed an artifact with 'ksail workload push'", ) // ErrKustomizationFailed is returned when the Kustomization reconciliation fails. ErrKustomizationFailed = errors.New( "flux kustomization reconciliation failed - check the Kustomization status and Flux controller logs for details", ) )
Reconciler errors.
var ErrOCIRefRequired = errors.New("one of --tag, --tag-semver or --digest is required")
ErrOCIRefRequired is returned when none of tag, semver, or digest is specified for OCI repository.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps flux API functionality.
type ReconcileOptions ¶ added in v5.13.0
type ReconcileOptions struct {
// Timeout for waiting for kustomization reconciliation.
Timeout time.Duration
}
ReconcileOptions configures the reconciliation behavior.
type Reconciler ¶ added in v5.13.0
type Reconciler struct {
*reconciler.Base
}
Reconciler handles Flux reconciliation operations.
func NewReconciler ¶ added in v5.13.0
func NewReconciler(kubeconfigPath string) (*Reconciler, error)
NewReconciler creates a new Flux reconciler from kubeconfig path.
func NewReconcilerWithClient ¶ added in v5.13.0
func NewReconcilerWithClient(dynamicClient dynamic.Interface) *Reconciler
NewReconcilerWithClient creates a Reconciler with a provided dynamic client (for testing).
func (*Reconciler) Reconcile ¶ added in v5.13.0
func (r *Reconciler) Reconcile(ctx context.Context, opts ReconcileOptions) error
Reconcile triggers and waits for Flux kustomization reconciliation. It first reconciles the OCIRepository to fetch the latest artifact, then reconciles the Kustomization to apply the changes.
func (*Reconciler) TriggerKustomizationReconciliation ¶ added in v5.13.0
func (r *Reconciler) TriggerKustomizationReconciliation(ctx context.Context) error
TriggerKustomizationReconciliation triggers Kustomization reconciliation without waiting. It uses retry logic to handle optimistic concurrency conflicts that can occur when the Flux controller updates the resource between our Get and Update calls.
func (*Reconciler) TriggerOCIRepositoryReconciliation ¶ added in v5.13.0
func (r *Reconciler) TriggerOCIRepositoryReconciliation(ctx context.Context) error
TriggerOCIRepositoryReconciliation triggers OCIRepository reconciliation without waiting. It uses retry logic to handle optimistic concurrency conflicts that can occur when the Flux controller updates the resource between our Get and Update calls.
func (*Reconciler) WaitForKustomizationReady ¶ added in v5.13.0
WaitForKustomizationReady waits for the Kustomization to be ready.
func (*Reconciler) WaitForOCIRepositoryReady ¶ added in v5.13.0
func (r *Reconciler) WaitForOCIRepositoryReady(ctx context.Context) error
WaitForOCIRepositoryReady waits for the OCIRepository to be ready.