fix event ref determination for apigroups

Kubernetes-commit: b2be8953b147d4c386768b0bdd3d9a93a47a625b
This commit is contained in:
David Eads
2018-05-16 08:08:20 -04:00
committed by Kubernetes Publisher
parent d9cf977510
commit acfb32b7e4
2 changed files with 78 additions and 2 deletions

View File

@@ -86,10 +86,14 @@ func GetReference(scheme *runtime.Scheme, obj runtime.Object) (*v1.ObjectReferen
}
// example paths: /<prefix>/<version>/*
parts := strings.Split(selfLinkUrl.Path, "/")
if len(parts) < 3 {
if len(parts) < 4 {
return nil, fmt.Errorf("unexpected self link format: '%v'; got version '%v'", selfLink, version)
}
version = parts[2]
if parts[1] == "api" {
version = parts[2]
} else {
version = parts[2] + "/" + parts[3]
}
}
// only has list metadata