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

Ignore resources created in 0.8.x #1241

Closed
pebrc opened this issue Jul 15, 2019 · 3 comments · Fixed by #1286
Closed

Ignore resources created in 0.8.x #1241

pebrc opened this issue Jul 15, 2019 · 3 comments · Fixed by #1286
Assignees
Labels
>enhancement Enhancement of existing functionality justdoit Continuous improvement not related to a specific feature v0.9.0

Comments

@pebrc
Copy link
Collaborator

pebrc commented Jul 15, 2019

We are not (yet) offering backwards compatibility in ECK. To avoid disruptive operator upgrades we should ignore any cluster created via an 0.8.x operator.

Needs design how to actually do that. Some ideas:

Why do we need this 'other' attribute?
Because we would ignore newly created resources otherwise in 0.9 that also don't have a controller revision annotation

  • What other attribute could we use?
    We could look at common.k8s.elastic.co/type. So if a resource has common.k8s.elastic.co/type but does not have a controller revision ignore it because it is not created by this operator version.
@pebrc pebrc changed the title Ignore clusters created in 0.8.x Ignore resources created in 0.8.x Jul 15, 2019
@pebrc pebrc added the v0.9.0 label Jul 15, 2019
@sebgl
Copy link
Contributor

sebgl commented Jul 15, 2019

We could look at common.k8s.elastic.co/type

Which resource do you have in mind here? I guess any pod/secret/configmap could work, but not the Elasticsearch resource itself?

@pebrc
Copy link
Collaborator Author

pebrc commented Jul 15, 2019

I think I did not realise that we are not applying the label I used in the example to the top level resources. So we have to look that the sub resources created by the controller that have those annotations.

@sebgl
Copy link
Contributor

sebgl commented Jul 15, 2019

Summary of a discussion with @pebrc:

  • The ES resource is not labeled at all when handled by ECK 0.8 (btw it would be a bit strange to label an ES resource with type=elasticsearch since the resource Kind is Elasticsearch already).
  • Once we have an annotation in place on the ES resource, it's easy to identify which ECK version handled it. But the annotation is not there when the resource is initially created by the user.
  • So we'd like to keep the annotation mechanism to tag versions to resources, but we also need a way to identify resources that were just created and don't have this annotation set (yet).

Proposal:

  • At the beginning of each reconciliation, retrieve the current resource version from annotations
    • if the annotation is set, use it (eg. return 0.9)
    • if the annotation isn't set, 2 possibilities:
      a. the resource was just created and does not have the annotation yet
      b. the resource was created with ECK 0.8
    • To detect if we are in case b, list pods and secrets labeled with the ES cluster name (or APM or Kibana): if there are some, then the resource was created with ECK 0.8 (return 0.8). If there are none (length 0), return noVersion. Listing pods and secrets from the cache should be a very cheap operation.
  • Check compatibility of the resource version with the operator version. Each ECK version comes with its own comparison logic (but in most cases, it should probably just check the annotated resource version is in the backward compatibility range of the operator version).
  • If not compatible, log and return. Don't reconcile.
  • If compatible:
    • Make sure the resource is annotated with the current operator version. If it isn't, annotate it and requeue. What we want to avoid here is moving on with creating pods/secrets while the resource isn't yet annotated in the cache (we would end up in the 0.8 scenario if newly created pods and secrets appear in the cache before the annotated resource appears).
    • Move on to normal reconciliation

@sebgl sebgl added the justdoit Continuous improvement not related to a specific feature label Jul 17, 2019
@pebrc pebrc added the >enhancement Enhancement of existing functionality label Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality justdoit Continuous improvement not related to a specific feature v0.9.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants