annotation helpers
parent
3d8eb41d4a
commit
5402cd9236
|
@ -0,0 +1,30 @@
|
|||
package kubernetes
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func addImageToPull(annotations map[string]string, image string) map[string]string {
|
||||
existing, ok := annotations[forceUpdateImageAnnotation]
|
||||
if ok {
|
||||
annotations[forceUpdateImageAnnotation] = existing + "," + image
|
||||
return annotations
|
||||
}
|
||||
annotations[forceUpdateImageAnnotation] = image
|
||||
return annotations
|
||||
}
|
||||
|
||||
func shouldPullImage(annotations map[string]string, image string) bool {
|
||||
imagesStr, ok := annotations[forceUpdateImageAnnotation]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
images := strings.Split(imagesStr, ",")
|
||||
for _, img := range images {
|
||||
if img == image {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
Loading…
Reference in New Issue