Skip to content

Commit 8d555ae

Browse files
committed
fix: change the offline client from seed peer to peer
Signed-off-by: BruceAko <chongzhi@hust.edu.cn>
1 parent 61e0147 commit 8d555ae

File tree

8 files changed

+58
-13
lines changed

8 files changed

+58
-13
lines changed

.github/workflows/e2e-v2-nydus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
KIND_VERSION: v0.12.0
1919
CONTAINERD_VERSION: v1.5.2
2020
NERDCTL_VER: 0.22.2
21-
KIND_CONFIG_PATH: test/testdata/kind/config-v2.yaml
21+
KIND_CONFIG_PATH: test/testdata/kind/config-v2-nydus.yaml
2222
DRAGONFLY_CHARTS_PATH: deploy/helm-charts/charts/dragonfly
2323
NYDUS_SNAPSHOTTER_CHARTS_PATH: deploy/helm-charts/charts/nydus-snapshotter
2424

.github/workflows/e2e-v2.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
include:
3232
- module: normal
3333
charts-config: test/testdata/charts/config-v2.yaml
34-
skip: ""
34+
skip: "Clients go offline normally and abnormally"
3535

3636
steps:
3737
- name: Free Disk Space (Ubuntu)
@@ -113,12 +113,9 @@ jobs:
113113
config: ${{ env.KIND_CONFIG_PATH }}
114114
cluster_name: kind
115115

116-
- name: Kind load images
116+
- name: Add taint to node
117117
run: |
118-
kind load docker-image dragonflyoss/manager:latest
119-
kind load docker-image dragonflyoss/scheduler:latest
120-
kind load docker-image dragonflyoss/client:latest
121-
kind load docker-image dragonflyoss/dfinit:latest
118+
kubectl taint nodes kind-worker2 key=value:NoSchedule
122119
123120
- name: Setup dragonfly
124121
run: |

test/e2e/v2/leave_host_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ var _ = Describe("Clients go offline normally and abnormally", func() {
3636
It("number of hosts should be ok", Label("host", "leave"), func() {
3737
getHostCountFromScheduler := func(schedulerClient schedulerclient.V2) (hostCount int) {
3838
response, err := schedulerClient.ListHosts(context.Background())
39+
fmt.Println("response:")
3940
fmt.Println(response, err)
4041
Expect(err).NotTo(HaveOccurred())
4142

@@ -58,15 +59,15 @@ var _ = Describe("Clients go offline normally and abnormally", func() {
5859
hostCount := util.Servers[util.SeedClientServerName].Replicas + util.Servers[util.ClientServerName].Replicas
5960
Expect(getHostCountFromScheduler(schedulerClient)).To(Equal(hostCount))
6061

61-
podName, err := util.GetClientPodName()
62+
podName, err := util.GetClientPodName(1)
6263
Expect(err).NotTo(HaveOccurred())
6364

6465
out, err := util.KubeCtlCommand("-n", util.DragonflyNamespace, "delete", "pod", podName).CombinedOutput()
6566
fmt.Println(string(out))
6667
Expect(err).NotTo(HaveOccurred())
6768
Expect(getHostCountFromScheduler(schedulerClient)).To(Equal(hostCount))
6869

69-
podName, err = util.GetClientPodName()
70+
podName, err = util.GetClientPodName(1)
7071
Expect(err).NotTo(HaveOccurred())
7172

7273
out, err = util.KubeCtlCommand("-n", util.DragonflyNamespace, "delete", "pod", podName, "--force", "--grace-period=0").CombinedOutput()

test/e2e/v2/util/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ var Servers = map[string]server{
5757
Name: ClientServerName,
5858
Namespace: DragonflyNamespace,
5959
LogDirName: "dfdaemon",
60-
Replicas: 1,
60+
Replicas: 2,
6161
},
6262
}

test/e2e/v2/util/exec.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func KubeCtlCopyCommand(ns, pod, source, target string) *exec.Cmd {
103103
}
104104

105105
func ClientExec() (*PodExec, error) {
106-
podName, err := GetClientPodName()
106+
podName, err := GetClientPodName(0)
107107
if err != nil {
108108
return nil, err
109109
}
@@ -126,9 +126,9 @@ func ManagerExec(n int) (*PodExec, error) {
126126
return NewPodExec(DragonflyNamespace, podName, "manager"), nil
127127
}
128128

129-
func GetClientPodName() (string, error) {
129+
func GetClientPodName(n int) (string, error) {
130130
out, err := KubeCtlCommand("-n", DragonflyNamespace, "get", "pod", "-l", "component=client",
131-
"-o", fmt.Sprintf("jsonpath='{range .items[0]}{.metadata.name}{end}'")).CombinedOutput()
131+
"-o", fmt.Sprintf("jsonpath='{range .items[%d]}{.metadata.name}{end}'", n)).CombinedOutput()
132132
if err != nil {
133133
return "", err
134134
}

test/testdata/charts/config-v2.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ client:
114114
limits:
115115
cpu: "2"
116116
memory: "4Gi"
117+
tolerations:
118+
- key: "key"
119+
operator: "Equal"
120+
value: "value"
121+
effect: "NoSchedule"
117122
extraVolumeMounts:
118123
- name: logs
119124
mountPath: "/var/log/"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
kind: Cluster
2+
apiVersion: kind.x-k8s.io/v1alpha4
3+
networking:
4+
ipFamily: dual
5+
nodes:
6+
- role: control-plane
7+
image: kindest/node:v1.23.4
8+
extraPortMappings:
9+
- containerPort: 4001
10+
hostPort: 4001
11+
protocol: TCP
12+
- containerPort: 4003
13+
hostPort: 4003
14+
protocol: TCP
15+
- containerPort: 30802
16+
hostPort: 8002
17+
protocol: TCP
18+
extraMounts:
19+
- hostPath: ./test/testdata/containerd/config-v2.toml
20+
containerPath: /etc/containerd/config.toml
21+
- hostPath: /tmp/artifact
22+
containerPath: /tmp/artifact
23+
- hostPath: /dev/fuse
24+
containerPath: /dev/fuse

test/testdata/kind/config-v2.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ networking:
44
ipFamily: dual
55
nodes:
66
- role: control-plane
7+
image: kindest/node:v1.23.4
8+
extraMounts:
9+
- hostPath: ./test/testdata/containerd/config-v2.toml
10+
containerPath: /etc/containerd/config.toml
11+
- hostPath: /tmp/artifact
12+
containerPath: /tmp/artifact
13+
- hostPath: /dev/fuse
14+
containerPath: /dev/fuse
15+
- role: worker
716
image: kindest/node:v1.23.4
817
extraPortMappings:
918
- containerPort: 4001
@@ -22,3 +31,12 @@ nodes:
2231
containerPath: /tmp/artifact
2332
- hostPath: /dev/fuse
2433
containerPath: /dev/fuse
34+
- role: worker
35+
image: kindest/node:v1.23.4
36+
extraMounts:
37+
- hostPath: ./test/testdata/containerd/config-v2.toml
38+
containerPath: /etc/containerd/config.toml
39+
- hostPath: /tmp/artifact
40+
containerPath: /tmp/artifact
41+
- hostPath: /dev/fuse
42+
containerPath: /dev/fuse

0 commit comments

Comments
 (0)