Skip to content

Commit d829c5b

Browse files
authored
ENH: Adds container image ID to minified service (#12)
1 parent fe14f1c commit d829c5b

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

service/minify.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ func MinifySwarmService(ss SwarmService, ignoreKey string, includeKey string) Sw
5454
NodeInfo: ss.NodeInfo,
5555
}
5656

57+
if ss.Spec.TaskTemplate.ContainerSpec != nil {
58+
ssm.ContainerImage = ss.Spec.TaskTemplate.ContainerSpec.Image
59+
}
60+
5761
if ss.Spec.Mode.Global != nil {
5862
ssm.Global = true
5963
return ssm

service/types.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import (
88

99
// SwarmServiceMini is a optimized version of `SwarmService` for caching purposes
1010
type SwarmServiceMini struct {
11-
ID string
12-
Name string
13-
Labels map[string]string
14-
Global bool
15-
Replicas uint64
16-
NodeInfo NodeIPSet
11+
ID string
12+
Name string
13+
Labels map[string]string
14+
Global bool
15+
Replicas uint64
16+
ContainerImage string
17+
NodeInfo NodeIPSet
1718
}
1819

1920
// Equal returns when SwarmServiceMini is equal to `other`
@@ -24,6 +25,7 @@ func (ssm SwarmServiceMini) Equal(other SwarmServiceMini) bool {
2425
EqualMapStringString(ssm.Labels, other.Labels) &&
2526
(ssm.Global == other.Global) &&
2627
(ssm.Replicas == other.Replicas) &&
28+
(ssm.ContainerImage == other.ContainerImage) &&
2729
EqualNodeIPSet(ssm.NodeInfo, other.NodeInfo)
2830
}
2931

0 commit comments

Comments
 (0)