Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoandredinis committed Dec 18, 2024
1 parent 475753f commit 8ce34d0
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 5 deletions.
19 changes: 15 additions & 4 deletions lib/usertasks/descriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,25 @@ import (
//go:embed descriptions/*.md
var descriptionsFS embed.FS

// DescriptionForDiscoverEC2Issue returns the description of the issue and fixing steps.
// The returned string contains a markdown document.
// If issue type is not recognized or doesn't have a specific description, them an empty string is returned.
func DescriptionForDiscoverEC2Issue(issueType string) string {
func loadIssueDescription(issueType string) string {
filename := fmt.Sprintf("descriptions/%s.md", issueType)
bs, err := descriptionsFS.ReadFile(filename)
if err != nil {
return ""
}
return string(bs)
}

// DescriptionForDiscoverEC2Issue returns the description of the issue and fixing steps.
// The returned string contains a markdown document.
// If issue type is not recognized or doesn't have a specific description, them an empty string is returned.
func DescriptionForDiscoverEC2Issue(issueType string) string {
return loadIssueDescription(issueType)
}

// DescriptionForDiscoverEKSIssue returns the description of the issue and fixing steps.
// The returned string contains a markdown document.
// If issue type is not recognized or doesn't have a specific description, them an empty string is returned.
func DescriptionForDiscoverEKSIssue(issueType string) string {
return loadIssueDescription(issueType)
}
11 changes: 11 additions & 0 deletions lib/usertasks/descriptions/eks-agent-not-connecting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
The process of automatically enrolling EKS Clusters into Teleport, starts by installing the [`teleport-kube-agent`](https://goteleport.com/docs/reference/helm-reference/teleport-kube-agent/) to the cluster.

If the installation is successful, the EKS Cluster will appear in your Resources list.

However, the following EKS Clusters did not automatically enrolled.
This usually happens when the installation is taking too long or there was an error preventing the HELM chart installation.

Navigate to the Teleport Agent to get more information.

[//]: <> (UI must include a column on clusters list:)
[//]: <> (Open Teleport Agent: https://<region>.console.aws.amazon.com/eks/home?region=<region>#/clusters/<cluster-name>/statefulsets/teleport-kube-agent?namespace=teleport-agent)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Teleport uses the Amazon EKS API to install the Teleport Kubernetes Agent.

Please enable API (or API and Config Map) authentication mode in the following EKS Clusters so that they can be automatically enrolled.

[//]: <> (UI must include a column on clusters list:)
[//]: <> (Manage access: https://<region>.console.aws.amazon.com/eks/home?region=<region>#/clusters/<cluster-name>/manage-access)
8 changes: 8 additions & 0 deletions lib/usertasks/descriptions/eks-cluster-unreachable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The EKS Cluster must be accessible from the Teleport Auth Service in order for Teleport to deploy the Teleport Kubernetes Agent.

The following EKS Clusters couldn't be accessed.

Ensure their networking configuration allows access from Teleport.

[//]: <> (UI must include a column on clusters list:)
[//]: <> (Manage endpoint access: https://<region>.console.aws.amazon.com/eks/home?region=<region>#/clusters/<cluster-name>/manage-endpoint-access)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The EKS Cluster must be publicly accessible in order for Teleport to deploy the Teleport Kubernetes Agent.

The following EKS Clusters don't have a public endpoint.


[//]: <> (UI must include a column on clusters list:)
[//]: <> (Manage endpoint access: https://<region>.console.aws.amazon.com/eks/home?region=<region>#/clusters/<cluster-name>/manage-endpoint-access)
6 changes: 6 additions & 0 deletions lib/usertasks/descriptions/eks-status-not-active.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Only EKS Clusters whose status is active can be automatically enrolled into teleport.

The following are not active.

[//]: <> (UI must include a column on clusters list:)
[//]: <> (Manage cluster: https://<region>.console.aws.amazon.com/eks/home?region=<region>#/clusters/<cluster-name>)
3 changes: 3 additions & 0 deletions lib/usertasks/descriptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ func TestAllDescriptions(t *testing.T) {
for _, issueType := range usertasksapi.DiscoverEC2IssueTypes {
require.NotEmpty(t, DescriptionForDiscoverEC2Issue(issueType), "issue type %q is missing descriptions/%s.md file", issueType, issueType)
}
for _, issueType := range usertasksapi.DiscoverEKSIssueTypes {
require.NotEmpty(t, DescriptionForDiscoverEKSIssue(issueType), "issue type %q is missing descriptions/%s.md file", issueType, issueType)
}
}
14 changes: 13 additions & 1 deletion lib/web/ui/usertask.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/gravitational/trace"

usertasksv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/usertasks/v1"
apiusertasks "github.com/gravitational/teleport/api/types/usertasks"
"github.com/gravitational/teleport/lib/usertasks"
)

Expand Down Expand Up @@ -52,6 +53,8 @@ type UserTaskDetail struct {
Description string `json:"description,omitempty"`
// DiscoverEC2 contains the task details for the DiscoverEC2 tasks.
DiscoverEC2 *usertasksv1.DiscoverEC2 `json:"discoverEc2,omitempty"`
// DiscoverEKS contains the task details for the DiscoverEKS tasks.
DiscoverEKS *usertasksv1.DiscoverEKS `json:"discoverEks,omitempty"`
}

// UpdateUserTaskStateRequest is a request to update a UserTask
Expand Down Expand Up @@ -92,10 +95,19 @@ func MakeUserTasks(uts []*usertasksv1.UserTask) []UserTask {

// MakeDetailedUserTask creates a UI UserTask representation containing all the details.
func MakeDetailedUserTask(ut *usertasksv1.UserTask) UserTaskDetail {
var description string
switch ut.GetSpec().GetTaskType() {
case apiusertasks.TaskTypeDiscoverEC2:
description = usertasks.DescriptionForDiscoverEC2Issue(ut.GetSpec().GetIssueType())
case apiusertasks.TaskTypeDiscoverEKS:
description = usertasks.DescriptionForDiscoverEKSIssue(ut.GetSpec().GetIssueType())
}

return UserTaskDetail{
UserTask: MakeUserTask(ut),
Description: usertasks.DescriptionForDiscoverEC2Issue(ut.GetSpec().GetIssueType()),
Description: description,
DiscoverEC2: ut.GetSpec().GetDiscoverEc2(),
DiscoverEKS: ut.GetSpec().GetDiscoverEks(),
}
}

Expand Down

0 comments on commit 8ce34d0

Please sign in to comment.