- hubtoken: HubTokenRenewer.Token() no longer hands out an already-expired
token on mint failure — returns "" so the round-tripper falls back to the
License-Key instead of looping on 401s.
- utils/http: hub clients no longer follow SSO redirects (StopOnSSORedirect
CheckRedirect on 302/303), and IsAuthRequired covers 302+303, so auth
detection is reliable instead of silently following to an HTML login page.
- mcpRunner: fetchHubMCP/callHubTool/fetchAndDisplayTools/callDownloadFile
use utils.IsAuthRequired (401 + unfollowed redirect) instead of bare 401;
download path checks it before writing the body to disk; URL-mode auth
message now also mentions the License-Key fallback.
Review follow-up. HubTokenRenewer.Token() re-minted on every request while
the token was empty, so a cluster where minting can't succeed (no RBAC, SA
missing) paid a blocking ~10s CreateToken round-trip per request (under the
lock). Add a 30s retry throttle: on mint failure, back off and fall back to
the prior token / License-Key. Also correct the proxy-mode 401 message — a
token-bearing 401 means the minted token was rejected (allowlist/audience),
not an RBAC-to-mint failure.
The MCP server minted a hub SA token once at startup and reused it for
the life of the process, so a long-running server 401'd silently after
the ~1h token TTL.
- utils/http: the hub round-tripper now sources the SA token via a
func() string per request (static constructors preserved), so a
renewing source keeps long-lived clients authenticated.
- kubernetes: add HubTokenRenewer — re-mints the kubeshark-cli token
before expiry (using the TokenRequest expiry, 5m margin), concurrency-safe.
- mcp proxy mode: use the renewer so the token auto-renews.
- mcp --url mode: cannot mint (no kube access) — accept an explicit
--token / KUBESHARK_HUB_TOKEN, and on 401 surface a clear 'token
expired/invalid, re-mint and restart' message instead of an opaque
API error.
console is intentionally untouched (non-functional pending the
Connect-RPC re-point); it gets renewal when that migration lands.
Provider.MintHubToken requests a short-lived token (audience kubeshark-hub)
for the kubeshark-cli ServiceAccount via the TokenRequest API. The Hub
client now prefers that token via the X-Kubeshark-Authorization custom
header (which survives the kube API-server proxy), falling back to
License-Key when minting isn't possible (--url mode, SA missing, or no
RBAC to mint). The MCP runner mints once at startup.
Pairs with hub branch cli-sa-auth. Needs the helm kubeshark-cli SA + RBAC
and the hub AUTH_CLI_SERVICE_ACCOUNTS allowlist to validate end-to-end.
Allow users to specify a local Helm chart folder via CLI flag or config,
which takes precedence over the KUBESHARK_HELM_CHART_PATH env variable and
the remote Helm repo. Also update nginx proxy config to disable buffering
for better streaming and large snapshot support.
* 🚑 Migrate to `kubehq.com` in helm values
* 🚑 Migrate to `kubehq.com` in cloud-api-url envs
* 🚑 Migrate to `kubehq.com` in manifest label keys
* 🚑 Migrate to `kubehq.com` in `Chart.yaml`
* 🚑 Migrate to `kubehq.com` in helm-chart notes/readme
* First commit in this PR
Added `scripting.active` as a helm value
* added `scripting.active` to the config struct and the helm chart
this array of strings will include the active script titles
* updated the `active` filed in the script struct
* go mod tidy
* update go ver to 1.21.1
* Add cmd to copy pcaps from worker
* Update commands to merge pcaps
* Remove test img
* Remove usage of http endpoint in copy
* Unify commands
* Add copy flag
* Address review comments
* Update k8s config path processing
* Remove debug prints
* setting the pcapSrcDit to the name of the command
* Update values.yaml
* Remove the start,stop and copy flags
* Clean up the the code a bit
Changed the logic so it's either copy or start/stop.
Works well for a first version.
* Improved the logic
* Changed pcapdump enable flag to boolean
* Added helm value documentation
* minor default configuration changes
* Fix default val for enabled
* Final changes
Cleaned up the helm worker template
Improve the logic a bit
* Code cleanup
Changed instances of `enable` to `enabled` for purpose of consistency
Removed unused helm environment variables
* Enable merging all node files to a single file.
Before the outcome had been a merged file per node.
Now the outcome is a single merged file for all nodes.
* Committed for testing purpose
* Reduced the initial disk foot print to 10MB per node
---------
Co-authored-by: bogdan.balan1 <bogdanvalentin.balan@1nce.com>
Co-authored-by: Alon Girmonsky <1990761+alongir@users.noreply.github.com>
* Make the `scritps` command directly use the K8s API without requiring a connector to Hub
* Fix linter
* Fix linter
---------
Co-authored-by: Alon Girmonsky <1990761+alongir@users.noreply.github.com>
* Add hub to the list of containers in `pprof` command and add flags to `pprof` command
* Reduce duplication
---------
Co-authored-by: Alon Girmonsky <1990761+alongir@users.noreply.github.com>
* ✨ Add `kube://` prefixed URI support
* 🐛 Fix the `a container name must be specified for pod <POD_NAME>, choose one of: [sniffer tracer]` error
* 🐛 Fix all of the issues in `kube://` prefixed URI support
* 🐛 Fix the `invalid reference format` error
* 🐛 Fix the `kubeUrl`
* 🔨 Add `tracer` as a separate container to worker `DaemonSet`
* 🔥 Delete some of the unused connector methods
* 🔨 Set `POD_NAME` and `POD_NAMESPACE` environment variables in worker `DeamonSet`
* 🔨 Set `POD_NAME` and `POD_NAMESPACE` environment variables in hub `Deployment`
* Fix the labels
* Fix the self config role
* Restrict it to specific resource names
* Run `make generate-manifests`
* ✨ Use the Helm chart in `tap` command to install Kubeshark
* ⬆️ Set Go version to `1.19` in `go.mod` file
* ✨ Add `Helm` struct`, `NewHelm` and `NewHelmDefault` methods
* ⚡ Better logging and error return
* ⚡ Pass the config as `values.yaml` to Helm install
* 🔥 Remove `helm-chart`, `manifests` and `check` commands
* ➖ Run `go mod tidy`
* 🎨 Move `helm` package into `kubernetes` package
* 🔥 Remove `# THIS FILE IS AUTOMATICALLY GENERATED BY KUBESHARK CLI. DO NOT EDIT!` notice from the manifests and Helm templates
* 🔥 Remove the unused `GenerateApplyConfiguration` and `buildWithDefaultLabels` methods
* ✨ Add `Ingress`
* ⚡ Rewrite the target in `Ingress`
* ⚡ Fix the path of front pod in `Ingress`
* ✨ Add `IngressConfig` struct
* ⚡ Generate the correct Helm chart based on `tap.ingress` field of `values.yaml`