Skip to content

Conversation

@t-kikuc
Copy link
Member

@t-kikuc t-kikuc commented Jun 18, 2024

What this PR does / why we need it:

  • Implemented LiveStateStore & LiveStateReporter for ECS.
    • They fetch ECS resources' states and report them to the Control Plane.
  • NOT yet:
    • Standalone tasks are NOT supported yet.
      • That's because we need additional logic to fetch standalone tasks.
    • UI is NOT implemented yet.
    • DriftDetection is NOT implemented yet.

Which issue(s) this PR fixes:

Fixes #4905

Does this PR introduce a user-facing change?: NO

  • How are users affected by this change: NO
  • Is this breaking change: NO
  • How to migrate (if breaking change): NO

How it works

  • Resources to store:

    • for states:
      • Service
      • TaskSet
      • Task
    • for Drift Detection:
      • Service
      • TaskDefinition

    Note: Only services that have the pipecd-dev-application tag will be stored.

  • Image

    • Example of the state of an application:

      {
          "application_id": "8da4d78d-7d33-4146-b664-6843ea0edbaf",
          "piped_id": "27535d51-0dc7-4e42-8359-a0f5019aebb8",
          "project_id": "test-project",
          "kind": 5,
          "ecs": {
              "resources": [
                  {
                      "id": "arn:aws:ecs:ap-northeast-1:<account-id>:service/t-kikuc-dev-cluster/ecs-diff-bool",
                      "owner_ids": [
                          "arn:aws:ecs:ap-northeast-1:<account-id>:cluster/t-kikuc-dev-cluster"
                      ],
                      "parent_ids": [
                          "arn:aws:ecs:ap-northeast-1:<account-id>:cluster/t-kikuc-dev-cluster"
                      ],
                      "name": "ecs-diff-bool",
                      "kind": "Service",
                      "health_status": 1,
                      "health_description": "Service's status is ACTIVE",
                      "created_at": 1718709026,
                      "updated_at": 1718709026
                  },
                  {
                      "id": "arn:aws:ecs:ap-northeast-1:<account-id>:task-set/t-kikuc-dev-cluster/ecs-diff-bool/ecs-svc/9473360680098220823",
                      "owner_ids": [
                          "arn:aws:ecs:ap-northeast-1:<account-id>:service/t-kikuc-dev-cluster/ecs-diff-bool"
                      ],
                      "parent_ids": [
                          "arn:aws:ecs:ap-northeast-1:<account-id>:service/t-kikuc-dev-cluster/ecs-diff-bool"
                      ],
                      "name": "arn:aws:ecs:ap-northeast-1:<account-id>:task-set/t-kikuc-dev-cluster/ecs-diff-bool/ecs-svc/9473360680098220823",
                      "kind": "TaskSet",
                      "health_status": 1,
                      "health_description": "TaskSet's status is PRIMARY",
                      "created_at": 1718710039,
                      "updated_at": 1718710100
                  },
                  {
                      "id": "arn:aws:ecs:ap-northeast-1:<account-id>:task/t-kikuc-dev-cluster/999a56ede3ae4eba854492bb9d847572",
                      "owner_ids": [
                          "arn:aws:ecs:ap-northeast-1:<account-id>:task-set/t-kikuc-dev-cluster/ecs-diff-bool/ecs-svc/9473360680098220823"
                      ],
                      "parent_ids": [
                          "arn:aws:ecs:ap-northeast-1:<account-id>:task-set/t-kikuc-dev-cluster/ecs-diff-bool/ecs-svc/9473360680098220823"
                      ],
                      "name": "arn:aws:ecs:ap-northeast-1:<account-id>:task/t-kikuc-dev-cluster/999a56ede3ae4eba854492bb9d847572",
                      "kind": "Task",
                      "health_description": "Task's last status is RUNNING and the health status is UNKNOWN",
                      "created_at": 1718710046,
                      "updated_at": 1718710046
                  },
                  {
                      "id": "arn:aws:ecs:ap-northeast-1:<account-id>:task/t-kikuc-dev-cluster/b83478ea8e8d4b7f9428ebbb0bf570e1",
                      "owner_ids": [
                          "arn:aws:ecs:ap-northeast-1:<account-id>:task-set/t-kikuc-dev-cluster/ecs-diff-bool/ecs-svc/9473360680098220823"
                      ],
                      "parent_ids": [
                          "arn:aws:ecs:ap-northeast-1:<account-id>:task-set/t-kikuc-dev-cluster/ecs-diff-bool/ecs-svc/9473360680098220823"
                      ],
                      "name": "arn:aws:ecs:ap-northeast-1:<account-id>:task/t-kikuc-dev-cluster/b83478ea8e8d4b7f9428ebbb0bf570e1",
                      "kind": "Task",
                      "health_description": "Task's last status is RUNNING and the health status is UNKNOWN",
                      "created_at": 1718710046,
                      "updated_at": 1718710046
                  }
              ]
          },
          "version": {
              "timestamp": 1718710910
          }
      }
    • UI will be like this (not implemented yet):
      ui

t-kikuc added 30 commits May 3, 2024 21:54
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
This reverts commit cbac8ed.

Signed-off-by: t-kikuc <[email protected]>
This reverts commit 9304b16.

Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
ffjlabo
ffjlabo previously approved these changes Jul 18, 2024
Copy link
Member

@ffjlabo ffjlabo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@t-kikuc t-kikuc enabled auto-merge (squash) July 18, 2024 07:09
@t-kikuc
Copy link
Member Author

t-kikuc commented Jul 22, 2024

@Warashi
Sorry, would you please approve again?
I added some tests in eb96de8.

Warashi
Warashi previously approved these changes Jul 22, 2024
Copy link
Member

@Warashi Warashi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@t-kikuc t-kikuc dismissed stale reviews from Warashi and ffjlabo via 8f376e5 July 22, 2024 08:26
Signed-off-by: t-kikuc <[email protected]>
ffjlabo
ffjlabo previously approved these changes Jul 22, 2024
t-kikuc added 2 commits July 22, 2024 17:35
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: t-kikuc <[email protected]>
@t-kikuc t-kikuc merged commit 586ae47 into master Jul 22, 2024
@t-kikuc t-kikuc deleted the ecs-live-state-store branch July 22, 2024 08:51
This was referenced Jul 29, 2024
This was referenced Aug 13, 2024
@github-actions github-actions bot mentioned this pull request Aug 26, 2024
This was referenced Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ECS] Implement LiveStateStore&Reporter for ECS

4 participants