argocd

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package argocd implements providers.GitOpsProvider for Argo CD: it reads Argo CD Applications from the cluster and emits engine-agnostic Changes (diffable via whatchanged.Differ) and failure events — the same contract as the flux package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationEvent

type ApplicationEvent struct {
	Application application
}

ApplicationEvent is a single watch event for an Application.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements providers.GitOpsProvider for Argo CD.

func New

func New(reader Reader, differ *whatchanged.Differ) *Provider

New builds an Argo CD provider from a Reader and a Differ.

func (*Provider) Changes

Changes lists Argo CD Applications and emits a Change per app: its source repo + path, the deployed revision (ToRev), and the previously deployed revision (FromRev, from the rollout history) when available.

Multi-source Applications (spec.sources[]) are supported: the first source + first revision back the Change (see applicationFromUnstructured). An app that still resolves no diffable source is logged at Debug and skipped, so the blind spot is observable rather than silent.

NOTE (v1 scope): the window is accepted but not yet used to filter by deploy time; each Change reflects the current synced revision.

func (*Provider) DependencyTree

func (p *Provider) DependencyTree(ctx context.Context, w providers.Workload) (providers.DepNode, error)

DependencyTree returns the Application with its FAILING managed resources (status.resources whose health is not Healthy/Progressing) as children, recursing into child Applications (app-of-apps) — so the root failure behind a degraded app is visible. Best-effort: child read errors don't abort the walk.

func (*Provider) Diff

Diff resolves a Change's diff via the Differ. ctx is threaded into the Differ so a hung clone/patch is cancellable (per-investigation deadline).

func (*Provider) ResourceStatus

func (p *Provider) ResourceStatus(ctx context.Context, w providers.Workload) (providers.ResourceStatus, error)

ResourceStatus reports an Argo CD Application's health + sync status, key source/destination refs, error conditions, and recent Events — the Argo analogue of the Flux inspector's "why is it failing" lens. A missing Application is reported via NotFound (often the cascade root), not an error.

func (*Provider) WatchFailures

func (p *Provider) WatchFailures(ctx context.Context) (<-chan providers.FailureEvent, error)

WatchFailures watches Argo CD Applications and emits a FailureEvent when an app is health-Degraded OR its last sync operation FAILED (operationState.phase ∈ {Failed, Error}). The sync-operation check catches a failed reconcile that has not (yet) manifested as Degraded health — a signal the health-only check missed. The returned channel closes when the watch ends or ctx is done.

type Reader

type Reader interface {
	ListApplications(ctx context.Context) ([]application, error)
	WatchApplications(ctx context.Context) (<-chan ApplicationEvent, error)
	// GetApplication fetches one Application as unstructured (deep inspection needs
	// status.conditions + status.resources, which the minimal `application` omits). A
	// NotFound error is returned verbatim so callers can distinguish "missing".
	GetApplication(ctx context.Context, namespace, name string) (*unstructured.Unstructured, error)
	// ListEvents returns recent Event lines for an involved object.
	ListEvents(ctx context.Context, namespace, name, kind string) ([]string, error)
}

Reader is the cluster-read surface the provider depends on. The dynamic client-go implementation lives in dynamic.go; tests use a fake.

func NewDynamicReader

func NewDynamicReader(client dynamic.Interface) Reader

NewDynamicReader builds a Reader backed by a client-go dynamic client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL