add ecs agent install/uninstall/status commands with --max-learning-period#32
add ecs agent install/uninstall/status commands with --max-learning-period#32matthyx wants to merge 3 commits into
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Free Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR introduces a complete ECS agent installation and management CLI feature. It adds an ChangesECS Agent Installation and Management
🎯 3 (Moderate) | ⏱️ ~25 minutes Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds a new armoctl ecs agent command group that deploys and manages an ECS Agent (daemon) plus an ECS Operator (single replica) via an embedded CloudFormation template, mirroring the existing ecs operator UX and flow. It also introduces a --max-learning-period install flag that is passed through to the agent as a stack parameter/environment variable.
Changes:
- Add
armoctl ecs agent install|status|uninstallsubcommands under the existingecsroot command. - Embed and deploy a CloudFormation template for agent + operator, including a MaxLearningPeriod parameter.
- Add CloudFormation helpers to create/describe/delete stacks and wait on stack lifecycle.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| ecs/ecs.go | Registers the new ecs agent command under the existing ECS command tree. |
| ecs/agent/agent.go | Introduces AgentCmd, default stack naming, and ECS cluster ARN parsing utilities. |
| ecs/agent/install.go | Implements ecs agent install, including --max-learning-period passthrough and stack creation/wait. |
| ecs/agent/status.go | Implements ecs agent status with colored status output and failed-resource listing. |
| ecs/agent/uninstall.go | Implements ecs agent uninstall with confirmation prompt and stack deletion/wait. |
| ecs/agent/cloudformation.go | Adds CloudFormation client helpers for stack CRUD, polling, and failed event retrieval. |
| ecs/agent/template.go | Embeds the CloudFormation YAML into the binary. |
| ecs/agent/template.yaml | Defines IAM roles, agent daemon service/task, operator service/task, parameters, and outputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cloudwatchLogs, _ := cmd.Flags().GetString("cloudwatch-logs") | ||
| maxLearningPeriod, _ := cmd.Flags().GetString("max-learning-period") | ||
|
|
||
| params := StackParams{ | ||
| StackName: stackName, | ||
| Region: cluster.Region, | ||
| ClusterName: cluster.ClusterName, | ||
| CustomerGUID: viper.GetString("customer-guid"), | ||
| AccessKey: viper.GetString("access-key"), | ||
| APIUrl: viper.GetString("api-url"), | ||
| CloudWatchLogs: cloudwatchLogs, | ||
| MaxLearningPeriod: maxLearningPeriod, | ||
| } |
| // defaultStackName returns the default CloudFormation stack name for a cluster. | ||
| func defaultStackName(clusterName string) string { | ||
| return StackNamePrefix + clusterName |
| - The ECS Agent daemon service | ||
| - The ECS Operator service |
| - Name: API_URL | ||
| Value: !Ref ApiUrl | ||
| - Name: KS_LOGGER_LEVEL | ||
| Value: debug |
…iod support Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
60ec451 to
1776aff
Compare
…eployment - Add requireAuth() guard to install so empty credentials are caught before any AWS call is made - Replace shell-command printer with AWS SDK CreateStack + polling wait, eliminating the access-key leak into shell history and terminal logs - Add status and uninstall subcommands (CloudFormation describe / delete + wait, colour-coded output, failure diagnostics with CloudWatch log tail) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
armoctl ecs agent install/uninstall/statuscommands mirroring the existingecs operatorpatterninstallexposes--max-learning-periodto set the agent's maximum container learning period at deploy timeUsage
Test plan
armoctl ecs agent installdeploys the CloudFormation stack successfully--max-learning-period 5mis passed through to the stack parameterarmoctl ecs agent statusshows stack status and ARNsarmoctl ecs agent uninstall -ydeletes the stack🤖 Generated with Claude Code
Summary by CodeRabbit
armoctl ecs agent installcommand to deploy ARMO agent and operator to ECS clusters via CloudFormation, with configurable cluster selection, CloudWatch logging, and learning period settings.armoctl ecs agent statuscommand to check deployment status, including stack health, resource ARNs, and failed event details with colorized status display.armoctl ecs agent uninstallcommand to remove deployments with confirmation prompts.