Documentation
¶
Index ¶
- func FilterApplicationsForUpdate(ctx context.Context, ctrlClient *ArgoCDK8sClient, ...) (map[string]ApplicationImages, error)
- func GetApplicationSource(ctx context.Context, app *argocdapi.Application) *argocdapi.ApplicationSource
- func GetApplicationSourceType(app *argocdapi.Application, wbc *WriteBackConfig) argocdapi.ApplicationSourceType
- func GetGitCreds(ctx context.Context, repo *v1alpha1.Repository, store git.CredsStore) git.Creds
- func GetHelmImage(ctx context.Context, app *argocdapi.Application, wbc *WriteBackConfig, ...) (string, error)
- func GetImagesFromApplication(applicationImages *ApplicationImages) image.ContainerImageList
- func GetKubeConfig(ctx context.Context, namespace string, kubeConfig string) (*kube.ImageUpdaterKubernetesClient, error)
- func GetKustomizeImage(ctx context.Context, app *argocdapi.Application, wbc *WriteBackConfig, ...) (string, error)
- func GetParameterPullSecret(ctx context.Context, img *Image) *image.CredentialSource
- func GetPrintableHealthPort(port int) string
- func GetPrintableInterval(interval time.Duration) string
- func IsValidApplicationType(app *argocdapi.Application, wbc *WriteBackConfig) bool
- func SetHelmImage(ctx context.Context, app *argocdapi.Application, ...) error
- func SetKustomizeImage(ctx context.Context, app *argocdapi.Application, ...) error
- func TemplateBranchName(ctx context.Context, branchName string, changeList []ChangeEntry) string
- func TemplateCommitMessage(ctx context.Context, tpl *template.Template, appName string, ...) string
- type ApplicationImages
- type ApplicationType
- type ArgoCD
- type ArgoCDK8sClient
- type ChangeEntry
- type GitCredsSource
- type Image
- type ImageList
- type ImageUpdaterResult
- type SyncIterationState
- type UpdateConfiguration
- type WebhookEvent
- type WriteBackConfig
- type WriteBackMethod
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterApplicationsForUpdate ¶
func FilterApplicationsForUpdate(ctx context.Context, ctrlClient *ArgoCDK8sClient, kubeClient *kube.ImageUpdaterKubernetesClient, cr *iuapi.ImageUpdater, webhookEvent *WebhookEvent) (map[string]ApplicationImages, error)
FilterApplicationsForUpdate Retrieve a list of applications from ArgoCD that qualify for image updates Application needs either to be of type Kustomize or Helm.
func GetApplicationSource ¶ added in v0.13.0
func GetApplicationSource(ctx context.Context, app *argocdapi.Application) *argocdapi.ApplicationSource
GetApplicationSource returns the main source of a Helm or Kustomize type of the ArgoCD application
func GetApplicationSourceType ¶ added in v0.13.0
func GetApplicationSourceType(app *argocdapi.Application, wbc *WriteBackConfig) argocdapi.ApplicationSourceType
GetApplicationSourceType returns the source type of the ArgoCD application
func GetGitCreds ¶ added in v0.14.0
func GetGitCreds(ctx context.Context, repo *v1alpha1.Repository, store git.CredsStore) git.Creds
GetGitCreds returns the credentials from a repository configuration used to authenticate at a Git repository This is a slightly modified version of upstream's Repository.GetGitCreds method. We need it so it does not return the upstream type. TODO(jannfis): Can be removed once we have the change to the git client's getGitAskPassEnv upstream.
func GetHelmImage ¶ added in v0.15.2
func GetHelmImage(ctx context.Context, app *argocdapi.Application, wbc *WriteBackConfig, applicationImage *Image) (string, error)
GetHelmImage gets the image set in Application source matching new image or an empty string if match is not found
func GetImagesFromApplication ¶ added in v0.2.0
func GetImagesFromApplication(applicationImages *ApplicationImages) image.ContainerImageList
GetImagesFromApplication returns the list of known images for the given application
func GetKubeConfig ¶ added in v1.0.0
func GetKustomizeImage ¶ added in v0.15.2
func GetKustomizeImage(ctx context.Context, app *argocdapi.Application, wbc *WriteBackConfig, applicationImage *Image) (string, error)
GetKustomizeImage gets the image set in Application source matching new image or an empty string if match is not found
func GetParameterPullSecret ¶ added in v1.0.0
func GetParameterPullSecret(ctx context.Context, img *Image) *image.CredentialSource
GetParameterPullSecret retrieves an image's pull secret credentials
func GetPrintableHealthPort ¶ added in v1.0.0
func GetPrintableInterval ¶ added in v1.0.0
func IsValidApplicationType ¶
func IsValidApplicationType(app *argocdapi.Application, wbc *WriteBackConfig) bool
IsValidApplicationType returns true if we can update the application
func SetHelmImage ¶ added in v0.4.0
func SetHelmImage(ctx context.Context, app *argocdapi.Application, newImage *image.ContainerImage, wbc *WriteBackConfig, applicationImage *Image) error
SetHelmImage sets image parameters for a Helm application
func SetKustomizeImage ¶ added in v0.4.0
func SetKustomizeImage(ctx context.Context, app *argocdapi.Application, newImage *image.ContainerImage, wbc *WriteBackConfig, applicationImage *Image) error
SetKustomizeImage sets a Kustomize image for given application
func TemplateBranchName ¶ added in v0.12.0
func TemplateBranchName(ctx context.Context, branchName string, changeList []ChangeEntry) string
TemplateBranchName parses a string to a template, and returns a branch name from that new template. If a branch name can not be rendered, it returns an empty value.
func TemplateCommitMessage ¶ added in v0.10.2
func TemplateCommitMessage(ctx context.Context, tpl *template.Template, appName string, changeList []ChangeEntry) string
TemplateCommitMessage renders a commit message template and returns it as a string. If the template could not be rendered, returns a default message.
Types ¶
type ApplicationImages ¶
type ApplicationImages struct {
argocdapi.Application
*WriteBackConfig
Images ImageList
}
ApplicationImages holds an Argo CD application, its write-back config, and a list of its images that are allowed to be considered for updates.
type ApplicationType ¶
type ApplicationType int
ApplicationType Type of the application
const ( ApplicationTypeUnsupported ApplicationType = 0 ApplicationTypeHelm ApplicationType = 1 ApplicationTypeKustomize ApplicationType = 2 )
func GetApplicationType ¶ added in v0.2.0
func GetApplicationType(app *argocdapi.Application, wbc *WriteBackConfig) ApplicationType
GetApplicationType returns the type of the ArgoCD application
type ArgoCD ¶
type ArgoCD interface {
GetApplication(ctx context.Context, appNamespace string, appName string) (*argocdapi.Application, error)
UpdateSpec(ctx context.Context, spec *application.ApplicationUpdateSpecRequest) (*argocdapi.ApplicationSpec, error)
}
ArgoCD is the interface for accessing Argo CD functions we need
type ArgoCDK8sClient ¶ added in v1.0.0
type ArgoCDK8sClient struct {
ctrlclient.Client
}
ArgoCDK8sClient is a controller-runtime based client specifically for ArgoCD application operations. It wraps ctrlclient.Client to provide ArgoCD-specific functionality like getting, listing, and updating ArgoCD Application resources.
func NewArgoCDK8sClient ¶ added in v1.0.0
func NewArgoCDK8sClient(ctrlClient ctrlclient.Client) (*ArgoCDK8sClient, error)
NewArgoCDK8sClient creates a new ArgoCD-specific Kubernetes client for managing ArgoCD applications. This client is designed to work with controller-runtime and provides methods for ArgoCD Application CRUD operations.
func (*ArgoCDK8sClient) GetApplication ¶ added in v1.0.0
func (client *ArgoCDK8sClient) GetApplication(ctx context.Context, appNamespace string, appName string) (*argocdapi.Application, error)
GetApplication retrieves a single application by its name and namespace.
func (*ArgoCDK8sClient) UpdateSpec ¶ added in v1.0.0
func (client *ArgoCDK8sClient) UpdateSpec(ctx context.Context, spec *application.ApplicationUpdateSpecRequest) (*argocdapi.ApplicationSpec, error)
UpdateSpec updates the spec for given application
type ChangeEntry ¶ added in v0.10.2
ChangeEntry represents an image that has been changed by Image Updater
type GitCredsSource ¶ added in v0.9.0
type GitCredsSource func(app *argocdapi.Application) (git.Creds, error)
type Image ¶ added in v1.0.0
type Image struct {
*image.ContainerImage
// Update settings
UpdateStrategy image.UpdateStrategy
ForceUpdate bool
AllowTags string
IgnoreTags []string
PullSecret string
Platforms []string
// ManifestTarget settings
HelmImageName string
HelmImageTag string
HelmImageSpec string
KustomizeImageName string
}
Image represents a container image and its update configuration. It embeds the neutral ContainerImage type and adds updater-specific configuration. Use this struct to populate elements from ImageUpdater CR.
func NewImage ¶ added in v1.0.0
func NewImage(ci *image.ContainerImage) *Image
NewImage creates a new Image object from a neutral ContainerImage
type ImageList ¶
type ImageList []*Image
ImageList is a list of Image objects that can be updated.
func GetImagesAndAliasesFromApplication ¶ added in v0.14.0
func GetImagesAndAliasesFromApplication(applicationImages *ApplicationImages) ImageList
GetImagesAndAliasesFromApplication returns the list of known images for the given application TODO: this function together with GetImagesFromApplication should be refactored. We iterate through applicationImages.Images 3 times in one place (2 in functions and in containerImages.ContainsImage). Also the 4th loop is in marshalParamsOverride. See GITOPS-7415
func (ImageList) ToContainerImageList ¶ added in v1.0.0
func (list ImageList) ToContainerImageList() image.ContainerImageList
ToContainerImageList is a private helper that converts an ImageList to a neutral image.ContainerImageList. This allows us to reuse methods defined on ContainerImageList without duplicating code.
type ImageUpdaterResult ¶ added in v0.4.0
type ImageUpdaterResult struct {
NumApplicationsProcessed int
NumImagesFound int
NumImagesUpdated int
NumImagesConsidered int
NumSkipped int
NumErrors int
}
ImageUpdaterResult Stores some statistics about the results of a run
func UpdateApplication ¶ added in v0.4.0
func UpdateApplication(ctx context.Context, 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.ImageUpdaterKubernetesClient
UpdateApp *ApplicationImages
DryRun bool
GitCommitUser string
GitCommitEmail string
GitCommitMessage *template.Template
GitCommitSigningKey string
GitCommitSigningMethod string
GitCommitSignOff bool
DisableKubeEvents bool
IgnorePlatforms bool
GitCreds git.CredsStore
}
type WebhookEvent ¶ added in v1.0.0
type WebhookEvent struct {
// RegistryURL is the URL of the registry that sent the webhook
RegistryURL string `json:"registryUrl,omitempty"`
// Repository is the repository name
Repository string `json:"repository,omitempty"`
// Tag is the image tag
Tag string `json:"tag,omitempty"`
// Digest is the content digest of the image
Digest string `json:"digest,omitempty"`
}
WebhookEvent represents a generic webhook payload
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
GitWriteBranch string
GitCommitUser string
GitCommitEmail string
GitCommitMessage string
GitCommitSigningKey string
GitCommitSigningMethod string
GitCommitSignOff bool
KustomizeBase string
Target string
GitRepo string
GitCreds git.CredsStore
}
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 )