Skip to content
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

Use annotation to track created remote clusters #2891

Merged
merged 5 commits into from
Apr 16, 2020

Conversation

barkbay
Copy link
Contributor

@barkbay barkbay commented Apr 16, 2020

The PR fixes an issue where the annotation used to cache the Elasticsearch state wrt remote clusters may become inconsistent and could prevent some updates to be applied.

The annotation is kept but only to track the remote clusters that have been previously managed by ECK. In order to be consistent with the other API calls in ECK the algorithm never tries to optimize the number of calls performed on the ES cluster.

It can be noted that it still exists an edge case where ECK may delete a cluster managed by the user:

  1. Remote cluster remote-foo is declared as remote in the Spec
  2. User decides to manage this cluster itself, remote-foo is removed from the spec
  3. ECK is stopped or is to slow to update the annotation
  4. User creates remote-foo manually
  5. ECK is started or is finally proceeding the cluster removal from the spec, deleting remote-foo 💥

At each iteration a log is printed with the upserted and deleted remote clusters.

Last PR to completely fix #2864 , related to #2880

@anyasabo I think it should be included in 1.1.0 to avoid a mix of "remote clusters related" labels on Elasticsearch resources in the future.

@barkbay barkbay added >bug Something isn't working v1.1.0 labels Apr 16, 2020
Copy link
Collaborator

@pebrc pebrc left a comment

Choose a reason for hiding this comment

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

LGTM

if err != nil {
return remoteClustersInEs, err
}
for remoteClusterName := range remoteClusterSettings.PersistentSettings.Cluster.RemoteClusters {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess we can ignore transient settings for the purposes of this function?

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 is the assumption I made since we are only interested in clusters created by ECK.

Copy link
Contributor

@sebgl sebgl left a comment

Choose a reason for hiding this comment

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

LGTM

pkg/controller/elasticsearch/remotecluster/annotations.go Outdated Show resolved Hide resolved
// 3.1 Schedule its deletion from the Elasticsearch settings
// 3.2 Otherwise remove it from the annotation
// 4. Update the annotation on the Elasticsearch object
// 5. Apply the settings through the Elasticsearch API
Copy link
Contributor

Choose a reason for hiding this comment

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

I love that sort of comment 👍

@barkbay
Copy link
Contributor Author

barkbay commented Apr 16, 2020

Jenkins test this please

@barkbay barkbay merged commit 2e89579 into elastic:master Apr 16, 2020
@barkbay barkbay deleted the fix-remote-cluster-annotation branch April 16, 2020 13:29
barkbay added a commit to barkbay/cloud-on-k8s that referenced this pull request Apr 16, 2020
* Use annotation to track created remote clusters
barkbay added a commit that referenced this pull request Apr 16, 2020
* Use annotation to track created remote clusters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug Something isn't working v1.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not cache Elasticsearch settings in annotations
3 participants