Skip to content

Commit

Permalink
fix: list hosts
Browse files Browse the repository at this point in the history
Signed-off-by: BruceAko <chongzhi@hust.edu.cn>
  • Loading branch information
BruceAko committed Oct 6, 2024
1 parent b9cf420 commit e3c0864
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/e2e-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:
env:
KIND_VERSION: v0.12.0
CONTAINERD_VERSION: v1.5.2
KIND_CONFIG_PATH: test/testdata/kind/config-v2.yaml
KIND_CONFIG_PATH: test/testdata/kind/config-v2-nydus.yaml
DRAGONFLY_CHARTS_PATH: deploy/helm-charts/charts/dragonfly
DRAGONFLY_FILE_SERVER_PATH: test/testdata/k8s/file-server.yaml

Expand Down Expand Up @@ -113,10 +113,6 @@ jobs:
config: ${{ env.KIND_CONFIG_PATH }}
cluster_name: kind

- name: Add taint to node
run: |
kubectl taint nodes kind-worker2 key=value:NoSchedule
- name: Setup dragonfly
run: |
helm install --wait --timeout 15m --dependency-update --create-namespace --namespace dragonfly-system -f ${{ matrix.charts-config }} dragonfly ${{ env.DRAGONFLY_CHARTS_PATH }}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rpc/scheduler/client/client_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (v *v2) ListHosts(ctx context.Context, opts ...grpc.CallOption) (*scheduler
defer cancel()

return v.SchedulerClient.ListHosts(
context.WithValue(ctx, pkgbalancer.ContextKey, ""),
context.WithValue(ctx, pkgbalancer.ContextKey, "123"),
new(emptypb.Empty),
opts...,
)
Expand Down
4 changes: 4 additions & 0 deletions scheduler/service/service_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,10 @@ func (v *V2) ListHosts(ctx context.Context) (*schedulerv2.ListHostsResponse, err
DisableShared: host.DisableShared,
}
}
resHosts = append(resHosts, &commonv2.Host{
Id: "我自己添加的",
Type: uint32(len(hosts)),
})

resp := &schedulerv2.ListHostsResponse{
Hosts: resHosts,
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/v2/leave_host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var _ = Describe("Clients go offline normally and abnormally", func() {
fmt.Println("hostCount:", hostCount, getHostCountFromScheduler(schedulerClient))
//Expect(getHostCountFromScheduler(schedulerClient)).To(Equal(hostCount))

podName, err := util.GetClientPodName(1)
podName, err := util.GetClientPodName(0)
Expect(err).NotTo(HaveOccurred())

out, err := util.KubeCtlCommand("-n", util.DragonflyNamespace, "delete", "pod", podName).CombinedOutput()
Expand All @@ -69,7 +69,7 @@ var _ = Describe("Clients go offline normally and abnormally", func() {
fmt.Println("hostCount:", hostCount, getHostCountFromScheduler(schedulerClient))
//Expect(getHostCountFromScheduler(schedulerClient)).To(Equal(hostCount))

podName, err = util.GetClientPodName(1)
podName, err = util.GetClientPodName(0)
Expect(err).NotTo(HaveOccurred())

out, err = util.KubeCtlCommand("-n", util.DragonflyNamespace, "delete", "pod", podName, "--force", "--grace-period=0").CombinedOutput()
Expand Down
2 changes: 1 addition & 1 deletion test/testdata/charts/config-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ scheduler:
memory: "4Gi"
service:
type: NodePort
nodePort: 30802
nodePort: 30804
extraVolumeMounts:
- name: logs
mountPath: "/var/log/"
Expand Down
4 changes: 2 additions & 2 deletions test/testdata/kind/config-v2-nydus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ nodes:
- containerPort: 4003
hostPort: 4003
protocol: TCP
- containerPort: 30802
hostPort: 8002
- containerPort: 30804
hostPort: 8004
protocol: TCP
extraMounts:
- hostPath: ./test/testdata/containerd/config-v2.toml
Expand Down
4 changes: 2 additions & 2 deletions test/testdata/kind/config-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ nodes:
- containerPort: 4003
hostPort: 4003
protocol: TCP
- containerPort: 30802
hostPort: 8002
- containerPort: 30804
hostPort: 8004
protocol: TCP
extraMounts:
- hostPath: ./test/testdata/containerd/config-v2.toml
Expand Down

0 comments on commit e3c0864

Please sign in to comment.