-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add externalTrafficPolicy feature support for service #126
Conversation
40f97f8
to
d97e6ae
Compare
440586e
to
29e947b
Compare
docs/configure.md
Outdated
|
||
|
||
`Cluster`模式下,目前支持的 `service` 注解有: | ||
- 使用指定Label的Worker节点作为后端服务器, `service.beta.kubernetes.io/qingcloud-lb-backend-label`,可以指定多个Label,多个Label以逗号分隔。例如:`key1=value1,key2=value2`,多个Label之间是And关系 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里对svc的注解做了说明和示例,需要添加node上的label说明和示例,并描述svc label里多个kv时的匹配策略。
return nil, true, nil | ||
} | ||
|
||
// producer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个注释看着没有意义,是否去掉。
cnc.nodeQueue.Add(key) | ||
} | ||
|
||
// consumer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
去掉。
|
||
const ( | ||
clusterNodeSyncPeriod = 30 * time.Second | ||
clusterNodeWorkers = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10个线程是否有点多,一般是1个或3个。如果worker中有任务会等待较长时间则需要注意。
return true | ||
} | ||
|
||
for newLabelKey, newLabelValue := range new.Labels { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的判断是否更细一些:判断 service.beta.kubernetes.io/qingcloud-lb-backend-label 的变化。
return nil, true, nil | ||
} | ||
|
||
// producer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的一些注释,意见和nodecluster部分一样。
pkg/qingcloud/qingcloud.go
Outdated
@@ -189,6 +194,17 @@ func (qc *QingCloud) getLoadBalancer(service *v1.Service) (*LoadBalancerConfig, | |||
func (qc *QingCloud) EnsureLoadBalancer(ctx context.Context, _ string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error) { | |||
conf, lb, err := qc.getLoadBalancer(service) | |||
klog.V(4).Infof("==== EnsureLoadBalancer %s config %s ====", spew.Sdump(lb), spew.Sdump(conf)) | |||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里在后续考虑lb找不到的场景 errors.IsResourceNotFound(err)。所以要提前退出时,可以判断是否是 errors.IsResourceNotFound(err) 的场景。
pkg/qingcloud/qingcloud.go
Outdated
} | ||
|
||
if len(toAdd) == 0 && len(toDelete) == 0 && modify == false { | ||
klog.Infof("Skip UpdateLB for loadbalancers %s", *lb.Status.LoadBalancerID) | ||
//update backend; for enample, service annotation for backend label changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: enample
b1f07cc
to
c2f6c04
Compare
add backend label support for service; add endpoint controller and cluster node controller; Signed-off-by: gangqiangwang <gangqiangwang@yunify.com>;
Signed-off-by: gangqiangwang gangqiangwang@yunify.com;