Skip to content
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

Merged
merged 1 commit into from
Aug 26, 2022

Conversation

qiangzii
Copy link
Contributor

@qiangzii qiangzii commented Aug 3, 2022

Signed-off-by: gangqiangwang gangqiangwang@yunify.com;

@qiangzii qiangzii force-pushed the master branch 3 times, most recently from 40f97f8 to d97e6ae Compare August 3, 2022 07:30
@qiangzii qiangzii force-pushed the master branch 8 times, most recently from 440586e to 29e947b Compare August 19, 2022 08:29


`Cluster`模式下,目前支持的 `service` 注解有:
- 使用指定Label的Worker节点作为后端服务器, `service.beta.kubernetes.io/qingcloud-lb-backend-label`,可以指定多个Label,多个Label以逗号分隔。例如:`key1=value1,key2=value2`,多个Label之间是And关系
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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 {
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的一些注释,意见和nodecluster部分一样。

@@ -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 {
Copy link
Contributor

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) 的场景。

}

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: enample

@qiangzii qiangzii force-pushed the master branch 2 times, most recently from b1f07cc to c2f6c04 Compare August 26, 2022 06:08
add backend label support for service;
add endpoint controller and cluster node controller;
Signed-off-by: gangqiangwang <gangqiangwang@yunify.com>;
@cumirror cumirror added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 26, 2022
@cumirror cumirror merged commit d993110 into yunify:master Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants