Cleanup pod annotation test and only support tailing wildcard.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2019-03-22 02:39:06 -07:00
parent bb58b1dbb0
commit 238658719f
7 changed files with 154 additions and 114 deletions

View File

@@ -634,9 +634,11 @@ func getPassthroughAnnotations(podAnnotations map[string]string,
passthroughAnnotations = make(map[string]string)
for podAnnotationKey, podAnnotationValue := range podAnnotations {
for _, r := range runtimePodAnnotations {
match, _ := regexp.MatchString(r, podAnnotationKey)
if match {
for _, pattern := range runtimePodAnnotations {
// Use path.Match instead of filepath.Match here.
// filepath.Match treated `\\` as path separator
// on windows, which is not what we want.
if ok, _ := path.Match(pattern, podAnnotationKey); ok {
passthroughAnnotations[podAnnotationKey] = podAnnotationValue
}
}