Commit Graph
10 Commits
Author SHA1 Message Date
Tiago Silva 6ce42b4ac1 Add minor improvements to lib/kube/proxy (#21885)
This PR resolves the comments pointed out by @jakule during the review
of #21846.
2023-02-16 13:49:20 +00:00
Tiago Silva 89b20d6b3b Add support for compressed Kubernetes API responses (#20981)
This PR adds support for `gzip` compressed responses received from
the Kubernetes API.

Most Kubernetes vendors run with compression disabled since it causes a lot of CPU
spikes and timeouts but at least IBM cloud has it enabled.
(https://github.com/kubernetes/kubernetes/issues/112296)

Fixes #20980
2023-01-31 16:05:17 +00:00
Tiago Silva 071e36acf1 tsh, tctl support for creating Pod access requests (#20272)
This PR introduces support for creating resource access requests to `pod` resources to `tsh` and their approval from `tsh` and `tctl`. 

Adds support `tsh request create --resource /<cluster>/pod/<kube_cluster>/<namespace>/<podname>`.

Part of #18434
2023-01-17 17:12:31 +00:00
Tiago Silva c6d3f81f20 Disables TestListPodRBAC to run in parallel with other tests (#20267)
Running computationally expensive tests causes connection failures that lead to test failures.
This PR tries to overcome this problem by making only the subtests run in parallel.
2023-01-16 18:22:52 +00:00
Tiago Silva 7dde7c2811 Kubernetes Per-Pod RBAC (#19613)
This PR introduces a mechanism to control access to Pods in Kubernetes clusters based on access criteria defined in user Roles or Resource Access Requests.

New `Role` version - `v6` - introduced a new field `kubernetes_resources` that allows admins to restrict access to a subset of cluster resources based on the configuration provided. 
This PR implements the resource control for `pods` and allows 

```yaml
kubernetes_resources:
- kind: pod
  name: nginx-*
  namespace: default
- kind: pod
  name: *
  namespace: dev
```

It also implements the logic blocks for supporting Resource Access Requests to Kubernetes Pods. The tsh boilerplate is not included in this PR and will be included in future PRs.
An example of usage:

```
tsh request search --kind pod --kube-cluster=minikube
Name                              Namespace Labels                                 Resource ID
--------------------------------- --------- -------------------------------------- ---------------------------------------------
nginx-deployment-6595874d85-6j2zm default   app=nginx,pod-template-hash=6595874d85 /tele.teleport.local/pod/minikube/default/...
nginx-deployment-6595874d85-7xgmb default   app=nginx,pod-template-hash=6595874d85 /tele.teleport.local/pod/minikube/default/...
nginx-deployment-6595874d85-c4kz8 default   app=nginx,pod-template-hash=6595874d85 /tele.teleport.local/pod/minikube/default/...
test                              default   run=test                               /tele.teleport.local/pod/minikube/default/...

To request access to these resources, run
> tsh request create --resource /tele.teleport.local/pod/minikube/default/nginx-deployment-6595874d85-6j2zm --resource /tele.teleport.local/pod/minikube/default/nginx-deployment-6595874d85-7xgmb --resource /tele.teleport.local/pod/minikube/default/nginx-deployment-6595874d85-c4kz8 --resource /tele.teleport.local/pod/minikube/default/test \
    --reason <request reason>
```



Part of #18434
2023-01-13 14:44:13 +00:00
Steven Martin e1ebc332f8 spell fixes (#19419) 2022-12-16 19:01:28 +00:00
Tiago Silva 1c1b6b076b Kubernetes Portforward via Websockets (#18791)
This PR extends the Kubernetes Service to support the WebSocket
protocol in Kubernetes Porforward calls.

The Websocket protocol is required so that Kubernetes clients
like C#, Python, and Javascript can create portforward requests
to Kubernetes PODs. Although Teleport supports clients using WebSocket
protocol, it still uses SPDY protocol when connecting to upstreams -
Teleport Services or Kubernetes API.

Contrary to requests through SPDY, WebSocket requests do not support any
concurrency or multiplexing. This is a protocol limitation since
it only creates a single stream pair per port. When using it
concurrently, the requests will be mixed and fail.

Fixes #18783
2022-12-08 10:27:49 +00:00
Tiago Silva e408016439 Fixes TestListKube when running in Github Actions (#18077)
When running tests in GitHub Actions, Teleport automatically imports the Azure instance labels as service labels. 
It results in the TestListKube test failing since it receives unexpected labels. 

This PR replaces the default IMDSClient with a fake one to avoid introducing labels imported from the CI env where the test is running. 

It also removes an unrelated error message - self-subject access review failed - that is printed but had no impact on the test result.

Fixes [#17864 (comment)](https://github.com/gravitational/teleport/issues/17864#issuecomment-1297030770)
2022-11-03 21:29:17 +00:00
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Tiago Silva 31a2e84c31 Kubernetes Exec via Websockets (#15475)
This PR extends the Kubernetes Service to support the WebSocket protocol in Kubernetes Exec calls.
The Websocket protocol is required so that Kubernetes clients like C#, Python, and Javascript can call the `exec` and `attach` methods.

File `remotecommand_websocket.go` was vendored from [kubernetes repo](https://github.com/kubernetes/kubernetes/blob/d5fdf3135e7c99e5f81e67986ae930f6a2ffb047/pkg/kubelet/cri/streaming/remotecommand/websocket.go).

Fixes #15463

Future work:
- Extend support for  `port-forward`
- Extend support for  `cp`
2022-09-09 16:55:11 +00:00