@@ -12,8 +12,8 @@ import (
12
12
13
13
// GetParameterHelmImageName gets the value for image-name option for the image
14
14
// from a set of annotations
15
- func (img * ContainerImage ) GetParameterHelmImageName (annotations map [string ]string ) string {
16
- key := fmt .Sprintf (common .HelmParamImageNameAnnotation , img .normalizedSymbolicName ())
15
+ func (img * ContainerImage ) GetParameterHelmImageName (annotations map [string ]string , annotationPrefix string ) string {
16
+ key := fmt .Sprintf (common .Prefixed ( annotationPrefix , common . HelmParamImageNameAnnotationSuffix ) , img .normalizedSymbolicName ())
17
17
val , ok := annotations [key ]
18
18
if ! ok {
19
19
return ""
@@ -23,8 +23,8 @@ func (img *ContainerImage) GetParameterHelmImageName(annotations map[string]stri
23
23
24
24
// GetParameterHelmImageTag gets the value for image-tag option for the image
25
25
// from a set of annotations
26
- func (img * ContainerImage ) GetParameterHelmImageTag (annotations map [string ]string ) string {
27
- key := fmt .Sprintf (common .HelmParamImageTagAnnotation , img .normalizedSymbolicName ())
26
+ func (img * ContainerImage ) GetParameterHelmImageTag (annotations map [string ]string , annotationPrefix string ) string {
27
+ key := fmt .Sprintf (common .Prefixed ( annotationPrefix , common . HelmParamImageTagAnnotationSuffix ) , img .normalizedSymbolicName ())
28
28
val , ok := annotations [key ]
29
29
if ! ok {
30
30
return ""
@@ -34,8 +34,8 @@ func (img *ContainerImage) GetParameterHelmImageTag(annotations map[string]strin
34
34
35
35
// GetParameterHelmImageSpec gets the value for image-spec option for the image
36
36
// from a set of annotations
37
- func (img * ContainerImage ) GetParameterHelmImageSpec (annotations map [string ]string ) string {
38
- key := fmt .Sprintf (common .HelmParamImageSpecAnnotation , img .normalizedSymbolicName ())
37
+ func (img * ContainerImage ) GetParameterHelmImageSpec (annotations map [string ]string , annotationPrefix string ) string {
38
+ key := fmt .Sprintf (common .Prefixed ( annotationPrefix , common . HelmParamImageSpecAnnotationSuffix ) , img .normalizedSymbolicName ())
39
39
val , ok := annotations [key ]
40
40
if ! ok {
41
41
return ""
@@ -45,8 +45,8 @@ func (img *ContainerImage) GetParameterHelmImageSpec(annotations map[string]stri
45
45
46
46
// GetParameterKustomizeImageName gets the value for image-spec option for the
47
47
// image from a set of annotations
48
- func (img * ContainerImage ) GetParameterKustomizeImageName (annotations map [string ]string ) string {
49
- key := fmt .Sprintf (common .KustomizeApplicationNameAnnotation , img .normalizedSymbolicName ())
48
+ func (img * ContainerImage ) GetParameterKustomizeImageName (annotations map [string ]string , annotationPrefix string ) string {
49
+ key := fmt .Sprintf (common .Prefixed ( annotationPrefix , common . KustomizeApplicationNameAnnotationSuffix ) , img .normalizedSymbolicName ())
50
50
val , ok := annotations [key ]
51
51
if ! ok {
52
52
return ""
@@ -56,10 +56,10 @@ func (img *ContainerImage) GetParameterKustomizeImageName(annotations map[string
56
56
57
57
// HasForceUpdateOptionAnnotation gets the value for force-update option for the
58
58
// image from a set of annotations
59
- func (img * ContainerImage ) HasForceUpdateOptionAnnotation (annotations map [string ]string ) bool {
59
+ func (img * ContainerImage ) HasForceUpdateOptionAnnotation (annotations map [string ]string , annotationPrefix string ) bool {
60
60
forceUpdateAnnotations := []string {
61
- fmt .Sprintf (common .ForceUpdateOptionAnnotation , img .normalizedSymbolicName ()),
62
- common .ApplicationWideForceUpdateOptionAnnotation ,
61
+ fmt .Sprintf (common .Prefixed ( annotationPrefix , common . ForceUpdateOptionAnnotationSuffix ) , img .normalizedSymbolicName ()),
62
+ common .Prefixed ( annotationPrefix , common . ApplicationWideForceUpdateOptionAnnotationSuffix ) ,
63
63
}
64
64
var forceUpdateVal = ""
65
65
for _ , key := range forceUpdateAnnotations {
@@ -73,10 +73,10 @@ func (img *ContainerImage) HasForceUpdateOptionAnnotation(annotations map[string
73
73
74
74
// GetParameterSort gets and validates the value for the sort option for the
75
75
// image from a set of annotations
76
- func (img * ContainerImage ) GetParameterUpdateStrategy (annotations map [string ]string ) UpdateStrategy {
76
+ func (img * ContainerImage ) GetParameterUpdateStrategy (annotations map [string ]string , annotationPrefix string ) UpdateStrategy {
77
77
updateStrategyAnnotations := []string {
78
- fmt .Sprintf (common .UpdateStrategyAnnotation , img .normalizedSymbolicName ()),
79
- common .ApplicationWideUpdateStrategyAnnotation ,
78
+ fmt .Sprintf (common .Prefixed ( annotationPrefix , common . UpdateStrategyAnnotationSuffix ) , img .normalizedSymbolicName ()),
79
+ common .Prefixed ( annotationPrefix , common . ApplicationWideUpdateStrategyAnnotationSuffix ) ,
80
80
}
81
81
var updateStrategyVal = ""
82
82
for _ , key := range updateStrategyAnnotations {
@@ -121,10 +121,10 @@ func (img *ContainerImage) ParseUpdateStrategy(val string) UpdateStrategy {
121
121
// GetParameterMatch returns the match function and pattern to use for matching
122
122
// tag names. If an invalid option is found, it returns MatchFuncNone as the
123
123
// default, to prevent accidental matches.
124
- func (img * ContainerImage ) GetParameterMatch (annotations map [string ]string ) (MatchFuncFn , interface {}) {
124
+ func (img * ContainerImage ) GetParameterMatch (annotations map [string ]string , annotationPrefix string ) (MatchFuncFn , interface {}) {
125
125
allowTagsAnnotations := []string {
126
- fmt .Sprintf (common .AllowTagsOptionAnnotation , img .normalizedSymbolicName ()),
127
- common .ApplicationWideAllowTagsOptionAnnotation ,
126
+ fmt .Sprintf (common .Prefixed ( annotationPrefix , common . AllowTagsOptionAnnotationSuffix ) , img .normalizedSymbolicName ()),
127
+ common .Prefixed ( annotationPrefix , common . ApplicationWideAllowTagsOptionAnnotationSuffix ) ,
128
128
}
129
129
var allowTagsVal = ""
130
130
for _ , key := range allowTagsAnnotations {
@@ -137,7 +137,7 @@ func (img *ContainerImage) GetParameterMatch(annotations map[string]string) (Mat
137
137
if allowTagsVal == "" {
138
138
// The old match-tag annotation is deprecated and will be subject to removal
139
139
// in a future version.
140
- key := fmt .Sprintf (common .OldMatchOptionAnnotation , img .normalizedSymbolicName ())
140
+ key := fmt .Sprintf (common .Prefixed ( annotationPrefix , common . OldMatchOptionAnnotationSuffix ) , img .normalizedSymbolicName ())
141
141
val , ok := annotations [key ]
142
142
if ok {
143
143
logCtx .Warnf ("The 'tag-match' annotation is deprecated and subject to removal. Please use 'allow-tags' annotation instead." )
@@ -180,10 +180,10 @@ func (img *ContainerImage) ParseMatchfunc(val string) (MatchFuncFn, interface{})
180
180
}
181
181
182
182
// GetParameterPullSecret retrieves an image's pull secret credentials
183
- func (img * ContainerImage ) GetParameterPullSecret (annotations map [string ]string ) * CredentialSource {
183
+ func (img * ContainerImage ) GetParameterPullSecret (annotations map [string ]string , annotationPrefix string ) * CredentialSource {
184
184
pullSecretAnnotations := []string {
185
- fmt .Sprintf (common .PullSecretAnnotation , img .normalizedSymbolicName ()),
186
- common .ApplicationWidePullSecretAnnotation ,
185
+ fmt .Sprintf (common .Prefixed ( annotationPrefix , common . PullSecretAnnotationSuffix ) , img .normalizedSymbolicName ()),
186
+ common .Prefixed ( annotationPrefix , common . ApplicationWidePullSecretAnnotationSuffix ) ,
187
187
}
188
188
var pullSecretVal = ""
189
189
for _ , key := range pullSecretAnnotations {
@@ -206,10 +206,10 @@ func (img *ContainerImage) GetParameterPullSecret(annotations map[string]string)
206
206
}
207
207
208
208
// GetParameterIgnoreTags retrieves a list of tags to ignore from a comma-separated string
209
- func (img * ContainerImage ) GetParameterIgnoreTags (annotations map [string ]string ) []string {
209
+ func (img * ContainerImage ) GetParameterIgnoreTags (annotations map [string ]string , annotationPrefix string ) []string {
210
210
ignoreTagsAnnotations := []string {
211
- fmt .Sprintf (common .IgnoreTagsOptionAnnotation , img .normalizedSymbolicName ()),
212
- common .ApplicationWideIgnoreTagsOptionAnnotation ,
211
+ fmt .Sprintf (common .Prefixed ( annotationPrefix , common . IgnoreTagsOptionAnnotationSuffix ) , img .normalizedSymbolicName ()),
212
+ common .Prefixed ( annotationPrefix , common . ApplicationWideIgnoreTagsOptionAnnotationSuffix ) ,
213
213
}
214
214
var ignoreTagsVal = ""
215
215
for _ , key := range ignoreTagsAnnotations {
@@ -239,10 +239,10 @@ func (img *ContainerImage) GetParameterIgnoreTags(annotations map[string]string)
239
239
// is specified in the annotations, we restrict the platform for images to the
240
240
// platform we're executed on unless unrestricted is set to true, in which case
241
241
// we do not setup a platform restriction if no platform annotation is found.
242
- func (img * ContainerImage ) GetPlatformOptions (annotations map [string ]string , unrestricted bool ) * options.ManifestOptions {
242
+ func (img * ContainerImage ) GetPlatformOptions (annotations map [string ]string , unrestricted bool , annotationPrefix string ) * options.ManifestOptions {
243
243
logCtx := img .LogContext ()
244
244
var opts * options.ManifestOptions = options .NewManifestOptions ()
245
- key := fmt .Sprintf (common .PlatformsAnnotation , img .normalizedSymbolicName ())
245
+ key := fmt .Sprintf (common .Prefixed ( annotationPrefix , common . PlatformsAnnotationSuffix ) , img .normalizedSymbolicName ())
246
246
val , ok := annotations [key ]
247
247
if ! ok {
248
248
if ! unrestricted {
0 commit comments