teleport/.github/workflows
Tiago Silva 5840ae7169
Add AWS EKS End-To-End tests (#29109)
This PR enables AWS E2E integration tests for EKS auto-discovery.

This process uses Github's OIDC connector to access AWS API by assuming the `arn:aws:iam::307493967395:role/tf-aws-e2e-gha-role` role.

```yaml
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          aws-region: ${{ env.AWS_REGION }}
          role-to-assume: ${{ env.GHA_ASSUME_ROLE }}
```

`aws-actions/configure-aws-credentials` action generates a new ID token with the information required and signs it using Github's OIDC workflow.

The role `arn:aws:iam::307493967395:role/tf-aws-e2e-gha-role` is an intermediate role for the runner to be able to assume two distinct roles:

-  `arn:aws:iam::307493967395:role/tf-eks-discovery-ci-cluster-kubernetes-service-access-role` - used by Kubernetes Service
-  `arn:aws:iam::307493967395:role/tf-eks-discovery-ci-cluster-discovery-service-access-role` - used by Discovery Service

The Discovery service will assume role  `arn:aws:iam::307493967395:role/tf-eks-discovery-ci-cluster-discovery-service-access-role` which defines the following policy:

- `eks:ListClusters`
- `eks:DescribeCluster`

These are the minimal permissions required to list the available clusters and retrieve their state and labels.

Teleport Discovery Service will pull the EKS cluster available and for each cluster to import, it will create a `kube_cluster` object in Auth Server.

Once the cluster is discovered and the `kube_cluster` exists in Auth server, the Teleport Kubernetes Service will start proxying the cluster.

For that, it must pull the cluster API endpoint and its CA data to create a client.  Role `arn:aws:iam::307493967395:role/tf-eks-discovery-ci-cluster-kubernetes-service-access-role` allows Kubernetes Service to describe the cluster and retrieve its details.

- `eks:DescribeCluster`

The IAM role used by the Kubernetes Service must be mapped to a Kubernetes Group that allows impersonation in order to be able to proxy requests with the user's permissions.

```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: teleport-role
rules:
- apiGroups:
  - ""
  resources:
  - users
  - groups
  - serviceaccounts
  verbs:
  - impersonate
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - get
- apiGroups:
  - "authorization.k8s.io"
  resources:
  - selfsubjectaccessreviews
  - selfsubjectrulesreviews
  verbs:
  - create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: teleport-crb
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: teleport-role
subjects:
- kind: Group
  name: ${group_name}

```

During the cluster provisioning phase, we mapped the Kubernetes Service IAM role into a Kubernetes Group ` ${group_name}`.

```yaml

mapRoles:
- groups:
  - ${group_name}
  rolearn:arn:aws:iam::307493967395:role/tf-eks-discovery-ci-cluster-kubernetes-service-access-role
  username: "eleport:{{SessionName}}
```

The final step is to validate the client is working correctly and that the Kubernetes Service was able to generate a valid token that can impersonate Kubernetes groups and users.

For that, we simulate a user calling `kubectl get services -n default` through Teleport that must return 1 entry, the default service `kubernetes`.

Implements #27156
2023-07-19 08:19:05 +00:00
..
assign.yaml Build change for when go caching should be used (#27209) 2023-06-02 15:42:56 +00:00
aws-e2e-non-root-bypass.yaml Add AWS EKS End-To-End tests (#29109) 2023-07-19 08:19:05 +00:00
aws-e2e-tests-non-root.yaml Add AWS EKS End-To-End tests (#29109) 2023-07-19 08:19:05 +00:00
backport.yaml Build change for when go caching should be used (#27209) 2023-06-02 15:42:56 +00:00
build-api.yaml Build change for when go caching should be used (#27209) 2023-06-02 15:42:56 +00:00
build-centos7-assets.yaml Unify x86/ARM64 build process (#21660) 2023-02-15 15:38:59 +00:00
build-ci-buildbox-images.yaml Implicitly set go version in prepare-workspace (#18953) 2022-12-01 00:40:53 +00:00
build-ci-service-images.yaml Implicitly set go version in prepare-workspace (#18953) 2022-12-01 00:40:53 +00:00
build-macos-bypass.yaml Disable build-macos and build-windows on PR (#24131) 2023-04-06 17:33:58 +00:00
build-macos.yaml [ci] Change macOS GHA runner to macos-latest-xl-arm64 (#28741) 2023-07-18 22:04:10 +00:00
build-usage-image.yaml Teleport Usage Script (#23304) 2023-03-22 16:36:21 +00:00
build-windows-bypass.yaml Disable build-macos and build-windows on PR (#24131) 2023-04-06 17:33:58 +00:00
build-windows.yaml Report failures if Windows build fails (#28349) 2023-07-07 23:58:50 +00:00
check-devbox-bypass.yaml Make devbox sandbox friendly, add devbox CI. (#27728) 2023-06-14 20:58:45 +00:00
check-devbox.yaml Use the devbox install action, update devbox packages. (#28616) 2023-07-14 23:58:13 +00:00
check-merge-queue.yaml Add fake "check reviewers" workflow for merge queue (#20851) 2023-01-27 12:10:30 -08:00
check.yaml Build change for when go caching should be used (#27209) 2023-06-02 15:42:56 +00:00
codeql.yml Build change for when go caching should be used (#27209) 2023-06-02 15:42:56 +00:00
dependabot-batcher.yaml dependabot-batcher - Specify environment (#20563) 2023-01-23 18:41:52 +00:00
dependency-review.yaml Batch Dependabot PRs (#19745) 2023-01-05 13:13:05 +00:00
dismiss.yaml Build change for when go caching should be used (#27209) 2023-06-02 15:42:56 +00:00
doc-tests-bypass.yaml include changelog for docs tests (#27449) 2023-06-06 16:36:28 +00:00
doc-tests.yaml include changelog for docs tests (#27449) 2023-06-06 16:36:28 +00:00
flaky-tests-bypass.yaml Add Flaky detector Bypass before merging (#23923) 2023-03-31 20:17:12 +00:00
flaky-tests-merge-queue.yaml Fix Flaky Tests Detector bypass on merge queue (#23896) 2023-03-31 15:24:12 +00:00
flaky-tests.yaml Update Docker images to use v14 (#27189) 2023-06-01 19:47:51 +00:00
integration-tests-non-root-bypass.yaml GHA: Update path filters to include workflow files and Makefile (#23940) 2023-04-04 02:20:59 +00:00
integration-tests-non-root.yaml Update Docker images to use v14 (#27189) 2023-06-01 19:47:51 +00:00
integration-tests-root-bypass.yaml GHA: Update path filters to include workflow files and Makefile (#23940) 2023-04-04 02:20:59 +00:00
integration-tests-root.yaml Update Docker images to use v14 (#27189) 2023-06-01 19:47:51 +00:00
kube-integration-tests-non-root-bypass.yaml Restore Kubernetes Integration tests (#25624) 2023-05-12 16:38:16 +00:00
kube-integration-tests-non-root.yaml Update Docker images to use v14 (#27189) 2023-06-01 19:47:51 +00:00
label.yaml Build change for when go caching should be used (#27209) 2023-06-02 15:42:56 +00:00
lint-bypass.yaml skip md and mdx files for go linting (#26434) 2023-05-17 15:07:56 +00:00
lint-ui-bypass.yaml Disable build-macos and build-windows on PR (#24131) 2023-04-06 17:33:58 +00:00
lint-ui.yaml Remove push workflow for jobs that already run on PR and merge (#23843) 2023-03-30 18:22:26 +00:00
lint.yaml Update Docker images to use v14 (#27189) 2023-06-01 19:47:51 +00:00
os-compatibility-test-bypass.yaml bypass os-compatibility-test-bypass for md and mdx files (#26450) 2023-05-17 21:14:04 +00:00
os-compatibility-test.yaml Update Docker images to use v14 (#27189) 2023-06-01 19:47:51 +00:00
post-release.yaml GHA: Add post-release workflow that updates AMI IDs (#23583) 2023-03-30 16:36:08 +00:00
renovate.yaml Configure Renovate (#27410) 2023-06-07 13:52:11 +00:00
terraform-lint.yaml Remove push workflow for jobs that already run on PR and merge (#23843) 2023-03-30 18:22:26 +00:00
trivy.yaml Remove push workflow for jobs that already run on PR and merge (#23843) 2023-03-30 18:22:26 +00:00
unit-tests-code-bypass.yaml GHA: Update path filters to include workflow files and Makefile (#23940) 2023-04-04 02:20:59 +00:00
unit-tests-code.yaml Update Docker images to use v14 (#27189) 2023-06-01 19:47:51 +00:00
unit-tests-helm-bypass.yaml GHA: Update path filters to include workflow files and Makefile (#23940) 2023-04-04 02:20:59 +00:00
unit-tests-helm.yaml Update Docker images to use v14 (#27189) 2023-06-01 19:47:51 +00:00
unit-tests-integrations-bypass.yaml Compile binaries for access plugin tests (#27819) 2023-06-19 12:36:34 +00:00
unit-tests-integrations.yaml Compile binaries for access plugin tests (#27819) 2023-06-19 12:36:34 +00:00
unit-tests-rust-bypass.yaml GHA: Update path filters to include workflow files and Makefile (#23940) 2023-04-04 02:20:59 +00:00
unit-tests-rust.yaml Disable GHA cache (#27305) 2023-06-02 21:09:13 +00:00
unit-tests-ui-bypass.yaml Disable build-macos and build-windows on PR (#24131) 2023-04-06 17:33:58 +00:00
unit-tests-ui.yaml GHA: Update path filters to include workflow files and Makefile (#23940) 2023-04-04 02:20:59 +00:00
update-ami-ids.yaml GHA: Add post-release workflow that updates AMI IDs (#23583) 2023-03-30 16:36:08 +00:00