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

Elasticsearch: Set status.ObservedGeneration from metadata.Generation. #5331

Merged
merged 22 commits into from
Feb 22, 2022

Conversation

naemono
Copy link
Contributor

@naemono naemono commented Feb 7, 2022

This change is Elasticsearch specific at the moment

related to #3392

This change allows status.ObservedGeneration to be kept in sync with metadata.Generation according to the rules described in the above issue. This change adds a set of unit tests which show more details into when observedGeneration will, and will not be updated according to any errors that may occur during ES reconciliation. All mutated end-to-end Elasticsearch tests include steps to show how this generation/observedGeneration change is intended to function in a true cluster.

@botelastic botelastic bot added the triage label Feb 7, 2022
@thbkrkr thbkrkr added the >enhancement Enhancement of existing functionality label Feb 7, 2022
@botelastic botelastic bot removed the triage label Feb 7, 2022
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.

The actual change looks good to me. I have some concerns about editing conflicts but those do not need to be solved in this PR. Other then that only a few comments on testing.

.gitignore Outdated Show resolved Hide resolved
pkg/apis/elasticsearch/v1/elasticsearch_types.go Outdated Show resolved Hide resolved
pkg/utils/k8s/fake.go Outdated Show resolved Hide resolved
test/e2e/es/observedGeneration_test.go Outdated Show resolved Hide resolved
test/e2e/es/observedGeneration_test.go Outdated Show resolved Hide resolved
test/e2e/es/observedGeneration_test.go Outdated Show resolved Hide resolved
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

test/e2e/test/elasticsearch/cluster_generation.go Outdated Show resolved Hide resolved
@naemono
Copy link
Contributor Author

naemono commented Feb 16, 2022

run full pr build

Set observedGeneration from metadata.generation when generating initial state during ES reconcile.
Make observedGeneration optional in spec.
Adjust docs for observedGeneration.
Add .DS_Store to git ignore.
Add tests for observedGeneration behavior.
Add e2e test for observedGeneration.
Adjust wording for state during ES reconciliation, as it's not a pointer.
Update ObservedGeneration documentation/comments.
Remove duplicative license header.
Use named field in test struct.
Remove specific es generation test.
Add generation test to all es mutation tests.
Update final generation e2e test step to be wrapped in test.Eventually
@naemono naemono force-pushed the 3392-set-status-observed-generation branch from fd11076 to 395986e Compare February 16, 2022 20:10
@naemono naemono merged commit 168ea70 into elastic:main Feb 22, 2022
@naemono naemono deleted the 3392-set-status-observed-generation branch February 22, 2022 14:03
@naemono naemono added the v2.1.0 label Mar 2, 2022
fantapsody pushed a commit to fantapsody/cloud-on-k8s that referenced this pull request Feb 7, 2023
elastic#5331)

* Add es.status.ObservedGeneration to ES spec.
Set observedGeneration from metadata.generation when generating initial state during ES reconcile.
Make observedGeneration optional in spec.
Adjust docs for observedGeneration.
Add .DS_Store to git ignore.
Add tests for observedGeneration behavior.
Add e2e test for observedGeneration.

* Move observedGeneration to be more alphabetical in struct.
Adjust wording for state during ES reconciliation, as it's not a pointer.

* Correct Spelling

* Update documentation in test

* Update test comments

* Update e2e test to just update annotations, not disable tls.

* remove unused ctx

* allow fake k8s client to be disable/enabled on demand

* directive `//nolint:gosimple` is unused for linter gosimple (nolintlint)

* Fix phantom lint error??

* no need for func in testing, just call DisableFailing

* Remove MacOS files from gitignore.
Update ObservedGeneration documentation/comments.
Remove duplicative license header.
Use named field in test struct.

* rename test file

* remove new build tag format from new e2e file.

* Removing changes associated with a failing k8s client.

* Update crd generation description.
Remove specific es generation test.
Add generation test to all es mutation tests.

* Correct runtime spelling.
Update final generation e2e test step to be wrapped in test.Eventually

* Use errors.New when not needing formatting.

* remove erroneous nolint

* s/CompareClusterGenerations/CompareClusterGenerationsSteps/g

* Fix indentation in state.go

* Adjust ES generation tests because of recent change concerning unknown status being set initially.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants