argocd

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterApplicationsForUpdate

func FilterApplicationsForUpdate(apps []v1alpha1.Application, patterns []string) (map[string]ApplicationImages, error)

Retrieve a list of applications from ArgoCD that qualify for image updates Application needs either to be of type Kustomize or Helm and must have the correct annotation in order to be considered.

func GetImagesFromApplication added in v0.2.0

func GetImagesFromApplication(app *v1alpha1.Application) image.ContainerImageList

GetImagesFromApplication returns the list of known images for the given application

func IsValidApplicationType

func IsValidApplicationType(app *v1alpha1.Application) bool

IsValidApplicationType returns true if we can update the application

func SetHelmImage added in v0.4.0

func SetHelmImage(app *v1alpha1.Application, newImage *image.ContainerImage) error

SetHelmImage sets image parameters for a Helm application

func SetKustomizeImage added in v0.4.0

func SetKustomizeImage(app *v1alpha1.Application, newImage *image.ContainerImage) error

SetKustomizeImage sets a Kustomize image for given application

func TemplateCommitMessage added in v0.10.2

func TemplateCommitMessage(tpl *template.Template, appName string, changeList []ChangeEntry) string

templateCommitMessage renders a commit message template and returns it as as a string. If the template could not be rendered, returns a default message.

Types

type ApplicationImages

type ApplicationImages struct {
	Application v1alpha1.Application
	Images      image.ContainerImageList
}

type ApplicationType

type ApplicationType int

Type of the application

const (
	ApplicationTypeUnsupported ApplicationType = 0
	ApplicationTypeHelm        ApplicationType = 1
	ApplicationTypeKustomize   ApplicationType = 2
)

func GetApplicationType added in v0.2.0

func GetApplicationType(app *v1alpha1.Application) ApplicationType

GetApplicationType returns the type of the ArgoCD application

func GetApplicationTypeByName added in v0.4.0

func GetApplicationTypeByName(client ArgoCD, appName string) (ApplicationType, error)

GetApplicationTypeByName first retrieves application with given appName and returns its application type

func (ApplicationType) String

func (a ApplicationType) String() string

String returns a string representation of the application type

type ArgoCD

type ArgoCD interface {
	GetApplication(ctx context.Context, appName string) (*v1alpha1.Application, error)
	ListApplications() ([]v1alpha1.Application, error)
	UpdateSpec(ctx context.Context, spec *application.ApplicationUpdateSpecRequest) (*v1alpha1.ApplicationSpec, error)
}

ArgoCD is the interface for accessing Argo CD functions we need

func NewAPIClient added in v0.9.0

func NewAPIClient(opts *ClientOptions) (ArgoCD, error)

NewAPIClient creates a new API client for ArgoCD and connects to the ArgoCD API server.

func NewK8SClient added in v0.9.0

func NewK8SClient(kubeClient *kube.KubernetesClient) (ArgoCD, error)

NewAPIClient creates a new API client for ArgoCD and connects to the ArgoCD API server.

type ChangeEntry added in v0.10.2

type ChangeEntry struct {
	Image  *image.ContainerImage
	OldTag *tag.ImageTag
	NewTag *tag.ImageTag
}

ChangeEntry represents an image that has been changed by Image Updater

type ClientOptions

type ClientOptions struct {
	ServerAddr      string
	Insecure        bool
	Plaintext       bool
	Certfile        string
	GRPCWeb         bool
	GRPCWebRootPath string
	AuthToken       string
}

Basic wrapper struct for ArgoCD client options

type GitCredsSource added in v0.9.0

type GitCredsSource func(app *v1alpha1.Application) (git.Creds, error)

type ImageList

type ImageList map[string]ApplicationImages

Will hold a list of applications with the images allowed to considered for update.

type ImageUpdaterResult added in v0.4.0

type ImageUpdaterResult struct {
	NumApplicationsProcessed int
	NumImagesFound           int
	NumImagesUpdated         int
	NumImagesConsidered      int
	NumSkipped               int
	NumErrors                int
}

Stores some statistics about the results of a run

func UpdateApplication added in v0.4.0

func UpdateApplication(updateConf *UpdateConfiguration, state *SyncIterationState) ImageUpdaterResult

UpdateApplication update all images of a single application. Will run in a goroutine.

type SyncIterationState added in v0.9.2

type SyncIterationState struct {
	// contains filtered or unexported fields
}

SyncIterationState holds shared state of a running update operation

func NewSyncIterationState added in v0.9.2

func NewSyncIterationState() *SyncIterationState

NewSyncIterationState returns a new instance of SyncIterationState

func (*SyncIterationState) GetRepositoryLock added in v0.9.2

func (state *SyncIterationState) GetRepositoryLock(repository string) *sync.Mutex

GetRepositoryLock returns the lock for a specified repository

type UpdateConfiguration added in v0.9.0

type UpdateConfiguration struct {
	NewRegFN          registry.NewRegistryClient
	ArgoClient        ArgoCD
	KubeClient        *kube.KubernetesClient
	UpdateApp         *ApplicationImages
	DryRun            bool
	GitCommitUser     string
	GitCommitEmail    string
	GitCommitMessage  *template.Template
	DisableKubeEvents bool
}

type WriteBackConfig added in v0.9.0

type WriteBackConfig struct {
	Method     WriteBackMethod
	ArgoClient ArgoCD
	// If GitClient is not nil, the client will be used for updates. Otherwise, a new client will be created.
	GitClient        git.Client
	GetCreds         GitCredsSource
	GitBranch        string
	GitCommitUser    string
	GitCommitEmail   string
	GitCommitMessage string
	KustomizeBase    string
}

WriteBackConfig holds information on how to write back the changes to an Application

func (*WriteBackConfig) RequiresLocking added in v0.9.2

func (wbc *WriteBackConfig) RequiresLocking() bool

RequiresLocking returns true if write-back method requires repository locking

type WriteBackMethod added in v0.9.0

type WriteBackMethod int
const (
	WriteBackApplication WriteBackMethod = 0
	WriteBackGit         WriteBackMethod = 1
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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