argocd

package
v0.8.13 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package argocd provides ArgoCD Application generation for recipes.

Package argocd provides ArgoCD Application generation for Cloud Native Stack recipes.

The argocd package generates ArgoCD Application manifests from RecipeResult objects, enabling GitOps-based deployment of GPU-accelerated infrastructure components.

Overview

The package supports the App of Apps pattern, generating:

  • Individual Application manifests for each component
  • An app-of-apps.yaml manifest that manages all applications
  • Values files for Helm chart configuration
  • README with deployment instructions

Deployment Ordering

Components are deployed in order using ArgoCD sync-waves. The deployment order is determined by the recipe's DeploymentOrder field. Components are assigned sync-wave annotations starting from 0.

Usage

generator := argocd.NewGenerator()

input := &argocd.GeneratorInput{
	RecipeResult:     recipeResult,
	ComponentValues:  componentValues,
	Version:          "v0.9.0",
	RepoURL:          "https://github.com/my-org/my-gitops-repo.git",
	IncludeChecksums: true,
}

output, err := generator.Generate(ctx, input, "/path/to/output")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("Generated %d files (%d bytes)\n", len(output.Files), output.TotalSize)

Generated Structure

output/
├── app-of-apps.yaml           # Parent application
├── README.md                  # Deployment instructions
├── checksums.txt              # SHA256 checksums (optional)
├── cert-manager/
│   ├── application.yaml       # ArgoCD Application (sync-wave: 0)
│   └── values.yaml
├── gpu-operator/
│   ├── application.yaml       # ArgoCD Application (sync-wave: 1)
│   └── values.yaml
└── network-operator/
    ├── application.yaml       # ArgoCD Application (sync-wave: 2)
    └── values.yaml

Configuration

The RepoURL field in GeneratorInput sets the Git repository URL in the app-of-apps.yaml manifest. If not provided, a placeholder URL is used that must be updated manually before deployment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppOfAppsData

type AppOfAppsData struct {
	RepoURL        string
	TargetRevision string
	Path           string
}

AppOfAppsData contains data for rendering the App of Apps manifest.

type ApplicationData

type ApplicationData struct {
	Name        string
	Namespace   string
	Repository  string
	Chart       string
	Version     string
	SyncWave    int
	IsKustomize bool   // True when the component uses Kustomize instead of Helm
	Tag         string // Git ref for Kustomize components (tag, branch, or commit)
	Path        string // Path within the repository to the kustomization
}

ApplicationData contains data for rendering an ArgoCD Application.

type Generator

type Generator struct{}

Generator creates ArgoCD Applications from recipe results.

func NewGenerator

func NewGenerator() *Generator

NewGenerator creates a new ArgoCD application generator.

func (*Generator) Generate

func (g *Generator) Generate(ctx context.Context, input *GeneratorInput, outputDir string) (*GeneratorOutput, error)

Generate creates ArgoCD Applications from the given input.

type GeneratorInput

type GeneratorInput struct {
	// RecipeResult contains the recipe metadata and component references.
	RecipeResult *recipe.RecipeResult

	// ComponentValues maps component names to their values.
	ComponentValues map[string]map[string]any

	// Version is the generator version.
	Version string

	// RepoURL is the Git repository URL for the app-of-apps manifest.
	// If empty, a placeholder URL will be used.
	RepoURL string

	// IncludeChecksums indicates whether to generate a checksums.txt file.
	IncludeChecksums bool
}

GeneratorInput contains all data needed to generate ArgoCD Applications.

type GeneratorOutput

type GeneratorOutput struct {
	// Files contains the paths of generated files.
	Files []string

	// TotalSize is the total size of all generated files.
	TotalSize int64

	// Duration is the time taken to generate the applications.
	Duration time.Duration

	// DeploymentSteps contains ordered deployment instructions for the user.
	DeploymentSteps []string

	// DeploymentNotes contains optional notes (e.g., "Update repo URL").
	DeploymentNotes []string
}

GeneratorOutput contains the result of ArgoCD Application generation.

type ReadmeData

type ReadmeData struct {
	RecipeVersion  string
	BundlerVersion string
	Components     []ApplicationData
}

ReadmeData contains data for rendering the README.

Jump to

Keyboard shortcuts

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