Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instance name to DiscoverEC2 User Task failed instances list #47712

Merged
merged 2 commits into from
Oct 22, 2024

Conversation

marcoandredinis
Copy link
Contributor

@marcoandredinis marcoandredinis commented Oct 18, 2024

This PR adds the Instance Name to the DiscoverEC2 UserTasks.
This adds an extra information that will help the user identify what instances the issue is referring to.

Previously, only the instance id was present.

Demo:

kind: user_task
metadata:
  expires:
    nanos: 798511000
    seconds: 1729265153
  name: 79298717-1cd0-57a8-9977-5cbdc3446b31
  revision: 1a96be07-d30f-40ff-9e08-d876ca273b2e
spec:
  discover_ec2:
    account_id: "123456789012"
    instances:
      i-123:
        discovery_config: dc001
        discovery_group: aws-prod
        instance_id: i-123
        name: MarcoTasksSSMConnectionLost
        sync_time:
          nanos: 630000000
          seconds: 1729264793
    region: eu-west-2
  integration: teleportdev
  issue_type: ec2-ssm-agent-connection-lost
  state: OPEN
  task_type: discover-ec2
version: v1
---
kind: user_task
metadata:
  expires:
    nanos: 266377000
    seconds: 1729265153
  name: a6a22f27-60d7-5b80-b309-3540b199f00e
  revision: a4e7b5a6-bbfd-45be-b810-9303acebf218
spec:
  discover_ec2:
    account_id: "123456789012"
    instances:
      i-123:
        discovery_config: dc001
        discovery_group: aws-prod
        instance_id: i-123
        name: MarcoTasksSSMNotRegistered02
        sync_time:
          nanos: 810000000
          seconds: 1729264792
      i-123:
        discovery_config: dc001
        discovery_group: aws-prod
        instance_id: i-123
        name: MarcoTasksSSMNotRegistered
        sync_time:
          nanos: 102000000
          seconds: 1729264793
    region: eu-west-2
  integration: teleportdev
  issue_type: ec2-ssm-agent-not-registered
  state: OPEN
  task_type: discover-ec2
version: v1
---
kind: user_task
metadata:
  expires:
    nanos: 532998000
    seconds: 1729265153
  name: f07cd290-1893-579e-9126-327529fd364e
  revision: 2271fdf5-79a4-4139-9b36-285d1be0a1f1
spec:
  discover_ec2:
    account_id: "123456789012"
    instances:
      i-123:
        discovery_config: dc001
        discovery_group: aws-prod
        instance_id: i-123
        name: MarcoTasksSSMUnsupportedOS
        sync_time:
          nanos: 364000000
          seconds: 1729264793
    region: eu-west-2
  integration: teleportdev
  issue_type: ec2-ssm-unsupported-os
  state: OPEN
  task_type: discover-ec2
version: v1

@marcoandredinis marcoandredinis added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v16 labels Oct 18, 2024
@marcoandredinis marcoandredinis force-pushed the marco/usertasks_discoverec2_instance_name branch 2 times, most recently from 085cb40 to 152de86 Compare October 21, 2024 11:25
@marcoandredinis
Copy link
Contributor Author

@camscale Can you please take a look when you get a chance?

lib/srv/server/ssm_install.go Outdated Show resolved Hide resolved
@marcoandredinis marcoandredinis force-pushed the marco/usertasks_discoverec2_instance_name branch from 152de86 to 6adf514 Compare October 22, 2024 12:56
@marcoandredinis marcoandredinis added this pull request to the merge queue Oct 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 22, 2024
@marcoandredinis marcoandredinis added this pull request to the merge queue Oct 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 22, 2024
@marcoandredinis marcoandredinis added this pull request to the merge queue Oct 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 22, 2024
@marcoandredinis marcoandredinis force-pushed the marco/usertasks_discoverec2_instance_name branch from 6adf514 to c65e484 Compare October 22, 2024 14:14
@marcoandredinis marcoandredinis added this pull request to the merge queue Oct 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 22, 2024
@marcoandredinis marcoandredinis added this pull request to the merge queue Oct 22, 2024
Merged via the queue into master with commit 82e120d Oct 22, 2024
39 checks passed
@marcoandredinis marcoandredinis deleted the marco/usertasks_discoverec2_instance_name branch October 22, 2024 15:12
@public-teleport-github-review-bot

@marcoandredinis See the table below for backport results.

Branch Result
branch/v16 Failed

marcoandredinis added a commit that referenced this pull request Oct 22, 2024
)

* Add instance name to DiscoverEC2 User Task failed instances list

* use stdlib slices and maps
marcoandredinis added a commit that referenced this pull request Oct 25, 2024
)

* Add instance name to DiscoverEC2 User Task failed instances list

* use stdlib slices and maps
marcoandredinis added a commit that referenced this pull request Oct 28, 2024
)

* Add instance name to DiscoverEC2 User Task failed instances list

* use stdlib slices and maps
github-merge-queue bot pushed a commit that referenced this pull request Oct 28, 2024
…nstances (#47618)

* Create DiscoverEC2 User Tasks for failed EC2 enrollments

This PR changes the DiscoveryService to start creating and updating
Discover EC2 User Tasks.

So, what are Discover EC2 User Tasks?
When users set up Auto Discover for EC2 Instances, they don't have a
good way of checking for issues on their configured matchers.

We created User Tasks as a way to warn Users that something's wrong.
Each User Task should describe an issue that happened and a way to fix
it.
This has potential to be used to report unexpected events trough the
whole system, which are not errors per se, but something the user should
take action in order to improve the situation.
In this case, we are creating a sub type of those tasks: DiscoverEC2.

From now on, when the DiscoveryService fails to auto-enroll an instance,
it will create a DiscoverEC2 User Task grouping all the failed instances
by the following props:
- integration
- issue type
- account id
- region

A follow up PR will also create notifications so that the user can
actually be notified on those User Tasks and take action.

* improve naming and split function into multiple methods

* rename task issues variable name

* fix context early cancelation

* UserTasks: Add SSM Document and Installer for DiscoverEC2 Issues (#47626)

This PR adds two new fields to the DiscoverEC2 User Task.
SSM Document used to install teleport
Teleport Installer script name used to install teleport

This can be used to let the user know which scripts were used.
For the SSM Document, users can then open it in webui.
For the Installer Script, users can manage it using `tctl` client.

* Add instance name to DiscoverEC2 User Task failed instances list (#47712)

* Add instance name to DiscoverEC2 User Task failed instances list

* use stdlib slices and maps

* remove 1.23+ methods from slices and maps packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v16 discovery no-changelog Indicates that a PR does not require a changelog entry size/md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants