Documentation
¶
Overview ¶
Package argocd provides Argo CD GitOps integration for KSail-Go.
This package is responsible for creating and maintaining Argo CD resources required for local GitOps workflows (e.g., repository Secret and Application).
Implementations must remain credential-free: KSail-Go must not fetch or print Argo CD admin credentials.
Index ¶
Constants ¶
const (
// DefaultNamespace is the default namespace for ArgoCD resources.
DefaultNamespace = "argocd"
)
Reconciler constants.
Variables ¶
var ( // ErrReconcileTimeout is returned when reconciliation times out. ErrReconcileTimeout = errors.New("timeout waiting for argocd application sync") // ErrSourceNotAvailable is returned when the ArgoCD source is not available. ErrSourceNotAvailable = errors.New( "argocd source is not available - ensure you have pushed an artifact with 'ksail workload push'", ) // ErrOperationFailed is returned when an ArgoCD operation fails. ErrOperationFailed = errors.New("argocd operation failed") )
Reconciler errors.
Functions ¶
This section is empty.
Types ¶
type EnsureOptions ¶
type EnsureOptions struct {
// RepositoryURL is the Argo CD repository URL, typically an OCI repository.
// Example: oci://local-registry:5000/<repository>
RepositoryURL string
// SourcePath is the path inside the repository to the kustomization root.
// This is derived from the existing `spec.sourceDirectory` setting.
//
// If empty, defaults to "k8s".
SourcePath string
// ApplicationName is the Argo CD Application name.
ApplicationName string
// TargetRevision is the initial revision (tag or digest).
TargetRevision string
}
EnsureOptions configures how KSail ensures Argo CD resources.
type Installer ¶
Installer installs or ensures Argo CD is present in the cluster.
Implementations are expected to be idempotent.
type Manager ¶
type Manager interface {
Ensure(ctx context.Context, opts EnsureOptions) error
UpdateTargetRevision(ctx context.Context, opts UpdateTargetRevisionOptions) error
}
Manager ensures Argo CD GitOps resources exist and can update reconciliation to a new OCI revision.
Implementations are expected to be idempotent.
type ManagerImpl ¶
type ManagerImpl struct {
// contains filtered or unexported fields
}
ManagerImpl implements the Argo CD GitOps manager.
func NewManager ¶
func NewManager(clientset kubernetes.Interface, dyn dynamic.Interface) *ManagerImpl
NewManager creates a manager using provided Kubernetes clients.
This is the primary constructor for unit tests.
func NewManagerFromKubeconfig ¶
func NewManagerFromKubeconfig(kubeconfig string) (*ManagerImpl, error)
NewManagerFromKubeconfig creates a manager by building Kubernetes clients from kubeconfig.
func (*ManagerImpl) Ensure ¶
func (m *ManagerImpl) Ensure(ctx context.Context, opts EnsureOptions) error
Ensure creates or updates the Argo CD repository secret and Application.
func (*ManagerImpl) UpdateTargetRevision ¶
func (m *ManagerImpl) UpdateTargetRevision( ctx context.Context, opts UpdateTargetRevisionOptions, ) error
UpdateTargetRevision updates the Application target revision and optionally requests a hard refresh.
type ReconcileOptions ¶ added in v5.13.0
type ReconcileOptions struct {
// Timeout for waiting for application sync.
Timeout time.Duration
// HardRefresh requests ArgoCD to refresh caches.
HardRefresh bool
}
ReconcileOptions configures the reconciliation behavior.
type Reconciler ¶ added in v5.13.0
type Reconciler struct {
*reconciler.Base
}
Reconciler handles ArgoCD reconciliation operations.
func NewReconciler ¶ added in v5.13.0
func NewReconciler(kubeconfigPath string) (*Reconciler, error)
NewReconciler creates a new ArgoCD 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 ArgoCD application sync.
func (*Reconciler) TriggerRefresh ¶ added in v5.13.0
func (r *Reconciler) TriggerRefresh(ctx context.Context, hardRefresh bool) error
TriggerRefresh triggers an ArgoCD application refresh.
func (*Reconciler) WaitForApplicationReady ¶ added in v5.13.0
WaitForApplicationReady waits for the ArgoCD application to be synced and healthy.
type Status ¶
type Status struct {
// Engine is a human-friendly engine name, e.g. "ArgoCD".
Engine string
// Installed indicates whether Argo CD appears installed.
Installed bool
// ApplicationPresent indicates whether the expected Application exists.
ApplicationPresent bool
// Message is a short user-facing summary.
Message string
}
Status is a lightweight user-facing summary of Argo CD state.
type StatusProvider ¶
StatusProvider returns a lightweight, user-facing status summary.
type UpdateTargetRevisionOptions ¶
type UpdateTargetRevisionOptions struct {
ApplicationName string
TargetRevision string
// HardRefresh requests Argo CD to refresh caches when updating revision.
HardRefresh bool
}
UpdateTargetRevisionOptions configures how KSail updates an Application to a new OCI revision.