generate clusterEvent queue key in a separate function

This commit is contained in:
Murat Kabilov 2017-08-17 12:20:03 +02:00
parent 5967837875
commit f2c23021bb
1 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"github.com/Sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
@ -169,7 +170,7 @@ func (c *Controller) initController() {
return "", fmt.Errorf("could not cast to ClusterEvent")
}
return fmt.Sprintf("%s-%s", e.EventType, e.UID), nil
return queueClusterKey(e.EventType, e.UID), nil
})
}
@ -206,3 +207,7 @@ func (c *Controller) runPostgresqlInformer(stopCh <-chan struct{}, wg *sync.Wait
c.postgresqlInformer.Run(stopCh)
}
func queueClusterKey(eventType spec.EventType, uid types.UID) string {
return fmt.Sprintf("%s-%s", eventType, uid)
}