Skip to content

Commit

Permalink
Make port-forward CLI syntax more like kubectl (#3)
Browse files Browse the repository at this point in the history
* Kubectl-like command syntax

* A bit of test coverage

* Cosmetics

* Fix remote port missing

* Deal with random port

* Better descriptions

* Cosmetics

* Cosmetics

* Apply dependabot

* CR modifications

* CR modifications
  • Loading branch information
undera authored May 10, 2023
1 parent e12fc62 commit f83baad
Show file tree
Hide file tree
Showing 8 changed files with 763 additions and 134 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ You need to know agent ID, provide valid JWT token and specify target names for

Example:
```shell
# komocli port-forward <agentId> <namespace>/<podName>:podPort localPort
komocli port-forward d14846d5-211f-466a-8b1e-c823a2270a99 default/helm-dashboard-86f46bdd56-kvgj7:8080 9090 --jwt=eyJh...jAw
komocli port-forward pod/mypod 8888:5000 --namespace default --cluster my-cluster --token=...
```

JWT token can be specified via env variable `KOMOCLI_JWT`
Expand All @@ -17,13 +16,9 @@ JWT token can be specified via env variable `KOMOCLI_JWT`

# Roadmap, Ideas, TODOs

- add unit-tests
- have nicer CLI param for port forward, more kubectl-like
- make sure --help is meaningful
- support service as PF specification
- test when wrong agent ID
- test when agent is down
- test when agent shuts down mid-session
- test when container shuts down mid-session
- test when CLI shuts down mid-session
- deal with `0` as local port leading to random port
55 changes: 42 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,65 @@ module github.com/komodorio/komocli
go 1.20

require (
github.com/gin-gonic/gin v1.8.1
github.com/gin-gonic/gin v1.9.0
github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.5.0
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.7.0
k8s.io/kubectl v0.27.1
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/bytedance/sonic v1.8.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.11.0 // indirect
github.com/goccy/go-json v0.9.11 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.11.2 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.3 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.9 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.27.1 // indirect
k8s.io/apimachinery v0.27.1 // indirect
k8s.io/client-go v0.27.1 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit f83baad

Please sign in to comment.