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

lazyload: report accesslog to leader #349

Merged
merged 1 commit into from
May 12, 2023

Conversation

MouceL
Copy link
Contributor

@MouceL MouceL commented Apr 25, 2023

之前存在的问题是:懒加载开启多副本模式时,global-sidecar的accesslog会上报至svc:lazyload.mesh-operator

但service后挂在多个pods,其中只有一个是主,用于真正处理accesslog, 那么上报至非主pods的accesslog并不能被处理

本MR实现以下内容:

如果开启多副本,会额外创建一个svc, 其selector如下

apiVersion: v1
kind: Service
metadata:
  labels:
    app: lazyload
  name: lazyload-leader
  namespace: mesh-operator
spec:
  ports:
  ...
  selector:
    app: lazyload
    slime.io/leader: "true"
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}

成为主的pods会给自己加上label,并在退出时移除该labels

slime.io/leader: "true"

而global-sidecar中remote accesslog server的地址为 lazyload-leader.mesh-operator

这样就可以保证每次上报的accesslog都只会被主pods接收。

@MouceL MouceL force-pushed the fix-leader-accesslog branch 2 times, most recently from 223e3c3 to a8bbbbe Compare April 25, 2023 11:38
@MouceL MouceL requested a review from YonkaFang April 25, 2023 11:40
@MouceL MouceL marked this pull request as draft April 25, 2023 12:11
@MouceL MouceL marked this pull request as ready for review April 26, 2023 04:12
@MouceL MouceL marked this pull request as draft April 26, 2023 08:23
@MouceL MouceL marked this pull request as ready for review May 4, 2023 05:53
@MouceL MouceL changed the title lazyload: add labels in leading pods lazyload: report accesslog to leader May 8, 2023
@YonkaFang YonkaFang added the config_change involve config changes label May 10, 2023
@MouceL MouceL requested a review from believening May 10, 2023 06:37
@YonkaFang YonkaFang merged commit 67380da into slime-io:master May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config_change involve config changes doc_later
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants