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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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

@e-sumin e-sumin self-requested a review April 22, 2024 14:37
@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
Comment on lines +214 to +218
var _ io.Writer = (*nilWriter)(nil)

type nilWriter struct{}

func (nw *nilWriter) Write(p []byte) (n int, err error) { return }
Copy link
Contributor

@denisvmedia denisvmedia Aug 27, 2024

Choose a reason for hiding this comment

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

Maybe we can use io.Discard instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good suggestion. i hadn't seen io.Discard before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Reviewer approved
Development

Successfully merging this pull request may close these issues.

4 participants