aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuabingZhao <zhao.huabing@zte.com.cn>2018-03-01 07:22:55 +0000
committerHuabingZhao <zhao.huabing@zte.com.cn>2018-03-01 07:22:59 +0000
commitf482dbecbe879489753d16798919a014df9ac001 (patch)
tree0e0446cdf6c903119d1076145c4b8938c46a245c
parent3bccda29cfbbb2048f74a608fa02772e51155ec3 (diff)
Register cluster IP instead of external IP
Issue-ID: MSB-153 Change-Id: Id8cd23ac0ab30a7467eebc7f59ad9dd28d22f317 Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
-rw-r--r--src/kube2msb/kube_work.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/kube2msb/kube_work.go b/src/kube2msb/kube_work.go
index 07a2e63..b7965b5 100644
--- a/src/kube2msb/kube_work.go
+++ b/src/kube2msb/kube_work.go
@@ -60,20 +60,13 @@ func (client *ClientBookKeeper) AddService(svc *kapi.Service) {
}
if kapi.IsServiceIPSet(svc) {
- if svc.Spec.Type == kapi.ServiceTypeClusterIP || svc.Spec.Type == kapi.ServiceTypeNodePort {
+ if svc.Spec.Type == kapi.ServiceTypeClusterIP || svc.Spec.Type == kapi.ServiceTypeNodePort || svc.Spec.Type == kapi.ServiceTypeLoadBalancer {
log.Printf("Adding %s service:%s", svc.Spec.Type, svc.Name)
client.msbQueue <- MSBWork{
Action: MSBWorkAddService,
ServiceInfo: svc.ObjectMeta.Annotations[serviceKey],
IPAddress: svc.Spec.ClusterIP,
}
- } else if svc.Spec.Type == kapi.ServiceTypeLoadBalancer {
- log.Println("Adding LoadBalancerIP service:", svc.Name)
- client.msbQueue <- MSBWork{
- Action: MSBWorkAddService,
- ServiceInfo: svc.ObjectMeta.Annotations[serviceKey],
- IPAddress: svc.Spec.LoadBalancerIP,
- }
} else {
log.Printf("Service Type:%s for Service:%s is not supported", svc.Spec.Type, svc.Name)
return
@@ -178,7 +171,7 @@ func (client *ClientBookKeeper) RemovePod(pod *kapi.Pod) {
client.msbQueue <- MSBWork{
Action: MSBWorkRemovePod,
ServiceInfo: pod.Annotations[serviceKey],
- IPAddress: client.pods[pod.Name].Status.PodIP,
+ IPAddress: client.pods[pod.Name].Status.PodIP,
}
delete(client.pods, pod.Name)
log.Println("Queued Pod to be removed: ", pod.Name)