Skip to content

[3.3] AutoOps: Ignore deprecated ES clusters (#9008)#9013

Merged
naemono merged 1 commit intoelastic:3.3from
naemono:backport/3.3/pr-9008
Jan 9, 2026
Merged

[3.3] AutoOps: Ignore deprecated ES clusters (#9008)#9013
naemono merged 1 commit intoelastic:3.3from
naemono:backport/3.3/pr-9008

Conversation

@naemono
Copy link
Contributor

@naemono naemono commented Jan 9, 2026

Backport

This will backport the following commits from main to 3.3:

Questions ?

Please refer to the Backport tool documentation

* AutoOps: Ignore deprecate ES clusters

---------

Signed-off-by: Michael Montgomery <mmontg1@gmail.com>
(cherry picked from commit a9d7a46)
@naemono naemono added the backport For backport PRs label Jan 9, 2026
@prodsecmachine
Copy link
Collaborator

prodsecmachine commented Jan 9, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@botelastic botelastic bot added the triage label Jan 9, 2026
@naemono naemono added the >enhancement Enhancement of existing functionality label Jan 9, 2026
@botelastic botelastic bot removed the triage label Jan 9, 2026
Copy link
Contributor

Copilot AI left a 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 is a backport from main to branch 3.3 that adds logic to skip deprecated Elasticsearch cluster versions in the AutoOps controller. When an ES cluster with a deprecated version (7.0.0 to 7.16.0) matches the AutoOps policy selector, it will be logged and ignored rather than having AutoOps agent deployments created for it.

Key Changes

  • Added version parsing and validation to check if ES clusters have deprecated versions before reconciling AutoOps resources
  • Improved log messages by removing redundant context (es_namespace and es_name) that's already in the logger
  • Added test coverage for the deprecated version scenario and improved existing test fixtures with version fields

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/controller/autoops/reconcile.go Added deprecated version check logic to skip ES clusters with versions 7.0.0-7.16.0, and cleaned up log messages to remove redundant context
pkg/controller/autoops/reconcile_test.go Added test case for deprecated ES version handling, added missing version fields to existing test fixtures, and improved test assertion error messages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +145 to +151
// No error means the version is within the deprecated range, so we skip the cluster.
// We do not adjust the status to indicate this issue at this time, as the status object
// does not currently support a status per-cluster.
if version.DeprecatedVersions.WithinRange(esVersion) == nil {
log.Info("Skipping ES cluster because of deprecated version", "version", es.Spec.Version)
continue
}
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

Deprecated ES clusters are included in the accessibleClusters list passed to cleanupOrphanedResourcesForPolicy, which prevents their associated resources from being cleaned up. However, these clusters are then skipped during reconciliation (line 150 continue), so no resources are actually created or maintained for them. This creates an inconsistency where old resources for deprecated clusters may remain in the cluster without being managed or cleaned up. Consider filtering deprecated clusters before passing to cleanupOrphanedResourcesForPolicy.

Copilot uses AI. Check for mistakes.
Comment on lines +146 to +149
// We do not adjust the status to indicate this issue at this time, as the status object
// does not currently support a status per-cluster.
if version.DeprecatedVersions.WithinRange(esVersion) == nil {
log.Info("Skipping ES cluster because of deprecated version", "version", es.Spec.Version)
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

When all matching ES clusters are deprecated, the status is left with Resources counted but no Phase set. This creates an ambiguous state where Resources=1, Ready=0, Errors=0, but Phase="". Consider setting an appropriate phase (or documenting this as expected behavior) to make the status more meaningful to users. For comparison, when resources exist but are not ready, the phase is explicitly set to ResourcesNotReadyPhase.

Suggested change
// We do not adjust the status to indicate this issue at this time, as the status object
// does not currently support a status per-cluster.
if version.DeprecatedVersions.WithinRange(esVersion) == nil {
log.Info("Skipping ES cluster because of deprecated version", "version", es.Spec.Version)
// We do not adjust the status to indicate this issue at this time on a per-cluster basis,
// but we do update the overall phase to indicate that resources are not in a usable state.
if version.DeprecatedVersions.WithinRange(esVersion) == nil {
log.Info("Skipping ES cluster because of deprecated version", "version", es.Spec.Version)
state.UpdateWithPhase(autoopsv1alpha1.ResourcesNotReadyPhase)

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this issue will likely be addressed when the extended status reporting issue is resolved/tackled

@naemono naemono merged commit 88978ae into elastic:3.3 Jan 9, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport For backport PRs >enhancement Enhancement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants