This commit is contained in:
@@ -147,6 +147,10 @@ func (s *Speaker) sync(ctx context.Context, key string) error {
|
||||
s.stopLeading(key, vip)
|
||||
return nil
|
||||
}
|
||||
if owner := serviceOwnerNode(svc); owner != "" && owner != s.nodeName {
|
||||
s.stopLeading(key, vip)
|
||||
return nil
|
||||
}
|
||||
|
||||
leaseName := leaseNameFor(key)
|
||||
leader, err := s.acquireLease(ctx, leaseName, vip)
|
||||
@@ -161,6 +165,13 @@ func (s *Speaker) sync(ctx context.Context, key string) error {
|
||||
return s.ensureVIP(vip)
|
||||
}
|
||||
|
||||
func serviceOwnerNode(svc *corev1.Service) string {
|
||||
if svc == nil || svc.Annotations == nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(svc.Annotations[kloudlb.AnnotationNode])
|
||||
}
|
||||
|
||||
func serviceExternalVIP(svc *corev1.Service) string {
|
||||
if svc.Annotations != nil {
|
||||
if vip := strings.TrimSpace(svc.Annotations[kloudlb.AnnotationVIP]); vip != "" {
|
||||
|
||||
Reference in New Issue
Block a user