takescoop / kubectl-exec-forward Goto Github PK
View Code? Open in Web Editor NEWA kubectl plugin to run exec hooks exposed by a Kubernetes pod around a port-forward action.
License: MIT License
A kubectl plugin to run exec hooks exposed by a Kubernetes pod around a port-forward action.
License: MIT License
The test workflow is currently pretty slow. go test
takes ~2m. There is one slow integration test (TestRunForwardCommand
) but the majority of the time is going to downloading dependencies and building packages. Caching this data across builds should significantly reduce test run times.
Integration tests depend on Kubernetes (minikube) and are therefore very slow to start. Rather than just allow integration tests to be skipped, we should run unit and integration tests separately, potentially forgoing the inclusion of integration tests in coverage metrics.
This will allow unit tests to run quickly and fail for basic issues, including un-buildable code. Integration tests can either run after or in parallel.
In addition to go test -short
, we have the option to use build tags for tests:
The calls made by the factory builder appear to be the culprit. We should either ensure that the user agent is set properly for these requests, find a way to make generic object requests using the basic client-go clientset (might not be possible), or find a way to use the dynamicResourceClient
When calling the plugin with --context
, the context setting does not propagate when attempting to find an attachable pod. Given a current context set via kubeconfig of a
, and --context b
, the resulting behavior is:
a
b
When the pod is found using a higher level object, e.g. service/my-svc
, both contexts may have the same objects. In this case, an attachable pod will be found in a
, but attempts to connect to the named pod in b
will likely fail since higher order controllers (Deployment/Replica Set) generate randomized pod names.
Error: error upgrading connection: pods "my-app-abc123" not found
For now, a workaround is to set the context in the kubeconfig, by using kubectl config
, kubectx
, etc.
When there are pre-connect
and post-connect
commands that run, the user does not get any indication of what things are running and when. Before each command runs, the program should print relevant log information so the user understands what's running. Child process outputs should generally not be printed, but it's important for users to know what was passed to exec, in case:
Example output might be:
Running pre-connect hook (id=foo): echo foo bar baz
Rich text rendering could help this display clearly, e.g. bold/colored text. Or quotes/punctuation.
When the main command completes, the forwarding connection should be closed by default. An ideal command (e.g. psql
) should block until work is complete and then exit 0.
For commands that perform a side effect and then immediately exit 0, either the config or the user (CLI) could be allowed to specify that the connection should persist after the command.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
k8s.io/api
, k8s.io/apimachinery
, k8s.io/cli-runtime
, k8s.io/client-go
, k8s.io/kubectl
).github/workflows/approve-markdown.yml
actions/checkout v3
hmarr/auto-approve-action v2
.github/workflows/lint.yml
actions/checkout v3
actions/setup-go v3
golangci/golangci-lint-action v3
.github/workflows/release.yml
actions/checkout v3
actions/setup-go v3
tibdex/github-app-token v1
goreleaser/goreleaser-action v3
.github/workflows/test.yml
actions/checkout v3
actions/setup-go v3
codecov/codecov-action v3
go.mod
go 1.19
github.com/howeyc/fsnotify v0.9.0
github.com/pborman/ansi v1.0.0
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5@74d24b5ae9f5
github.com/spf13/cobra v1.5.0
github.com/stretchr/testify v1.8.0
github.com/tidwall/gjson v1.14.3
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31@22c06c80ed31
k8s.io/api v0.25.2
k8s.io/apimachinery v0.25.2
k8s.io/cli-runtime v0.25.2
k8s.io/client-go v0.25.2
k8s.io/kubectl v0.25.2
When a command errors, the configuration is printed:
kubectl-exec-forward/internal/command/command.go
Lines 101 to 103 in 981d226
What the user wants is to see the actual command that ran and failed, not the command template defined by the administrator.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.