-
Notifications
You must be signed in to change notification settings - Fork 123
Support advanced settings in fleet policy #1545
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
base: main
Are you sure you want to change the base?
Conversation
…lts. Change MonitoringRuntimeExperimental type from Bool to String.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for configuring advanced settings in Fleet agent policies, enabling control over agent logging, resource limits, and download behavior. The implementation follows the established pattern for advanced monitoring options and includes comprehensive version validation.
Key changes:
- Introduces
advanced_settingsattribute to the agent policy resource with 10 configurable fields - Implements version checking to ensure the feature is only used with Elasticsearch 8.17.0+
- Updates the API conversion logic to align with the behavior for advanced monitoring options (sending default values to allow resets)
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/fleet/agent_policy/schema.go | Defines the advanced_settings schema with logging, CPU limit, and download configuration fields; adds UseStateForUnknown plan modifiers to existing attributes |
| internal/fleet/agent_policy/models.go | Implements advancedSettingsModel struct, API conversion methods, and populates state from API responses |
| internal/fleet/agent_policy/resource.go | Adds minimum version constant (8.17.0) and feature detection for advanced settings support |
| internal/fleet/agent_policy/models_test.go | Contains unit tests for advanced settings conversion and updates existing tests to validate sending default values |
| internal/fleet/agent_policy/version_test.go | Validates version checking behavior for advanced settings in create and update operations |
| internal/fleet/agent_policy/acc_test.go | Provides end-to-end acceptance tests covering creation, updates, removal, and default value scenarios |
| internal/fleet/agent_policy/testdata/* | Terraform configuration files for acceptance test scenarios |
| docs/resources/fleet_agent_policy.md | Documents the new advanced_settings attribute and its nested fields |
| CHANGELOG.md | Records the feature addition |
tobio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| } | ||
|
|
||
| // populateAdvancedSettingsFromAPI populates the advanced settings from API response | ||
| func (model *agentPolicyModel) populateAdvancedSettingsFromAPI(ctx context.Context, data *kbapi.AgentPolicy) diag.Diagnostics { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is getting pretty big. WDYT about pulling these out to models_advanced_settings.go etc?
| settings := advancedSettingsModel{} | ||
|
|
||
| // Logging level | ||
| if data.AdvancedSettings.AgentLoggingLevel != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we open an issue in the Kibana repo to fixup the typing in the openapi spec for these fields.
Fixes #1116
Plus some follow-up fixes for #984