Skip to content

Commit 10e3636

Browse files
authored
Merge branch 'main' into separate
2 parents 99e8ee8 + a346805 commit 10e3636

File tree

7 files changed

+177
-165
lines changed

7 files changed

+177
-165
lines changed

bpf/kmesh/ads/include/circuit_breaker.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ static inline void update_cluster_active_connections(const struct cluster_stats_
5454
}
5555

5656
if (!stats) {
57-
BPF_LOG(ERR, CIRCUIT_BREAKER, "failed to get cluster stats");
57+
BPF_LOG(ERR, CIRCUIT_BREAKER, "failed to get cluster stats\n");
5858
return;
5959
}
6060
if (delta < 0 && -delta > stats->active_connections) {
61-
BPF_LOG(ERR, CIRCUIT_BREAKER, "invalid delta update");
61+
BPF_LOG(ERR, CIRCUIT_BREAKER, "invalid delta update\n");
6262
return;
6363
}
6464

@@ -68,7 +68,7 @@ static inline void update_cluster_active_connections(const struct cluster_stats_
6868
DEBUG,
6969
CIRCUIT_BREAKER,
7070
"update existing stats(netns_cookie = %lld, cluster_id = %ld), "
71-
"current active connections: %d",
71+
"current active connections: %d\n",
7272
key->netns_cookie,
7373
key->cluster_id,
7474
stats->active_connections);
@@ -92,23 +92,23 @@ static inline int on_cluster_sock_bind(ctx_buff_t *ctx, const Cluster__Cluster *
9292
DEBUG,
9393
CIRCUIT_BREAKER,
9494
"Current active connections %d exceeded max connections "
95-
"%d, reject connection",
95+
"%d, reject connection\n",
9696
stats->active_connections,
9797
cbs->max_connections);
9898
return -1;
9999
}
100100
}
101101

102-
BPF_LOG(DEBUG, CIRCUIT_BREAKER, "record sock bind for cluster id = %ld", cluster_id);
102+
BPF_LOG(DEBUG, CIRCUIT_BREAKER, "record sock bind for cluster id = %ld\n", cluster_id);
103103

104104
struct cluster_sock_data *data = NULL;
105105
if (!ctx->sk) {
106-
BPF_LOG(WARN, CIRCUIT_BREAKER, "provided sock is NULL");
106+
BPF_LOG(WARN, CIRCUIT_BREAKER, "provided sock is NULL\n");
107107
return 0;
108108
}
109109
data = bpf_sk_storage_get(&map_of_cluster_sock, ctx->sk, 0, BPF_LOCAL_STORAGE_GET_F_CREATE);
110110
if (!data) {
111-
BPF_LOG(ERR, CIRCUIT_BREAKER, "on_cluster_sock_bind call bpf_sk_storage_get failed");
111+
BPF_LOG(ERR, CIRCUIT_BREAKER, "on_cluster_sock_bind call bpf_sk_storage_get failed\n");
112112
return 0;
113113
}
114114
data->cluster_id = cluster_id;
@@ -119,7 +119,7 @@ static inline struct cluster_sock_data *get_cluster_sk_data(struct bpf_sock *sk)
119119
{
120120
struct cluster_sock_data *data = NULL;
121121
if (!sk) {
122-
BPF_LOG(DEBUG, CIRCUIT_BREAKER, "provided sock is NULL");
122+
BPF_LOG(DEBUG, CIRCUIT_BREAKER, "provided sock is NULL\n");
123123
return NULL;
124124
}
125125

@@ -144,11 +144,11 @@ static inline void on_cluster_sock_connect(struct bpf_sock_ops *ctx)
144144
DEBUG,
145145
CIRCUIT_BREAKER,
146146
"increase cluster active connections(netns_cookie = %lld, cluster "
147-
"id = %ld)",
147+
"id = %ld)\n",
148148
key.netns_cookie,
149149
key.cluster_id);
150150
update_cluster_active_connections(&key, 1);
151-
BPF_LOG(DEBUG, CIRCUIT_BREAKER, "record sock connection for cluster id = %ld", data->cluster_id);
151+
BPF_LOG(DEBUG, CIRCUIT_BREAKER, "record sock connection for cluster id = %ld\n", data->cluster_id);
152152
}
153153

154154
static inline void on_cluster_sock_close(struct bpf_sock_ops *ctx)
@@ -169,10 +169,10 @@ static inline void on_cluster_sock_close(struct bpf_sock_ops *ctx)
169169
DEBUG,
170170
CIRCUIT_BREAKER,
171171
"decrease cluster active connections(netns_cookie = %lld, cluster "
172-
"id = %ld)",
172+
"id = %ld)\n",
173173
key.netns_cookie,
174174
key.cluster_id);
175-
BPF_LOG(DEBUG, CIRCUIT_BREAKER, "record sock close for cluster id = %ld", data->cluster_id);
175+
BPF_LOG(DEBUG, CIRCUIT_BREAKER, "record sock close for cluster id = %ld\n", data->cluster_id);
176176
}
177177

178178
#endif

bpf/kmesh/ads/include/ctx/sock_ops.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ typedef struct bpf_sock_ops ctx_buff_t;
2323
#define SET_CTX_ADDRESS(ctx, address) \
2424
(ctx)->remote_ip4 = (address)->ipv4; \
2525
(ctx)->remote_port = (address)->port
26+
#endif
2627

2728
#define MARK_REJECTED(ctx) \
28-
BPF_LOG(DEBUG, KMESH, "mark reject"); \
29+
BPF_LOG(DEBUG, KMESH, "mark reject\n"); \
2930
(ctx)->remote_ip4 = 0; \
3031
(ctx)->remote_port = 0
31-
#else
32-
#define MARK_REJECTED(ctx)
33-
#endif
3432

3533
#endif //__BPF_CTX_SOCK_OPS_H

docs/kmesh_compile.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,19 @@ The Kmesh needs to be compiled and built in the Linux environment with the Kmesh
3232

3333
- Code compilation
3434

35+
Note: Make sure to run the given command as the root user.
36+
3537
```sh
3638
[root@dev tmp]# cd kmesh/
3739
[root@dev Kmesh]# make build
3840
```
3941

42+
After running the build command, some files may change, so make sure to run the following command to restore them
43+
44+
```sh
45+
[root@dev Kmesh]# make clean
46+
```
47+
4048
Kmesh will be compiled and built within the build image, and the build artifacts will be output to the `out` directory.
4149

4250
```bash

docs/kmesh_deploy_and_develop_in_kind.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ You can follow the steps below to develop in kind:
7070
7171
+ Build your code locally:
7272
73+
Note: Make sure to run the given command as the root user.
74+
7375
```shell
7476
make build
7577
```

go.mod

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ require (
1111
github.com/cilium/ebpf v0.16.0
1212
github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78
1313
github.com/containernetworking/cni v1.2.3
14-
github.com/containernetworking/plugins v1.5.1
15-
github.com/envoyproxy/go-control-plane v0.13.1-0.20240823165802-4363a624d376
14+
github.com/containernetworking/plugins v1.6.0
15+
github.com/envoyproxy/go-control-plane v0.13.2-0.20241022220226-23b7e55d7f65
1616
github.com/fsnotify/fsnotify v1.7.0
1717
github.com/hashicorp/go-multierror v1.1.1
1818
github.com/miekg/dns v1.1.62
19-
github.com/prometheus/client_golang v1.20.4
19+
github.com/prometheus/client_golang v1.20.5
2020
github.com/prometheus/common v0.60.1
2121
github.com/sirupsen/logrus v1.9.3
2222
github.com/spf13/cobra v1.8.1
@@ -27,8 +27,8 @@ require (
2727
google.golang.org/protobuf v1.35.1
2828
gopkg.in/natefinch/lumberjack.v2 v2.2.1
2929
gotest.tools v2.2.0+incompatible
30-
istio.io/api v1.23.0-alpha.0.0.20241007133624-bfb6855a7760
31-
istio.io/istio v0.0.0-20241013024925-e3b7c36c24a0
30+
istio.io/api v1.24.0-alpha.0.0.20241028175955-5ef47d381d4d
31+
istio.io/istio v0.0.0-20241031065350-9bab4dd8c119
3232
istio.io/pkg v0.0.0-20231221211216-7635388a563e
3333
k8s.io/api v0.31.2
3434
k8s.io/apimachinery v0.31.2
@@ -39,12 +39,12 @@ require (
3939

4040
require (
4141
cel.dev/expr v0.16.0 // indirect
42-
cloud.google.com/go v0.115.0 // indirect
43-
cloud.google.com/go/auth v0.7.0 // indirect
44-
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
42+
cloud.google.com/go v0.115.1 // indirect
43+
cloud.google.com/go/auth v0.9.3 // indirect
44+
cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect
4545
cloud.google.com/go/compute/metadata v0.5.2 // indirect
46-
cloud.google.com/go/logging v1.10.0 // indirect
47-
cloud.google.com/go/longrunning v0.5.9 // indirect
46+
cloud.google.com/go/logging v1.11.0 // indirect
47+
cloud.google.com/go/longrunning v0.5.12 // indirect
4848
dario.cat/mergo v1.0.1 // indirect
4949
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
5050
github.com/BurntSushi/toml v1.3.2 // indirect
@@ -73,7 +73,7 @@ require (
7373
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
7474
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
7575
github.com/fatih/camelcase v1.0.0 // indirect
76-
github.com/fatih/color v1.17.0 // indirect
76+
github.com/fatih/color v1.18.0 // indirect
7777
github.com/felixge/httpsnoop v1.0.4 // indirect
7878
github.com/florianl/go-nflog/v2 v2.1.0 // indirect
7979
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
@@ -97,11 +97,11 @@ require (
9797
github.com/google/go-containerregistry v0.20.2 // indirect
9898
github.com/google/gofuzz v1.2.0 // indirect
9999
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect
100-
github.com/google/s2a-go v0.1.7 // indirect
100+
github.com/google/s2a-go v0.1.8 // indirect
101101
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
102102
github.com/google/uuid v1.6.0 // indirect
103-
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
104-
github.com/googleapis/gax-go/v2 v2.12.5 // indirect
103+
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
104+
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
105105
github.com/gorilla/websocket v1.5.3 // indirect
106106
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
107107
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
@@ -132,7 +132,7 @@ require (
132132
github.com/mattn/go-isatty v0.0.20 // indirect
133133
github.com/mattn/go-runewidth v0.0.15 // indirect
134134
github.com/mdlayher/netlink v1.7.2 // indirect
135-
github.com/mdlayher/socket v0.5.0 // indirect
135+
github.com/mdlayher/socket v0.5.1 // indirect
136136
github.com/mitchellh/copystructure v1.2.0 // indirect
137137
github.com/mitchellh/go-homedir v1.1.0 // indirect
138138
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
@@ -145,21 +145,21 @@ require (
145145
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
146146
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
147147
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
148-
github.com/onsi/ginkgo/v2 v2.20.1 // indirect
148+
github.com/onsi/ginkgo/v2 v2.20.2 // indirect
149149
github.com/opencontainers/go-digest v1.0.0 // indirect
150150
github.com/opencontainers/image-spec v1.1.0 // indirect
151-
github.com/openshift/api v0.0.0-20241003161011-3f43768f3915 // indirect
151+
github.com/openshift/api v0.0.0-20241024191314-684b2b1679ba // indirect
152152
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
153153
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
154-
github.com/pires/go-proxyproto v0.7.0 // indirect
154+
github.com/pires/go-proxyproto v0.8.0 // indirect
155155
github.com/pkg/errors v0.9.1 // indirect
156156
github.com/planetscale/vtprotobuf v0.6.1-0.20240409071808-615f978279ca // indirect
157157
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
158158
github.com/prometheus/client_model v0.6.1 // indirect
159159
github.com/prometheus/procfs v0.15.1 // indirect
160-
github.com/prometheus/prometheus v0.54.1 // indirect
160+
github.com/prometheus/prometheus v0.55.0 // indirect
161161
github.com/quic-go/qpack v0.5.1 // indirect
162-
github.com/quic-go/quic-go v0.47.0 // indirect
162+
github.com/quic-go/quic-go v0.48.1 // indirect
163163
github.com/rivo/uniseg v0.4.6 // indirect
164164
github.com/russross/blackfriday/v2 v2.1.0 // indirect
165165
github.com/ryanuber/go-glob v1.0.0 // indirect
@@ -184,53 +184,53 @@ require (
184184
go.opencensus.io v0.24.0 // indirect
185185
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect
186186
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
187-
go.opentelemetry.io/otel v1.30.0 // indirect
188-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0 // indirect
189-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.30.0 // indirect
190-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.30.0 // indirect
191-
go.opentelemetry.io/otel/exporters/prometheus v0.52.0 // indirect
192-
go.opentelemetry.io/otel/metric v1.30.0 // indirect
193-
go.opentelemetry.io/otel/sdk v1.30.0 // indirect
194-
go.opentelemetry.io/otel/sdk/metric v1.30.0 // indirect
195-
go.opentelemetry.io/otel/trace v1.30.0 // indirect
187+
go.opentelemetry.io/otel v1.31.0 // indirect
188+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
189+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect
190+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect
191+
go.opentelemetry.io/otel/exporters/prometheus v0.53.0 // indirect
192+
go.opentelemetry.io/otel/metric v1.31.0 // indirect
193+
go.opentelemetry.io/otel/sdk v1.31.0 // indirect
194+
go.opentelemetry.io/otel/sdk/metric v1.31.0 // indirect
195+
go.opentelemetry.io/otel/trace v1.31.0 // indirect
196196
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
197197
go.starlark.net v0.0.0-20231121155337-90ade8b19d09 // indirect
198198
go.uber.org/atomic v1.11.0 // indirect
199199
go.uber.org/mock v0.4.0 // indirect
200200
go.uber.org/multierr v1.11.0 // indirect
201201
go.uber.org/zap v1.27.0 // indirect
202-
golang.org/x/crypto v0.27.0 // indirect
202+
golang.org/x/crypto v0.28.0 // indirect
203203
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
204204
golang.org/x/mod v0.21.0 // indirect
205-
golang.org/x/net v0.29.0 // indirect
205+
golang.org/x/net v0.30.0 // indirect
206206
golang.org/x/oauth2 v0.23.0 // indirect
207207
golang.org/x/sync v0.8.0 // indirect
208-
golang.org/x/sys v0.25.0 // indirect
209-
golang.org/x/term v0.24.0 // indirect
210-
golang.org/x/text v0.18.0 // indirect
211-
golang.org/x/time v0.6.0 // indirect
208+
golang.org/x/sys v0.26.0 // indirect
209+
golang.org/x/term v0.25.0 // indirect
210+
golang.org/x/text v0.19.0 // indirect
211+
golang.org/x/time v0.7.0 // indirect
212212
golang.org/x/tools v0.25.0 // indirect
213213
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
214-
google.golang.org/api v0.188.0 // indirect
215-
google.golang.org/genproto v0.0.0-20240708141625-4ad9e859172b // indirect
216-
google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f // indirect
217-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect
214+
google.golang.org/api v0.195.0 // indirect
215+
google.golang.org/genproto v0.0.0-20240823204242-4ba0660f739c // indirect
216+
google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 // indirect
217+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
218218
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
219219
gopkg.in/inf.v0 v0.9.1 // indirect
220220
gopkg.in/ini.v1 v1.67.0 // indirect
221221
gopkg.in/yaml.v2 v2.4.0 // indirect
222222
gopkg.in/yaml.v3 v3.0.1 // indirect
223-
helm.sh/helm/v3 v3.16.1 // indirect
224-
istio.io/client-go v1.23.0-alpha.0.0.20241007133923-6216dcee5376 // indirect
225-
k8s.io/apiextensions-apiserver v0.31.1 // indirect
226-
k8s.io/apiserver v0.31.1 // indirect
227-
k8s.io/cli-runtime v0.31.1 // indirect
228-
k8s.io/component-base v0.31.1 // indirect
223+
helm.sh/helm/v3 v3.16.2 // indirect
224+
istio.io/client-go v1.24.0-alpha.0.0.20241028180353-8402bc51af81 // indirect
225+
k8s.io/apiextensions-apiserver v0.31.2 // indirect
226+
k8s.io/apiserver v0.31.2 // indirect
227+
k8s.io/cli-runtime v0.31.2 // indirect
228+
k8s.io/component-base v0.31.2 // indirect
229229
k8s.io/klog/v2 v2.130.1 // indirect
230230
k8s.io/kube-openapi v0.0.0-20240423202451-8948a665c108 // indirect
231-
k8s.io/kubectl v0.31.1 // indirect
231+
k8s.io/kubectl v0.31.2 // indirect
232232
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 // indirect
233-
sigs.k8s.io/controller-runtime v0.19.0 // indirect
233+
sigs.k8s.io/controller-runtime v0.19.1 // indirect
234234
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
235235
sigs.k8s.io/kustomize/api v0.17.2 // indirect
236236
sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect

0 commit comments

Comments
 (0)