Documentation
¶
Overview ¶
Package reposerverextract - app-of-apps expansion.
This file contains all logic for recursively discovering and rendering child Applications that appear in a parent application's rendered manifests (the "app-of-apps" pattern). It is intentionally isolated so the feature can be removed cleanly in the future if it is no longer needed.
The feature is only active when --traverse-app-of-apps is set.
Package reposerverextract provides an alternative to pkg/extract that renders Argo CD Application manifests by streaming local source files directly to the Argo CD repo server via gRPC, instead of deploying Applications to the cluster and polling until they are reconciled.
This approach is faster and simpler: no cluster-side Application objects are created, there is no reconciliation loop to wait for, and manifests are returned synchronously.
The entry point is RenderApplicationsFromBothBranches, which has the same return type as extract.RenderApplicationsFromBothBranches so callers can switch between the two with minimal code changes.
Index ¶
- func RenderApplicationsFromBothBranches(argocd *argocdPkg.ArgoCDInstallation, baseBranch *git.Branch, ...) ([]extract.ExtractedApp, []extract.ExtractedApp, time.Duration, error)
- func RenderApplicationsFromBothBranchesWithAppOfApps(argocd *argocdPkg.ArgoCDInstallation, baseBranch *git.Branch, ...) ([]extract.ExtractedApp, []extract.ExtractedApp, time.Duration, error)
- type RepoCreds
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderApplicationsFromBothBranches ¶
func RenderApplicationsFromBothBranches( argocd *argocdPkg.ArgoCDInstallation, baseBranch *git.Branch, targetBranch *git.Branch, timeout uint64, maxConcurrency uint, baseApps []argoapplication.ArgoResource, targetApps []argoapplication.ArgoResource, prRepo string, ) ([]extract.ExtractedApp, []extract.ExtractedApp, time.Duration, error)
RenderApplicationsFromBothBranches renders manifests for all supplied base and target Applications by streaming their local source directories to the Argo CD repo server via gRPC.
baseBranch / targetBranch identify the local folders that hold each branch's checked-out source files (e.g. "base-branch/" or "target-branch/").
prRepo is the URL of the pull-request repository (e.g. "https://github.com/org/repo.git"). Sources whose repoURL does not match this URL point at a different repository whose files are not checked out locally; those sources are rendered via the remote GenerateManifest RPC so the repo server fetches them itself.
The return type is identical to extract.RenderApplicationsFromBothBranches so that callers can swap implementations with minimal changes.
func RenderApplicationsFromBothBranchesWithAppOfApps ¶ added in v0.2.2
func RenderApplicationsFromBothBranchesWithAppOfApps( argocd *argocdPkg.ArgoCDInstallation, baseBranch *git.Branch, targetBranch *git.Branch, timeout uint64, maxConcurrency uint, baseApps []argoapplication.ArgoResource, targetApps []argoapplication.ArgoResource, prRepo string, appSelectionOptions argoapplication.ApplicationSelectionOptions, tempFolder string, ) ([]extract.ExtractedApp, []extract.ExtractedApp, time.Duration, error)
RenderApplicationsFromBothBranchesWithAppOfApps is like RenderApplicationsFromBothBranches but additionally discovers and renders child Applications found in rendered manifests (the app-of-apps pattern).
When a rendered app's manifests contain argoproj.io/Application resources, those children are patched and enqueued for rendering recursively — up to maxAppOfAppsDepth levels deep. Child Application YAML manifests are excluded from the parent's diff output; each child gets its own ExtractedApp entry.
A visited set prevents re-rendering the same app twice, guarding against cycles (A→B→A) and diamond dependencies (A→C, B→C).
Child apps are filtered by Selector, FilesChanged (via watch-pattern annotations), IgnoreInvalidWatchPattern, and WatchIfNoWatchPatternFound — the same as top-level apps. FileRegex is excluded because it filters by physical file path, and child apps have no file path (their FileName is a breadcrumb like "parent: <name>").
Types ¶
type RepoCreds ¶
type RepoCreds struct {
// contains filtered or unexported fields
}
RepoCreds is a pre-fetched snapshot of all repository credentials registered in the ArgoCD installation. It is built once and shared across all concurrent rendering goroutines (it is read-only after construction).
func FetchRepoCreds ¶
func FetchRepoCreds(ctx context.Context, k8sClient *k8s.Client, namespace string, appRepoURLs []string) (*RepoCreds, error)
FetchRepoCreds connects to the cluster via the ArgoCD DB layer and fetches all repository and credential information registered under the given ArgoCD namespace. The returned RepoCreds is safe for concurrent read access.
appRepoURLs is the set of repository URLs referenced by all Applications that will be rendered. For each URL, FetchRepoCreds calls argoDB.GetRepository() which—unlike ListRepositories—also inherits credentials from "repo-creds" type secrets (credential templates) via prefix matching. This mirrors the enrichment path used by the ArgoCD app controller in controller/state.go.
Without this, users who only configure a repo-creds secret (common for GitHub token authentication across many repositories) would get bare stubs with no credentials, causing "authentication required" errors from the repo server.
func (*RepoCreds) GetRepo ¶
func (rc *RepoCreds) GetRepo(repoURL string) *v1alpha1.Repository
GetRepo returns the credential-enriched Repository for the given URL. If no registered repository matches the URL exactly, it returns a stub Repository with just the URL set (the same bare-URL behaviour as before this fix, so callers can always proceed).
func (*RepoCreds) HelmRepoCreds ¶
func (rc *RepoCreds) HelmRepoCreds(source *v1alpha1.ApplicationSource) []*v1alpha1.RepoCreds
HelmRepoCreds returns the Helm + OCI credential templates to pass as ManifestRequest.HelmRepoCreds. For OCI primary sources the OCI creds are merged in (mirrors controller/state.go behaviour).
func (*RepoCreds) HelmRepos ¶
func (rc *RepoCreds) HelmRepos(source *v1alpha1.ApplicationSource) []*v1alpha1.Repository
HelmRepos returns the Helm + OCI repository lists to pass as ManifestRequest.Repos. For OCI primary sources the OCI list is merged in (mirrors controller/state.go behaviour).