mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
Merge pull request #1770 from weaveworks/1750-extend-k8s-pause-containers
Identify kubernetes pause containers more broadly
This commit is contained in:
@@ -142,6 +142,13 @@ func (r *Reporter) podEvent(e Event, pod Pod) {
|
||||
}
|
||||
}
|
||||
|
||||
// IsPauseImageName indicates whether an image name corresponds to a
|
||||
// kubernetes pause container image.
|
||||
func IsPauseImageName(imageName string) bool {
|
||||
return strings.Contains(imageName, "google_containers/pause")
|
||||
|
||||
}
|
||||
|
||||
func isPauseContainer(n report.Node, rpt report.Report) bool {
|
||||
containerImageIDs, ok := n.Parents.Lookup(report.ContainerImage)
|
||||
if !ok {
|
||||
@@ -156,9 +163,7 @@ func isPauseContainer(n report.Node, rpt report.Report) bool {
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if docker.ImageNameWithoutVersion(imageName) == "google_containers/pause" {
|
||||
return true
|
||||
}
|
||||
return IsPauseImageName(imageName)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ func IsApplication(n report.Node) bool {
|
||||
}
|
||||
imageName, _ := n.Latest.Lookup(docker.ImageName)
|
||||
imagePrefix := strings.SplitN(imageName, ":", 2)[0] // :(
|
||||
if _, ok := systemImagePrefixes[imagePrefix]; ok {
|
||||
if _, ok := systemImagePrefixes[imagePrefix]; ok || kubernetes.IsPauseImageName(imagePrefix) {
|
||||
return false
|
||||
}
|
||||
roleLabel, _ := n.Latest.Lookup(docker.LabelPrefix + "works.weave.role")
|
||||
@@ -268,15 +268,13 @@ var systemContainerNames = map[string]struct{}{
|
||||
}
|
||||
|
||||
var systemImagePrefixes = map[string]struct{}{
|
||||
"swarm": {},
|
||||
"weaveworks/scope": {},
|
||||
"weaveworks/weavedns": {},
|
||||
"weaveworks/weave": {},
|
||||
"weaveworks/weaveproxy": {},
|
||||
"weaveworks/weaveexec": {},
|
||||
"amazon/amazon-ecs-agent": {},
|
||||
"beta.gcr.io/google_containers/pause": {},
|
||||
"gcr.io/google_containers/pause": {},
|
||||
"openshift/origin-pod": {},
|
||||
"docker.io/openshift/origin-pod": {},
|
||||
"swarm": {},
|
||||
"weaveworks/scope": {},
|
||||
"weaveworks/weavedns": {},
|
||||
"weaveworks/weave": {},
|
||||
"weaveworks/weaveproxy": {},
|
||||
"weaveworks/weaveexec": {},
|
||||
"amazon/amazon-ecs-agent": {},
|
||||
"openshift/origin-pod": {},
|
||||
"docker.io/openshift/origin-pod": {},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user