-
Notifications
You must be signed in to change notification settings - Fork 2
/
utils.go
43 lines (33 loc) · 824 Bytes
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package source
import (
argov1alpha1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
)
func getImageSetFromTemplates(templates []argov1alpha1.Template) map[string]bool {
imageMap := make(map[string]bool)
for _, t := range templates {
for _, ic := range t.InitContainers {
imageMap[ic.Container.Image] = true
}
if t.Script != nil {
imageMap[t.Script.Image] = true
}
if t.Container != nil {
imageMap[t.Container.Image] = true
}
if t.ContainerSet != nil {
for _, c := range t.ContainerSet.Containers {
imageMap[c.Image] = true
}
}
}
return imageMap
}
func setDifference(a map[string]bool, b map[string]bool) []string {
var results []string
for key := range a {
if _, exists := b[key]; !exists {
results = append(results, key)
}
}
return results
}