Skip to content

Commit

Permalink
pkg/util: Add endpoints to redirector
Browse files Browse the repository at this point in the history
- Add UpdateEphemeralMounts and RemoveStaleVirtiofsShareMounts
to redirector, proxy_test and shim_test
to stay compatible with kata-agent protos

Signed-off-by: stevenhorsman <[email protected]>
  • Loading branch information
stevenhorsman committed Jun 8, 2023
1 parent 478f9b5 commit f4e4767
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/adaptor/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ func (m *agentMock) WaitProcess(ctx context.Context, req *pb.WaitProcessRequest)
func (m *agentMock) UpdateContainer(ctx context.Context, req *pb.UpdateContainerRequest) (*types.Empty, error) {
return &types.Empty{}, nil
}
func (m *agentMock) UpdateEphemeralMounts(ctx context.Context, req *pb.UpdateEphemeralMountsRequest) (*types.Empty, error) {
return &types.Empty{}, nil
}
func (m *agentMock) StatsContainer(ctx context.Context, req *pb.StatsContainerRequest) (*pb.StatsContainerResponse, error) {
return &pb.StatsContainerResponse{}, nil
}
Expand Down Expand Up @@ -367,6 +370,9 @@ func (m *agentMock) GetVolumeStats(ctx context.Context, req *pb.VolumeStatsReque
func (m *agentMock) ResizeVolume(ctx context.Context, req *pb.ResizeVolumeRequest) (*types.Empty, error) {
return &types.Empty{}, nil
}
func (p *agentMock) RemoveStaleVirtiofsShareMounts(ctx context.Context, req *pb.RemoveStaleVirtiofsShareMountsRequest) (*types.Empty, error) {
return &types.Empty{}, nil
}
func (m *agentMock) PullImage(ctx context.Context, req *pb.PullImageRequest) (*pb.PullImageResponse, error) {
return &pb.PullImageResponse{}, nil
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/adaptor/shim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ func (s *agentService) UpdateContainer(ctx context.Context, req *agent.UpdateCon
log.Printf("agent call: %T %#v", req, req)
return &types.Empty{}, nil
}
func (s *agentService) UpdateEphemeralMounts(ctx context.Context, req *agent.UpdateEphemeralMountsRequest) (*types.Empty, error) {
log.Printf("agent call: %T %#v", req, req)
return &types.Empty{}, nil
}
func (s *agentService) StatsContainer(ctx context.Context, req *agent.StatsContainerRequest) (*agent.StatsContainerResponse, error) {
log.Printf("agent call: %T %#v", req, req)
return &agent.StatsContainerResponse{}, nil
Expand Down Expand Up @@ -507,6 +511,10 @@ func (s *agentService) ResizeVolume(ctx context.Context, req *agent.ResizeVolume
log.Printf("agent call: %T %#v", req, req)
return &types.Empty{}, nil
}
func (s *agentService) RemoveStaleVirtiofsShareMounts(ctx context.Context, req *agent.RemoveStaleVirtiofsShareMountsRequest) (*types.Empty, error) {
log.Printf("agent call: %T %#v", req, req)
return &types.Empty{}, nil
}
func (s *agentService) PullImage(ctx context.Context, req *agent.PullImageRequest) (*types.Empty, error) {
log.Printf("agent call: PullImage %#v", req)
return &types.Empty{}, nil
Expand Down
15 changes: 15 additions & 0 deletions pkg/util/agentproto/redirector.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ func (s *redirector) UpdateContainer(ctx context.Context, req *pb.UpdateContaine
return s.agentClient.UpdateContainer(ctx, req)
}

func (s *redirector) UpdateEphemeralMounts(ctx context.Context, req *pb.UpdateEphemeralMountsRequest) (res *types.Empty, err error) {

if err := s.Connect(ctx); err != nil {
return nil, err
}
return s.agentClient.UpdateEphemeralMounts(ctx, req)
}

func (s *redirector) StatsContainer(ctx context.Context, req *pb.StatsContainerRequest) (res *pb.StatsContainerResponse, err error) {

if err := s.Connect(ctx); err != nil {
Expand All @@ -168,6 +176,13 @@ func (s *redirector) ResumeContainer(ctx context.Context, req *pb.ResumeContaine
return s.agentClient.ResumeContainer(ctx, req)
}

func (s *redirector) RemoveStaleVirtiofsShareMounts(ctx context.Context, req *pb.RemoveStaleVirtiofsShareMountsRequest) (res *types.Empty, err error) {
if err := s.Connect(ctx); err != nil {
return nil, err
}
return s.agentClient.RemoveStaleVirtiofsShareMounts(ctx, req)
}

func (s *redirector) WriteStdin(ctx context.Context, req *pb.WriteStreamRequest) (res *pb.WriteStreamResponse, err error) {

if err := s.Connect(ctx); err != nil {
Expand Down

0 comments on commit f4e4767

Please sign in to comment.