Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a GRPC client/server to kando to run/check processes #2832

Merged
merged 14 commits into from
Oct 9, 2024

Conversation

tdmanv
Copy link
Contributor

@tdmanv tdmanv commented Apr 19, 2024

Change Overview

New Kando Commands

Server

./kando process server -h
server

Usage:
  kando process server [flags]

Flags:
  -h, --help   help for server

Global Flags:
  -a, --address string     The path of a unix socket of the process server (default "/tmp/kanister.sock")
  -v, --verbosity string   Log level (debug, info, warn, error, fatal, panic) (default "warning")

Client

./kando process client -h
Send commands to the process server

Usage:
  kando process client [command]

Available Commands:
  create      create
  list        list
  output      output

Flags:
  -j, --as-json   Display output as json
  -h, --help      help for client

Global Flags:
  -a, --address string     The path of a unix socket of the process server (default "/tmp/kanister.sock")
  -v, --verbosity string   Log level (debug, info, warn, error, fatal, panic) (default "warning")

Use "kando process client [command] --help" for more information about a command.

Generate proto updates:

:/go/src/github.com/kanisterio/kanister# ./build/protoc.sh
protoc '--go_out=.' '--go_opt=paths=source_relative' '--go-grpc_out=.' '--go-grpc_opt=paths=source_relative' ./pkg/kanx/kanx.proto

Pull request type

Please check the type of change your PR introduces:

  • 🌻 Feature

Test Plan

go test -v ./pkg/kanx
=== RUN   Test
{"File":"pkg/kanx/kanx_test.go","Function":"github.com/kanisterio/kanister/pkg/kanx.(*KanXSuite).TestError.func1","Line":168,"address":{"Name":"/tmp/KanXSuite.TestError1266107833/kanx.sock","Net":"unix"},"level":"info","msg":"Listening on socket","time":"2024-04-18T22:29:25.93761862-07:00"}
{"File":"pkg/kanx/kanx_grpc.pb.go","Function":"github.com/kanisterio/kanister/pkg/kanx._ProcessService_CreateProcesses_Handler","Line":190,"level":"info","msg":"pid:482191 state:PROCESS_STATE_RUNNING","stderr":"/tmp/KanXSuite.TestError1266107833/kando.2022764142.stderr","stdout":"/tmp/KanXSuite.TestError1266107833/kando.100297899.stdout","time":"2024-04-18T22:29:25.939380505-07:00"}
{"File":"runtime/asm_amd64.s","Function":"runtime.goexit","Line":1695,"level":"info","msg":"pid:482191 state:PROCESS_STATE_FAILED exitCode:-1 exitErr:\"signal: killed\"","time":"2024-04-18T22:29:25.940065676-07:00"}
{"File":"runtime/asm_amd64.s","Function":"runtime.goexit","Line":1695,"level":"info","msg":"Gracefully stopping. Context canceled","time":"2024-04-18T22:29:25.941803878-07:00"}
{"File":"pkg/kanx/kanx_test.go","Function":"github.com/kanisterio/kanister/pkg/kanx.(*KanXSuite).TestLongProcess.func1","Line":115,"address":{"Name":"/tmp/KanXSuite.TestLongProcess3405729663/kanx.sock","Net":"unix"},"level":"info","msg":"Listening on socket","time":"2024-04-18T22:29:25.942031333-07:00"}
{"File":"pkg/kanx/kanx_grpc.pb.go","Function":"github.com/kanisterio/kanister/pkg/kanx._ProcessService_CreateProcesses_Handler","Line":190,"level":"info","msg":"pid:482195 state:PROCESS_STATE_RUNNING","stderr":"/tmp/KanXSuite.TestLongProcess3405729663/kando.640450080.stderr","stdout":"/tmp/KanXSuite.TestLongProcess3405729663/kando.670754590.stdout","time":"2024-04-18T22:29:25.942692496-07:00"}
{"File":"runtime/asm_amd64.s","Function":"runtime.goexit","Line":1695,"level":"info","msg":"pid:482195 state:PROCESS_STATE_FAILED exitCode:-1 exitErr:\"signal: killed\"","time":"2024-04-18T22:29:25.9431854-07:00"}
{"File":"runtime/asm_amd64.s","Function":"runtime.goexit","Line":1695,"level":"info","msg":"Gracefully stopping. Context canceled","time":"2024-04-18T22:29:25.946201522-07:00"}
{"File":"pkg/kanx/kanx_test.go","Function":"github.com/kanisterio/kanister/pkg/kanx.(*KanXSuite).TestParallelStdout.func1","Line":225,"address":{"Name":"/tmp/KanXSuite.TestParallelStdout3622194217/kanx.sock","Net":"unix"},"level":"info","msg":"Listening on socket","time":"2024-04-18T22:29:25.946449017-07:00"}
{"File":"pkg/kanx/kanx_grpc.pb.go","Function":"github.com/kanisterio/kanister/pkg/kanx._ProcessService_CreateProcesses_Handler","Line":190,"level":"info","msg":"pid:482196 state:PROCESS_STATE_RUNNING","stderr":"/tmp/KanXSuite.TestParallelStdout3622194217/kando.3676522233.stderr","stdout":"/tmp/KanXSuite.TestParallelStdout3622194217/kando.1459663735.stdout","time":"2024-04-18T22:29:25.947107068-07:00"}
{"File":"runtime/asm_amd64.s","Function":"runtime.goexit","Line":1695,"level":"info","msg":"pid:482196 state:PROCESS_STATE_FAILED exitCode:-1 exitErr:\"signal: killed\"","time":"2024-04-18T22:29:25.947828873-07:00"}
{"File":"runtime/asm_amd64.s","Function":"runtime.goexit","Line":1695,"level":"info","msg":"Gracefully stopping. Context canceled","time":"2024-04-18T22:29:26.082038582-07:00"}
{"File":"pkg/kanx/kanx_test.go","Function":"github.com/kanisterio/kanister/pkg/kanx.(*KanXSuite).TestServerCancellation","Line":67,"address":{"Name":"/tmp/KanXSuite.TestServerCancellation881028328/kanx.sock","Net":"unix"},"level":"info","msg":"Listening on socket","time":"2024-04-18T22:29:26.082330192-07:00"}
{"File":"runtime/asm_amd64.s","Function":"runtime.goexit","Line":1695,"level":"info","msg":"Gracefully stopping. Context canceled","time":"2024-04-18T22:29:26.082690116-07:00"}
{"File":"pkg/kanx/kanx_test.go","Function":"github.com/kanisterio/kanister/pkg/kanx.(*KanXSuite).TestShortProcess.func1","Line":77,"address":{"Name":"/tmp/KanXSuite.TestShortProcess1010242134/kanx.sock","Net":"unix"},"level":"info","msg":"Listening on socket","time":"2024-04-18T22:29:26.083038901-07:00"}
{"File":"pkg/kanx/kanx_grpc.pb.go","Function":"github.com/kanisterio/kanister/pkg/kanx._ProcessService_CreateProcesses_Handler","Line":190,"level":"info","msg":"pid:482209 state:PROCESS_STATE_RUNNING","stderr":"/tmp/KanXSuite.TestShortProcess1010242134/kando.1760524628.stderr","stdout":"/tmp/KanXSuite.TestShortProcess1010242134/kando.3646466058.stdout","time":"2024-04-18T22:29:26.161016192-07:00"}
{"File":"runtime/asm_amd64.s","Function":"runtime.goexit","Line":1695,"level":"info","msg":"pid:482209 state:PROCESS_STATE_SUCCEEDED","time":"2024-04-18T22:29:26.161705947-07:00"}
{"File":"runtime/asm_amd64.s","Function":"runtime.goexit","Line":1695,"level":"info","msg":"Gracefully stopping. Context canceled","time":"2024-04-18T22:29:26.163238424-07:00"}
OK: 5 passed
--- PASS: Test (0.23s)
PASS
ok      github.com/kanisterio/kanister/pkg/kanx 0.239s
  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

@tdmanv tdmanv force-pushed the tdmanv/process-server branch from a5b7c3d to 6834c3a Compare April 19, 2024 05:34
@e-sumin e-sumin self-requested a review April 22, 2024 14:37
@pavannd1 pavannd1 requested review from hairyhum and pavannd1 April 22, 2024 22:13
@hairyhum hairyhum force-pushed the tdmanv/process-server branch 2 times, most recently from c533002 to 8769150 Compare June 28, 2024 20:30
@tdmanv tdmanv added the kueue label Aug 7, 2024
@hairyhum hairyhum force-pushed the tdmanv/process-server branch from 8769150 to 5c15887 Compare August 14, 2024 21:53
pkg/kanx/kanx_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@aaron-kasten aaron-kasten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't oppose using this tool, but I don't see how it adds to capturing log output (beyond what Kube exec already does). The functionality appears to be a duplication of K8s exec with the addition of tracking output per-command.

Is there a use-case for storing and replaying output from kanister-tools pods?

@hairyhum
Copy link
Contributor

hairyhum commented Oct 9, 2024

The functionality appears to be a duplication of K8s exec with the addition of tracking output per-command.
I believe the main difference is that unlike exec this one will not break the long-running command execution if exec interrupts.

pkg/kanx/server.go Outdated Show resolved Hide resolved
pkg/kanx/client.go Outdated Show resolved Hide resolved
pkg/kanx/client.go Outdated Show resolved Hide resolved
@mergify mergify bot merged commit 6055b35 into master Oct 9, 2024
18 checks passed
@mergify mergify bot deleted the tdmanv/process-server branch October 9, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants