argocd

package
v1.1.38 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrowserLogin

func BrowserLogin(thelmaConfig config.Config, shellRunner shell.Runner, iapToken string) error

BrowserLogin is a thin wrapper around the `argocd login --sso` command, which: * presents users with a web UI to log in with their GitHub SSO credentials (same flow as logging in to the ArgoCD webapp) * uses those SSO credentials to generate a new ArgoCD authentication token for the user's identity * stores the generated token in ~/.argocd/config

Types

type ApplicationSpec

type ApplicationSpec struct {
	Source struct {
		TargetRevision string `yaml:"targetRevision"`
	}
}

type ApplicationStatus

type ApplicationStatus struct {
	// Overall health status for the application
	Health struct {
		Status HealthStatus
	}
	// Overall sync status for the application
	Sync struct {
		Status SyncStatus
	}
	Resources []Resource
}

type ArgoCD

type ArgoCD interface {
	// SyncApp will sync an ArgoCD app
	SyncApp(appName string, options ...SyncOption) (SyncResult, error)
	// HardRefresh will hard refresh an ArgoCD app (force a manifest re-render without a corresponding git change)
	HardRefresh(appName string) error
	// WaitExist will wait for an ArgoCD app to exist
	WaitExist(appName string, options ...WaitExistOption) error
	// SyncRelease will sync a Terra release's ArgoCD app(s), including the legacy configs app if there is one
	SyncRelease(release terra.Release, options ...SyncOption) error
	// AppStatus returns a summary of an application's health status
	AppStatus(appName string) (ApplicationStatus, error)
	// DestinationURL returns a URL to an environment's Argo applications
	DestinationURL(dest terra.Destination) string
	// DefaultSyncOptions returns default sync options
	DefaultSyncOptions() SyncOptions
}

ArgoCD is for running `argocd` commands. Note: we explored using the ArgoCD golang client, but the ArgoCD API is gRPC and designed for async UI communication. As a result it is extremely complicated to do things that are trivial via the CLI.

func New

func New(thelmaConfig config.Config, shellRunner shell.Runner, iapToken string, vaultClientFactory func() (*vaultapi.Client, error)) (ArgoCD, error)

New return a new ArgoCD client

type HealthStatus

type HealthStatus int
const (
	Unknown HealthStatus = iota
	Progressing
	Suspended
	Healthy
	Degraded
	Missing
)

func (HealthStatus) MarshalYAML

func (h HealthStatus) MarshalYAML() (interface{}, error)

func (HealthStatus) String

func (h HealthStatus) String() string

func (*HealthStatus) UnmarshalYAML

func (h *HealthStatus) UnmarshalYAML(value *yaml.Node) error

type Resource

type Resource struct {
	Kind      string
	Name      string
	Group     string
	Version   string
	Namespace string
	Status    SyncStatus
	Health    *struct {
		Status  HealthStatus `yaml:",omitempty"`
		Message string       `yaml:",omitempty"`
	} `yaml:",omitempty"`
}

type SyncOption

type SyncOption func(options *SyncOptions)

type SyncOptions

type SyncOptions struct {
	// HardRefresh if true, perform a hard refresh before syncing Argo apps
	HardRefresh bool
	// SyncIfNoDiff if true, sync even if the hard refresh indicates there are no config differences
	SyncIfNoDiff bool
	// NeverSync if true, never actually sync apps to allow refresh-only behavior
	NeverSync bool
	// WaitHealthy if true, wait for the application to become healthy after syncing
	WaitHealthy bool
	// WaitHealthyTimeout how long to wait for the application to become healthy before giving up
	WaitHealthyTimeoutSeconds int
	// OnlyLabels if not empty, only sync resources with the given labels
	OnlyLabels map[string]string
	// SkipLegacyConfigsRestart if true, do not restart deployments to pick up firecloud-develop changes
	SkipLegacyConfigsRestart bool
	// StatusReporter pool.StatusReporter
	StatusReporter pool.StatusReporter
}

SyncOptions options for an ArgoCD sync operation

type SyncResult

type SyncResult struct {
	// Synced true if the app was actually synced, false if not
	Synced bool
}

SyncResult stores information about the outcome of a Sync operation

type SyncStatus

type SyncStatus int
const (
	UnknownSyncStatus SyncStatus = iota
	Synced
	OutOfSync
)

func (SyncStatus) MarshalYAML

func (s SyncStatus) MarshalYAML() (interface{}, error)

func (SyncStatus) String

func (s SyncStatus) String() string

func (*SyncStatus) UnmarshalYAML

func (s *SyncStatus) UnmarshalYAML(value *yaml.Node) error

type WaitExistOption

type WaitExistOption func(options *WaitExistOptions)

type WaitExistOptions

type WaitExistOptions struct {
	// WaitExistTimeoutSeconds how long to wait for an application to exist before timing out
	WaitExistTimeoutSeconds int `default:"300"`

	// WaitExistPollIntervalSeconds how long to wait between polling attempts while waiting for an app to exist
	WaitExistPollIntervalSeconds int `default:"5"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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