Skip to content

Commit 28fd205

Browse files
authored
feat: support EU site (#31)
* support EU site * Refactor WSConnectionWrapper initialization to use a configuration struct for improved readability and maintainability. * Update Go version to 1.25.5 in go.mod, Makefile, and CI workflows * Update golangci-lint action to version 9 and adjust caching options in CI workflow * fix lint errors
1 parent 95eed7a commit 28fd205

File tree

10 files changed

+417
-259
lines changed

10 files changed

+417
-259
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Go
1919
uses: actions/setup-go@v5
2020
with:
21-
go-version: 1.22.2
21+
go-version: 1.25.5
2222
- name: git cleanup
2323
run: git clean -f
2424
- name: Unit tests
@@ -45,13 +45,10 @@ jobs:
4545
path: dist/
4646
retention-days: 1
4747
- name: golangci-lint
48-
uses: golangci/golangci-lint-action@v4
48+
uses: golangci/golangci-lint-action@v9
4949
with:
50-
# version: latest
51-
# skip-go-installation: true
52-
skip-pkg-cache: true
53-
skip-build-cache: true
54-
# args: --timeout=15m
50+
version: v2.8.0
51+
skip-cache: true
5552
mac_with_signing:
5653
runs-on: macos-latest
5754
timeout-minutes: 10
@@ -61,7 +58,7 @@ jobs:
6158
- name: Set up Go
6259
uses: actions/setup-go@v5
6360
with:
64-
go-version: 1.22.2
61+
go-version: 1.25.5
6562
- name: Prepare keys
6663
env:
6764
CERT: certificate.p12

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Go
1616
uses: actions/setup-go@v5
1717
with:
18-
go-version: 1.22.2
18+
go-version: 1.25.5
1919
- name: git cleanup
2020
run: git clean -f
2121

@@ -36,7 +36,7 @@ jobs:
3636
- name: Set up Go
3737
uses: actions/setup-go@v5
3838
with:
39-
go-version: 1.22.2
39+
go-version: 1.25.5
4040
- name: Prepare keys
4141
env:
4242
CERT: certificate.p12

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ VERSION ?= $(git describe --tags --always --dirty --match=v* 2> /dev/null || \
44

55
.PHONY: test
66
test: ; $(info $(M) start unit testing...) @
7-
@go test $$(go list ./... | grep -v /mocks/) --race -v -short -coverpkg=./... -coverprofile=profile.cov
7+
@go test $$(go list ./... | grep -v /mocks/ | grep -v '^github.com/komodorio/komocli$$') --race -v -short -coverprofile=profile.cov
88
@echo "\n*****************************"
99
@echo "** TOTAL COVERAGE: $$(go tool cover -func profile.cov | grep total | grep -Eo '[0-9]+\.[0-9]+')% **"
1010
@echo "*****************************\n"
@@ -13,6 +13,10 @@ test: ; $(info $(M) start unit testing...) @
1313
pull: ; $(info $(M) Pulling source...) @
1414
@git pull
1515

16+
.PHONY: lint
17+
lint: ; $(info $(M) Running golangci-lint...) @ ## Run golangci-lint
18+
@golangci-lint run ./...
19+
1620
.PHONY: build
1721
build: $(BIN) ; $(info $(M) Building executable...) @ ## Build program binary
1822
go build \

README.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,42 @@
11
# komocli
22
CLI to interact with Komodor platform
33

4-
## Port Forwarding
4+
## Port Forwarding
55

6-
You need to know agent ID, provide valid JWT token and specify target names for objects
6+
### Basic Usage
77

8-
Example:
98
```shell
10-
komocli port-forward pod/mypod 8888:5000 --namespace default --cluster my-cluster --token=...
9+
# Default (US region)
10+
komocli port-forward pod/mypod 8888:5000 --namespace default --cluster my-cluster --token=...
11+
12+
# EU region
13+
komocli port-forward pod/mypod 8888:5000 --namespace default --cluster my-cluster --token=... --region eu
14+
15+
# Custom WebSocket URL (advanced)
16+
komocli port-forward pod/mypod 5000 --namespace default --cluster my-cluster --token=... --region wss://custom.komodor.com
1117
```
1218

13-
JWT token can be specified via env variable `KOMOCLI_JWT`
14-
`KOMOCLI_WS_URL` is the base URL for env, defaults to `wss://app.komodor.com`, `KOMOCLI_DEV` flag would make it use query string param for JWT instead of cookie.
15-
`--address` sets the bind address for forwarder
19+
### Authentication
20+
21+
JWT token can be specified via:
22+
- Command line: `--token YOUR_TOKEN`
23+
- Environment variable: `KOMOCLI_JWT`
24+
25+
### Region Configuration
26+
27+
The `--region` flag supports:
28+
- **Predefined regions**: `us` (default), `eu`
29+
30+
### Environment Variables
31+
32+
- `KOMOCLI_JWT` - JWT authentication token (alternative to --token flag)
33+
- `DEBUG` - Enable verbose logging
34+
35+
### Additional Options
36+
37+
- `--address` - Sets the bind address for forwarder (default: localhost)
38+
- `--browser` - Automatically open forwarded address in browser
39+
- `--timeout` - Timeout for operations (default: 5s)
1640

1741
# Roadmap, Ideas, TODOs
1842

go.mod

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,71 @@
11
module github.com/komodorio/komocli
22

3-
go 1.22
3+
go 1.25.5
44

55
require (
6-
github.com/gin-gonic/gin v1.9.1
6+
github.com/gin-gonic/gin v1.11.0
77
github.com/google/uuid v1.6.0
8-
github.com/gorilla/websocket v1.5.1
8+
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674
99
github.com/orcaman/concurrent-map/v2 v2.0.1
1010
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
11-
github.com/sirupsen/logrus v1.9.3
12-
github.com/spf13/cobra v1.8.0
13-
k8s.io/kubectl v0.29.3
11+
github.com/sirupsen/logrus v1.9.4
12+
github.com/spf13/cobra v1.10.2
13+
k8s.io/kubectl v0.35.0
1414
)
1515

1616
require (
17-
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
17+
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
1818
github.com/MakeNowJust/heredoc v1.0.0 // indirect
19-
github.com/bytedance/sonic v1.11.3 // indirect
20-
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
21-
github.com/chenzhuoyu/iasm v0.9.1 // indirect
22-
github.com/davecgh/go-spew v1.1.1 // indirect
23-
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
24-
github.com/gin-contrib/sse v0.1.0 // indirect
25-
github.com/go-logr/logr v1.3.0 // indirect
19+
github.com/bytedance/gopkg v0.1.3 // indirect
20+
github.com/bytedance/sonic v1.15.0 // indirect
21+
github.com/bytedance/sonic/loader v0.5.0 // indirect
22+
github.com/cloudwego/base64x v0.1.6 // indirect
23+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
24+
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
25+
github.com/gin-contrib/sse v1.1.0 // indirect
26+
github.com/go-logr/logr v1.4.3 // indirect
2627
github.com/go-playground/locales v0.14.1 // indirect
2728
github.com/go-playground/universal-translator v0.18.1 // indirect
28-
github.com/go-playground/validator/v10 v10.19.0 // indirect
29-
github.com/goccy/go-json v0.10.2 // indirect
30-
github.com/gogo/protobuf v1.3.2 // indirect
31-
github.com/golang/protobuf v1.5.4 // indirect
32-
github.com/google/gofuzz v1.2.0 // indirect
29+
github.com/go-playground/validator/v10 v10.30.1 // indirect
30+
github.com/goccy/go-json v0.10.5 // indirect
31+
github.com/goccy/go-yaml v1.19.2 // indirect
3332
github.com/inconshreveable/mousetrap v1.1.0 // indirect
3433
github.com/json-iterator/go v1.1.12 // indirect
35-
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
34+
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
35+
github.com/kr/text v0.2.0 // indirect
3636
github.com/leodido/go-urn v1.4.0 // indirect
3737
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
3838
github.com/mattn/go-isatty v0.0.20 // indirect
3939
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
40-
github.com/moby/spdystream v0.2.0 // indirect
41-
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
40+
github.com/moby/term v0.5.2 // indirect
4241
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
43-
github.com/modern-go/reflect2 v1.0.2 // indirect
44-
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
45-
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
42+
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
43+
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
44+
github.com/quic-go/qpack v0.6.0 // indirect
45+
github.com/quic-go/quic-go v0.59.0 // indirect
4646
github.com/russross/blackfriday/v2 v2.1.0 // indirect
47-
github.com/spf13/pflag v1.0.5 // indirect
47+
github.com/spf13/pflag v1.0.10 // indirect
4848
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
49-
github.com/ugorji/go/codec v1.2.12 // indirect
50-
golang.org/x/arch v0.7.0 // indirect
51-
golang.org/x/crypto v0.21.0 // indirect
52-
golang.org/x/net v0.23.0 // indirect
53-
golang.org/x/oauth2 v0.10.0 // indirect
54-
golang.org/x/sys v0.18.0 // indirect
55-
golang.org/x/term v0.18.0 // indirect
56-
golang.org/x/text v0.14.0 // indirect
57-
golang.org/x/time v0.3.0 // indirect
58-
google.golang.org/appengine v1.6.7 // indirect
59-
google.golang.org/protobuf v1.33.0 // indirect
49+
github.com/ugorji/go/codec v1.3.1 // indirect
50+
github.com/x448/float16 v0.8.4 // indirect
51+
go.uber.org/mock v0.6.0 // indirect
52+
go.yaml.in/yaml/v2 v2.4.3 // indirect
53+
go.yaml.in/yaml/v3 v3.0.4 // indirect
54+
golang.org/x/arch v0.23.0 // indirect
55+
golang.org/x/crypto v0.47.0 // indirect
56+
golang.org/x/net v0.49.0 // indirect
57+
golang.org/x/sys v0.40.0 // indirect
58+
golang.org/x/text v0.33.0 // indirect
59+
google.golang.org/protobuf v1.36.11 // indirect
6060
gopkg.in/inf.v0 v0.9.1 // indirect
61-
gopkg.in/yaml.v2 v2.4.0 // indirect
62-
gopkg.in/yaml.v3 v3.0.1 // indirect
63-
k8s.io/api v0.29.3 // indirect
64-
k8s.io/apimachinery v0.29.3 // indirect
65-
k8s.io/cli-runtime v0.29.3 // indirect
66-
k8s.io/client-go v0.29.3 // indirect
67-
k8s.io/klog/v2 v2.110.1 // indirect
68-
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
69-
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
70-
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
71-
sigs.k8s.io/yaml v1.3.0 // indirect
61+
k8s.io/apimachinery v0.35.0 // indirect
62+
k8s.io/cli-runtime v0.35.0 // indirect
63+
k8s.io/client-go v0.35.0 // indirect
64+
k8s.io/klog/v2 v2.130.1 // indirect
65+
k8s.io/kube-openapi v0.0.0-20251125145642-4e65d59e963e // indirect
66+
k8s.io/utils v0.0.0-20260108192941-914a6e750570 // indirect
67+
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
68+
sigs.k8s.io/randfill v1.0.0 // indirect
69+
sigs.k8s.io/structured-merge-diff/v6 v6.3.1 // indirect
70+
sigs.k8s.io/yaml v1.6.0 // indirect
7271
)

0 commit comments

Comments
 (0)