Documentation
¶
Overview ¶
Package argocd manages Argo CD Application custom resources for environment deployments using server-side apply.
Index ¶
- type ApplicationStatus
- type Applicator
- type Client
- func (c *Client) ApplyApplication(ctx context.Context, app *unstructured.Unstructured) error
- func (c *Client) ApplyApplications(ctx context.Context, apps []*unstructured.Unstructured) error
- func (c *Client) DeleteApplication(ctx context.Context, name string) error
- func (c *Client) DeleteApplicationsForEnvironment(ctx context.Context, envName, envNamespace string) error
- func (c *Client) GetSyncStatus(ctx context.Context, envName, envNamespace string) ([]ApplicationStatus, error)
- type Generator
- type ServiceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationStatus ¶
type ApplicationStatus struct {
Name string
Service string // the Diverge service this Application belongs to
SyncStatus string // Synced, OutOfSync, Unknown
Health string // Healthy, Progressing, Degraded, Missing
}
ApplicationStatus reports the sync and health state of an Argo CD Application belonging to a Diverge environment.
type Applicator ¶
type Applicator interface {
ApplyApplication(ctx context.Context, app *unstructured.Unstructured) error
ApplyApplications(ctx context.Context, apps []*unstructured.Unstructured) error
DeleteApplication(ctx context.Context, name string) error
DeleteApplicationsForEnvironment(ctx context.Context, envName, envNamespace string) error
GetSyncStatus(ctx context.Context, envName, envNamespace string) ([]ApplicationStatus, error)
}
Applicator manages Argo CD Application custom resources for preview environment deployments.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages Argo CD Application resources in the Argo namespace.
func NewClient ¶
NewClient creates an Argo CD client that manages Application custom resources in the specified namespace using server-side apply via a controller-runtime client.
func (*Client) ApplyApplication ¶
func (c *Client) ApplyApplication(ctx context.Context, app *unstructured.Unstructured) error
ApplyApplication creates or updates an Argo CD Application using server-side apply.
func (*Client) ApplyApplications ¶
func (c *Client) ApplyApplications(ctx context.Context, apps []*unstructured.Unstructured) error
ApplyApplications applies a batch of Application resources.
func (*Client) DeleteApplication ¶
DeleteApplication removes a single Argo CD Application by name.
func (*Client) DeleteApplicationsForEnvironment ¶
func (c *Client) DeleteApplicationsForEnvironment(ctx context.Context, envName, envNamespace string) error
DeleteApplicationsForEnvironment deletes all Applications managed by Diverge for the given environment name.
func (*Client) GetSyncStatus ¶
func (c *Client) GetSyncStatus(ctx context.Context, envName, envNamespace string) ([]ApplicationStatus, error)
GetSyncStatus returns sync and health status for all Applications belonging to the given environment.
type Generator ¶
type Generator struct {
ArgoNamespace string // namespace where Argo CD is installed
RepoURL string // Helm chart repository URL
DestinationServer string // Destination server URL
Project string // Argo CD Project
}
Generator creates Argo CD Application resources for environments. Instead of creating one ApplicationSet per environment (anti-pattern), it creates individual Application CRs per changed service. The Diverge operator stays in control of the full lifecycle: delta deployments, database provisioning, routing, and TTLs.
func (*Generator) Generate ¶
func (g *Generator) Generate( env *v1alpha1.Environment, changedServices []string, serviceConfigs map[string]ServiceConfig, ) ([]*unstructured.Unstructured, error)
Generate creates one Argo CD Application per changed service. Each Application is owned by the Environment CR for cascade deletion.
type ServiceConfig ¶
type ServiceConfig struct {
Name string
SourceType string // "helm" (default) | "kustomize"
ChartPath string // helm: path to chart directory
Path string // kustomize: path to overlay directory
ValuesFile string
Image string
Tag string
}
ServiceConfig describes a single service within a preview environment, including its source type (helm or kustomize), paths, and container image.