Skip to content

Commit f84d0bc

Browse files
Merge remote-tracking branch 'askhari/fix/set-default-image-alias-with-helmvalues' into fix/set-default-image-alias-with-helmvalues
2 parents b86e898 + 26bf144 commit f84d0bc

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.13.0
1+
99.9.9

pkg/argocd/update.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ func marshalParamsOverride(app *v1alpha1.Application, originalData []byte) ([]by
419419
images := GetImagesAndAliasesFromApplication(app)
420420

421421
for _, c := range images {
422-
helmAnnotationParamName := c.GetParameterHelmImageName(app.Annotations)
423-
helmAnnotationParamVersion := c.GetParameterHelmImageTag(app.Annotations)
422+
helmAnnotationParamName, helmAnnotationParamVersion := getHelmParamNamesFromAnnotation(app.Annotations, c.NormalizedSymbolicName())
424423

425424
if helmAnnotationParamName == "" {
426425
return nil, fmt.Errorf("could not find an image-name annotation for image %s", c.ImageAlias)

pkg/image/options.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// GetParameterHelmImageName gets the value for image-name option for the image
1414
// from a set of annotations
1515
func (img *ContainerImage) GetParameterHelmImageName(annotations map[string]string) string {
16-
key := fmt.Sprintf(common.HelmParamImageNameAnnotation, img.normalizedSymbolicName())
16+
key := fmt.Sprintf(common.HelmParamImageNameAnnotation, img.NormalizedSymbolicName())
1717
val, ok := annotations[key]
1818
if !ok {
1919
return ""
@@ -24,7 +24,7 @@ func (img *ContainerImage) GetParameterHelmImageName(annotations map[string]stri
2424
// GetParameterHelmImageTag gets the value for image-tag option for the image
2525
// from a set of annotations
2626
func (img *ContainerImage) GetParameterHelmImageTag(annotations map[string]string) string {
27-
key := fmt.Sprintf(common.HelmParamImageTagAnnotation, img.normalizedSymbolicName())
27+
key := fmt.Sprintf(common.HelmParamImageTagAnnotation, img.NormalizedSymbolicName())
2828
val, ok := annotations[key]
2929
if !ok {
3030
return ""
@@ -35,7 +35,7 @@ func (img *ContainerImage) GetParameterHelmImageTag(annotations map[string]strin
3535
// GetParameterHelmImageSpec gets the value for image-spec option for the image
3636
// from a set of annotations
3737
func (img *ContainerImage) GetParameterHelmImageSpec(annotations map[string]string) string {
38-
key := fmt.Sprintf(common.HelmParamImageSpecAnnotation, img.normalizedSymbolicName())
38+
key := fmt.Sprintf(common.HelmParamImageSpecAnnotation, img.NormalizedSymbolicName())
3939
val, ok := annotations[key]
4040
if !ok {
4141
return ""
@@ -46,7 +46,7 @@ func (img *ContainerImage) GetParameterHelmImageSpec(annotations map[string]stri
4646
// GetParameterKustomizeImageName gets the value for image-spec option for the
4747
// image from a set of annotations
4848
func (img *ContainerImage) GetParameterKustomizeImageName(annotations map[string]string) string {
49-
key := fmt.Sprintf(common.KustomizeApplicationNameAnnotation, img.normalizedSymbolicName())
49+
key := fmt.Sprintf(common.KustomizeApplicationNameAnnotation, img.NormalizedSymbolicName())
5050
val, ok := annotations[key]
5151
if !ok {
5252
return ""
@@ -58,7 +58,7 @@ func (img *ContainerImage) GetParameterKustomizeImageName(annotations map[string
5858
// image from a set of annotations
5959
func (img *ContainerImage) HasForceUpdateOptionAnnotation(annotations map[string]string) bool {
6060
forceUpdateAnnotations := []string{
61-
fmt.Sprintf(common.ForceUpdateOptionAnnotation, img.normalizedSymbolicName()),
61+
fmt.Sprintf(common.ForceUpdateOptionAnnotation, img.NormalizedSymbolicName()),
6262
common.ApplicationWideForceUpdateOptionAnnotation,
6363
}
6464
var forceUpdateVal = ""
@@ -75,7 +75,7 @@ func (img *ContainerImage) HasForceUpdateOptionAnnotation(annotations map[string
7575
// image from a set of annotations
7676
func (img *ContainerImage) GetParameterUpdateStrategy(annotations map[string]string) UpdateStrategy {
7777
updateStrategyAnnotations := []string{
78-
fmt.Sprintf(common.UpdateStrategyAnnotation, img.normalizedSymbolicName()),
78+
fmt.Sprintf(common.UpdateStrategyAnnotation, img.NormalizedSymbolicName()),
7979
common.ApplicationWideUpdateStrategyAnnotation,
8080
}
8181
var updateStrategyVal = ""
@@ -123,7 +123,7 @@ func (img *ContainerImage) ParseUpdateStrategy(val string) UpdateStrategy {
123123
// default, to prevent accidental matches.
124124
func (img *ContainerImage) GetParameterMatch(annotations map[string]string) (MatchFuncFn, interface{}) {
125125
allowTagsAnnotations := []string{
126-
fmt.Sprintf(common.AllowTagsOptionAnnotation, img.normalizedSymbolicName()),
126+
fmt.Sprintf(common.AllowTagsOptionAnnotation, img.NormalizedSymbolicName()),
127127
common.ApplicationWideAllowTagsOptionAnnotation,
128128
}
129129
var allowTagsVal = ""
@@ -137,7 +137,7 @@ func (img *ContainerImage) GetParameterMatch(annotations map[string]string) (Mat
137137
if allowTagsVal == "" {
138138
// The old match-tag annotation is deprecated and will be subject to removal
139139
// in a future version.
140-
key := fmt.Sprintf(common.OldMatchOptionAnnotation, img.normalizedSymbolicName())
140+
key := fmt.Sprintf(common.OldMatchOptionAnnotation, img.NormalizedSymbolicName())
141141
val, ok := annotations[key]
142142
if ok {
143143
logCtx.Warnf("The 'tag-match' annotation is deprecated and subject to removal. Please use 'allow-tags' annotation instead.")
@@ -182,7 +182,7 @@ func (img *ContainerImage) ParseMatchfunc(val string) (MatchFuncFn, interface{})
182182
// GetParameterPullSecret retrieves an image's pull secret credentials
183183
func (img *ContainerImage) GetParameterPullSecret(annotations map[string]string) *CredentialSource {
184184
pullSecretAnnotations := []string{
185-
fmt.Sprintf(common.PullSecretAnnotation, img.normalizedSymbolicName()),
185+
fmt.Sprintf(common.PullSecretAnnotation, img.NormalizedSymbolicName()),
186186
common.ApplicationWidePullSecretAnnotation,
187187
}
188188
var pullSecretVal = ""
@@ -208,7 +208,7 @@ func (img *ContainerImage) GetParameterPullSecret(annotations map[string]string)
208208
// GetParameterIgnoreTags retrieves a list of tags to ignore from a comma-separated string
209209
func (img *ContainerImage) GetParameterIgnoreTags(annotations map[string]string) []string {
210210
ignoreTagsAnnotations := []string{
211-
fmt.Sprintf(common.IgnoreTagsOptionAnnotation, img.normalizedSymbolicName()),
211+
fmt.Sprintf(common.IgnoreTagsOptionAnnotation, img.NormalizedSymbolicName()),
212212
common.ApplicationWideIgnoreTagsOptionAnnotation,
213213
}
214214
var ignoreTagsVal = ""
@@ -242,7 +242,7 @@ func (img *ContainerImage) GetParameterIgnoreTags(annotations map[string]string)
242242
func (img *ContainerImage) GetPlatformOptions(annotations map[string]string, unrestricted bool) *options.ManifestOptions {
243243
logCtx := img.LogContext()
244244
var opts *options.ManifestOptions = options.NewManifestOptions()
245-
key := fmt.Sprintf(common.PlatformsAnnotation, img.normalizedSymbolicName())
245+
key := fmt.Sprintf(common.PlatformsAnnotation, img.NormalizedSymbolicName())
246246
val, ok := annotations[key]
247247
if !ok {
248248
if !unrestricted {
@@ -291,6 +291,6 @@ func ParsePlatform(platformID string) (string, string, string, error) {
291291
return os, arch, variant, nil
292292
}
293293

294-
func (img *ContainerImage) normalizedSymbolicName() string {
294+
func (img *ContainerImage) NormalizedSymbolicName() string {
295295
return strings.ReplaceAll(img.ImageAlias, "/", "_")
296296
}

0 commit comments

Comments
 (0)