Skip to content

Commit 80495ac

Browse files
committed
update proposal
Signed-off-by: Tom <[email protected]>
1 parent 33fd691 commit 80495ac

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

config/kmesh_marcos_def.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
* and sidecar containers. The bpf_sk_original_addr auxiliary function is
1515
* used to obtain the original destination address.
1616
*/
17-
#define MDA_NAT_ACCEL 1
17+
#define MDA_NAT_ACCEL 0
1818

1919
/* supports acceleration function filtering based on GID and UID.
2020
* That is, the GID or UID corresponding to the process to be accelerated
2121
* is configured in the configuration file. The bpf_get_sockops_uid_gid
2222
* auxiliary function is used to obtain the GID and UID of the current
2323
* process.
2424
*/
25-
#define MDA_GID_UID_FILTER 1
25+
#define MDA_GID_UID_FILTER 0
2626

2727
/*
2828
* openEuler-23.03 is an innovative version of openEuler, in the early time, we
@@ -67,4 +67,4 @@
6767
* the libbpf version in the current environment, and the code in the project
6868
* is enabled accordingly.
6969
* */
70-
#define LIBBPF_HIGHER_0_6_0_VERSION 0
70+
#define LIBBPF_HIGHER_0_6_0_VERSION 1

docs/proposal/dual_engine_dns.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,23 @@ func (p *Processor) handleServicesAndWorkloads(services []*workloadapi.Service,
176176
p.DnsResolverChan <- workloads
177177
}
178178
go func() {
179-
maxRetries := 30
179+
maxRetries := 50
180+
var address [][]byte
180181
for range maxRetries {
181182
workload := p.WorkloadCache.GetWorkloadByUid(uid)
182-
address := workload.GetAddresses()
183-
if address != nil {
184-
if err := p.handleWorkload(workload); err != nil {
185-
log.Errorf("handle workload %s failed, err: %v", workload.ResourceName(), err)
186-
}
183+
if address = workload.GetAddresses(); address != nil {
187184
break
188185
} else {
189-
log.Warnf("workload: %s/%s addresses is still nil, retrying...", workload.Namespace, workload.Name)
186+
time.Sleep(WorkloadDnsRefreshRate)
190187
}
191-
time.Sleep(1 * time.Second)
188+
}
189+
if address != nil {
190+
log.Infof("workload: %s/%s addresses resolved: %v", workload.Namespace, workload.Name, address)
191+
if err := p.handleWorkload(workload); err != nil {
192+
log.Errorf("handle workload %s failed, err: %v", workload.ResourceName(), err)
193+
}
194+
} else {
195+
log.Warnf("workload: %s/%s addresses is still nil after %d retries, skipping", workload.Namespace, workload.Name, maxRetries)
192196
}
193197
}()
194198
// wait for the service entry to be resolved
@@ -201,6 +205,12 @@ func (p *Processor) handleServicesAndWorkloads(services []*workloadapi.Service,
201205
}
202206
```
203207

208+
Overall, the DNS logic under the Dual-engine mode is roughly illustrated in the block diagram below.
209+
210+
![](./pics/dual-engine-dns.png)
211+
212+
As mentioned earlier, this implementation largely mirrors the DNS logic in AdsController, resulting in significant structural redundancy. Therefore, after the Step-1 we need to further abstract the current DNS logic. As shown in the diagram, both WorkerController and DnsResolver are already cohesive and self-contained; however, the interface layer highlighted in orange differs across modes. Subsequent refactoring will attempt to treat Cluster or Workload as first-class entities—load objects that Controller and DnsController (Resolver) interact with directly—thereby achieving looser coupling.
213+
204214
#### Test Plan
205215

206216
<!--
113 KB
Loading

mk/api-v2-c.pc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
prefix=
1+
prefix=/kmesh/
22

33
Name: api-v2-c
44
Description: api-v2-c

mk/bpf.pc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
prefix=
1+
prefix=/kmesh/
22
Name: bpf
33
Description: bpf
44
Version:

0 commit comments

Comments
 (0)