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
// Username for OCI registry authentication (optional, for external registries).
Username string
// Password for OCI registry authentication (optional, for external registries).
Password string
// Insecure allows HTTP connections (for local registries). Default is false.
Insecure bool
}
EnsureOptions configures how KSail ensures Argo CD resources.
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. Uses retry logic to handle optimistic concurrency conflicts when the Application is modified by ArgoCD controllers between GET and UPDATE operations.
func (*Reconciler) WaitForApplicationReady ¶ added in v5.13.0
WaitForApplicationReady waits for the ArgoCD application to be synced and healthy.
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.