Enable regular expression matching

This commit is contained in:
Rafia Sabih 2020-04-28 11:46:29 +02:00
parent dd2381174c
commit 8d718c4fc1
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package cluster
import (
"context"
"fmt"
"regexp"
batchv1beta1 "k8s.io/api/batch/v1beta1"
v1 "k8s.io/api/core/v1"
@ -337,7 +338,8 @@ func (c *Cluster) syncStatefulSet() error {
if ToPropagateAnnotations != nil && PgCRDAnnotations != nil {
for _, anno := range ToPropagateAnnotations {
for k, v := range PgCRDAnnotations {
if k == anno {
matched, err := regexp.MatchString(anno, k)
if err == nil && matched {
annotations[k] = v
}
}