Skip to content

feat(fleetcontrol): Add a new package to support managing Fleet Control Ops#1794

Merged
pranav-new-relic merged 17 commits intomainfrom
fleet-control-starts-here
Feb 19, 2026
Merged

feat(fleetcontrol): Add a new package to support managing Fleet Control Ops#1794
pranav-new-relic merged 17 commits intomainfrom
fleet-control-starts-here

Conversation

@pranav-new-relic
Copy link
Member

@pranav-new-relic pranav-new-relic commented Feb 19, 2026

Overview

This PR introduces a complete set of Fleet Control commands for managing New Relic's Fleet Management system, providing CLI access to fleets, configurations, deployments, and entity management.

🚀 Features

Core Command Structure

Implemented a new fleetcontrol package with a YAML-driven command generation framework that provides:

  • Declarative command definitions - Commands defined in YAML with automatic flag generation
  • Type-safe flag handling - Strongly-typed flag access with validation
  • Automatic help text generation - Rich help and examples from YAML configuration
  • Consistent error handling - Unified error reporting across all commands

Command Categories

1. Fleet Management (newrelic fleetcontrol fleet)

  • create - Create a new fleet with name and optional description
  • get - Retrieve fleet details by GUID
  • update - Update fleet name and/or description
  • delete - Delete a fleet by GUID
  • search - Search fleets with optional name filter

2. Fleet Members (newrelic fleetcontrol fleet members)

  • add-members - Add entities to a fleet
  • remove-members - Remove entities from a fleet
  • list-members - List all members of a fleet with filtering and pagination

3. Configuration Management (newrelic fleetcontrol configuration)

  • create - Create fleet configuration with schema and variables
  • get - Retrieve configuration by GUID or entity GUID
  • delete - Delete a configuration
  • Version Management:
    • add-version - Add new version to configuration
    • list-versions - List all versions of a configuration
    • delete-version - Delete a specific version

4. Deployment Management (newrelic fleetcontrol deployment)

  • create - Create new deployment with agent type and version specification
  • update - Update deployment parameters
  • delete - Remove a deployment
  • deploy - Execute deployment with confirmation/force options

5. Entity Management (newrelic fleetcontrol entities)

  • get-managed - List entities managed by Fleet Control
  • get-unassigned - List entities not assigned to any fleet

Technical Highlights

YAML-Driven Command Framework

name: fleet-create
use: create
short: Create a new fleet
flags:
  - name: name
    type: string
    required: true
    description: The name of the fleet
    validation:
      minLength: 1
      maxLength: 256

Commands are automatically generated from YAML definitions with:

  • Flag registration and validation
  • Help text and examples
  • Required/optional flag handling
  • Type conversion and safety

📝 Documentation

README.md

Comprehensive documentation including:

  • Prerequisites and setup instructions
  • Available commands quick reference
  • Detailed command usage with examples
  • Response format documentation
  • Validation rules reference
  • Troubleshooting guide
  • Workflow examples (create fleet, configure, deploy)

…, configuration, deployments and more

Adds complete fleet control functionality with a modular, YAML-driven command framework:

Fleet Management:
- Create, get, update, delete, and search fleet entities
- Bulk delete support with --ids flag
- Type-safe flag accessors and declarative validation

Configuration Management:
- Create, get, delete configurations
- Add, list, and delete configuration versions
- Split file flags: --configuration-file-path (recommended) and --configuration-content (testing)
- Renamed --entity-guid to --configuration-guid in get-versions for clarity
- Empty results validation with meaningful error messages

Deployment & Members:
- Create and update fleet deployments
- Add and remove fleet members with ring support

Response Format:
- Consistent JSON output with status/error fields across all commands
- Search and get-configuration return raw data for table formatting
- Field ordering preserved (status first, error second)

Framework Features:
- YAML configs embedded at compile time with validation
- Generated typed flag structs for compile-time safety
- Shared helpers for output formatting and type mapping
- Strict file reading (file type flags require valid file paths)

Documentation:
- Comprehensive README with command examples and jq usage
- Validation testing guide with JSON response examples
- Complete API reference for all commands

Go Client Integration:
- Uses local client via go.mod replace directive
- Fixed delete operations to handle empty API responses
Restructured README.md to be more intuitive and user-friendly:

- Added clear introduction with Fleet Control capabilities overview
- Added comprehensive prerequisites section with:
  - Required environment variables (NEW_RELIC_API_KEY, NEW_RELIC_ACCOUNT_ID)
  - Step-by-step guide for getting credentials
  - Build and verification instructions
- Added "Available Commands" quick reference section listing all commands
- Reorganized content flow:
  1. Introduction and directory structure
  2. Commands quick reference
  3. Prerequisites and setup
  4. Detailed command reference
  5. Response formats and jq usage
  6. Validation rules
  7. Troubleshooting
- Added practical workflow examples for common use cases
- Added debug mode instructions for troubleshooting
- Added authentication error troubleshooting
- Kept experimental commands (deployment and member management) clearly marked
Add new deployment delete command:
- Created fleet_deployment_delete.yaml config
- Created fleet_deployment_delete.go handler
- Added DeleteDeploymentFlags to command_flags_generated.go
- Added PrintDeploymentDeleteSuccess helper function
- Registered command in command_fleet.go

Enhanced README:
- Added comprehensive table of contents with all sections
- Updated command hierarchy to include delete deployment
- Added documentation for delete deployment command
- Updated directory structure listing
- Add individual command entries under each category in TOC
- Update all command headers to include full syntax in backticks
- Format: `fleetcontrol <resource> <action>` for better discoverability
- All 20 commands now have consistent header formatting
@pranav-new-relic pranav-new-relic force-pushed the fleet-control-starts-here branch from 0534250 to 3491c3d Compare February 19, 2026 07:48
Removed integration and unit tests that reference commands that no longer exist:
- command_fleet_config_test.go (cmdFleetGetConfiguration, cmdFleetAddVersion)
- command_fleet_test.go (cmdFleetAddMembers, cmdFleetRemoveMembers, cmdFleetCreateConfiguration)
- command_configuration_integration_test.go
- command_fleet_integration_test.go
- command_deployment_members_integration_test.go
- command_test.go

These tests were causing build failures with undefined references.
…tag conversion

Changed from struct literal to direct type conversion when converting
EntityManagementTag to FleetControlTag, as both types have identical
structure. This resolves gosimple linter warning S1016.

- Before: fleetcontrol.FleetControlTag{Key: tag.Key, Values: tag.Values}
- After: fleetcontrol.FleetControlTag(tag)
Copy link
Contributor

@shashank-reddy-nr shashank-reddy-nr left a comment

Choose a reason for hiding this comment

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

LGTM

@pranav-new-relic pranav-new-relic marked this pull request as ready for review February 19, 2026 08:17
- Remove non-existent TOC entries (Building the CLI, For Developers, Recent Updates)
- Condense Getting Your Credentials section for brevity
- Add note about user capabilities in Verifying Setup section
- Fix flag name: change --include-tags to --show-tags in fleet members list command
- Add missing periods at end of complete sentences in validation and optional flag descriptions
- Improve consistency of punctuation throughout the document
- No content changes, only punctuation fixes for better readability
Copy link
Contributor

@shashank-reddy-nr shashank-reddy-nr left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@nr-developer-toolkit nr-developer-toolkit left a comment

Choose a reason for hiding this comment

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

looks good to me too, @pranav-new-relic

@pranav-new-relic
Copy link
Member Author

Thank you @shashank-reddy-nr @nr-developer-toolkit ; shipping this 🚀

@pranav-new-relic pranav-new-relic merged commit 910bd6b into main Feb 19, 2026
29 checks passed
@pranav-new-relic pranav-new-relic deleted the fleet-control-starts-here branch February 19, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments