diff options
| author | Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> | 2025-01-14 20:20:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-14 20:20:42 -0500 |
| commit | 9affc2119baee1307a9d362b14e35712ac778f82 (patch) | |
| tree | 4a47acf13498a3b0148619ee91d7a9adca59af88 /pkg/argocd/argocd.go | |
| parent | 10a01f381aa7d55e9806c7e8df75fee78976cebc (diff) | |
Signed-off-by: Ishita Sequeira <ishiseq29@gmail.com>
Diffstat (limited to 'pkg/argocd/argocd.go')
| -rw-r--r-- | pkg/argocd/argocd.go | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/pkg/argocd/argocd.go b/pkg/argocd/argocd.go index fdcc69c..de540f6 100644 --- a/pkg/argocd/argocd.go +++ b/pkg/argocd/argocd.go @@ -11,6 +11,7 @@ import ( "github.com/argoproj-labs/argocd-image-updater/pkg/common" "github.com/argoproj-labs/argocd-image-updater/pkg/kube" "github.com/argoproj-labs/argocd-image-updater/pkg/metrics" + registryCommon "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/common" "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/env" "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/image" "github.com/argoproj-labs/argocd-image-updater/registry-scanner/pkg/log" @@ -232,7 +233,7 @@ func parseImageList(annotations map[string]string) *image.ContainerImageList { splits := strings.Split(updateImage, ",") for _, s := range splits { img := image.NewFromIdentifier(strings.TrimSpace(s)) - if kustomizeImage := img.GetParameterKustomizeImageName(annotations); kustomizeImage != "" { + if kustomizeImage := img.GetParameterKustomizeImageName(annotations, common.ImageUpdaterAnnotationPrefix); kustomizeImage != "" { img.KustomizeImage = image.NewFromIdentifier(kustomizeImage) } results = append(results, img) @@ -314,17 +315,17 @@ func getHelmParamNamesFromAnnotation(annotations map[string]string, img *image.C var annotationName, helmParamName, helmParamVersion string // Image spec is a full-qualified specifier, if we have it, we return early - if param := img.GetParameterHelmImageSpec(annotations); param != "" { + if param := img.GetParameterHelmImageSpec(annotations, common.ImageUpdaterAnnotationPrefix); param != "" { log.Tracef("found annotation %s", annotationName) return strings.TrimSpace(param), "" } - if param := img.GetParameterHelmImageName(annotations); param != "" { + if param := img.GetParameterHelmImageName(annotations, common.ImageUpdaterAnnotationPrefix); param != "" { log.Tracef("found annotation %s", annotationName) helmParamName = param } - if param := img.GetParameterHelmImageTag(annotations); param != "" { + if param := img.GetParameterHelmImageTag(annotations, common.ImageUpdaterAnnotationPrefix); param != "" { log.Tracef("found annotation %s", annotationName) helmParamVersion = param } @@ -384,16 +385,16 @@ func GetHelmImage(app *v1alpha1.Application, newImage *image.ContainerImage) (st var hpImageName, hpImageTag, hpImageSpec string - hpImageSpec = newImage.GetParameterHelmImageSpec(app.Annotations) - hpImageName = newImage.GetParameterHelmImageName(app.Annotations) - hpImageTag = newImage.GetParameterHelmImageTag(app.Annotations) + hpImageSpec = newImage.GetParameterHelmImageSpec(app.Annotations, common.ImageUpdaterAnnotationPrefix) + hpImageName = newImage.GetParameterHelmImageName(app.Annotations, common.ImageUpdaterAnnotationPrefix) + hpImageTag = newImage.GetParameterHelmImageTag(app.Annotations, common.ImageUpdaterAnnotationPrefix) if hpImageSpec == "" { if hpImageName == "" { - hpImageName = common.DefaultHelmImageName + hpImageName = registryCommon.DefaultHelmImageName } if hpImageTag == "" { - hpImageTag = common.DefaultHelmImageTag + hpImageTag = registryCommon.DefaultHelmImageTag } } @@ -434,16 +435,16 @@ func SetHelmImage(app *v1alpha1.Application, newImage *image.ContainerImage) err var hpImageName, hpImageTag, hpImageSpec string - hpImageSpec = newImage.GetParameterHelmImageSpec(app.Annotations) - hpImageName = newImage.GetParameterHelmImageName(app.Annotations) - hpImageTag = newImage.GetParameterHelmImageTag(app.Annotations) + hpImageSpec = newImage.GetParameterHelmImageSpec(app.Annotations, common.ImageUpdaterAnnotationPrefix) + hpImageName = newImage.GetParameterHelmImageName(app.Annotations, common.ImageUpdaterAnnotationPrefix) + hpImageTag = newImage.GetParameterHelmImageTag(app.Annotations, common.ImageUpdaterAnnotationPrefix) if hpImageSpec == "" { if hpImageName == "" { - hpImageName = common.DefaultHelmImageName + hpImageName = registryCommon.DefaultHelmImageName } if hpImageTag == "" { - hpImageTag = common.DefaultHelmImageTag + hpImageTag = registryCommon.DefaultHelmImageTag } } @@ -494,7 +495,7 @@ func GetKustomizeImage(app *v1alpha1.Application, newImage *image.ContainerImage return "", fmt.Errorf("cannot set Kustomize image on non-Kustomize application") } - ksImageName := newImage.GetParameterKustomizeImageName(app.Annotations) + ksImageName := newImage.GetParameterKustomizeImageName(app.Annotations, common.ImageUpdaterAnnotationPrefix) appSource := getApplicationSource(app) @@ -524,7 +525,7 @@ func SetKustomizeImage(app *v1alpha1.Application, newImage *image.ContainerImage } var ksImageParam string - ksImageName := newImage.GetParameterKustomizeImageName(app.Annotations) + ksImageName := newImage.GetParameterKustomizeImageName(app.Annotations, common.ImageUpdaterAnnotationPrefix) if ksImageName != "" { ksImageParam = fmt.Sprintf("%s=%s", ksImageName, newImage.GetFullNameWithTag()) } else { @@ -568,7 +569,7 @@ func GetImagesFromApplication(app *v1alpha1.Application) image.ContainerImageLis // Check the image list for images with a force-update annotation, and add them if they are not already present. annotations := app.Annotations for _, img := range *parseImageList(annotations) { - if img.HasForceUpdateOptionAnnotation(annotations) { + if img.HasForceUpdateOptionAnnotation(annotations, common.ImageUpdaterAnnotationPrefix) { img.ImageTag = nil // the tag from the image list will be a version constraint, which isn't a valid tag images = append(images, img) } |
