-
Notifications
You must be signed in to change notification settings - Fork 735
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
New CRD StackConfigPolicy to declaratively configure multiple Elasticsearch clusters #6148
Conversation
23d1510
to
0af90a6
Compare
e554722
to
d052970
Compare
d052970
to
c736740
Compare
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.
Nice work! I did a first pass just by looking at the code. Will do some testing next.
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.
I did some tests. Looks really good. One oddity I noticed during testing is that errors during snapshot repository creation are actually not surfaced through the reserved cluster state but only through Elasticsearch logs. However that's not something we can fix here but maybe interesting to discuss with the Elasticsearch team. I tried both using GKE Workload Identity and explicit service account credentials, which both worked fine. The former is quite compelling as you don't have to configure any credentials inside the cluster and the policy just works with minimal delay (no rolling restarts!)
- getclusterstate only supported in v8 es client - adjust godoc - helper struct to simplify collecting telemetry - rename UpdateResourceStatusInPhase to AddPolicyErrorFor - refactor status.Update() - take into account es version errors in policy status - no finalizers - group var declaration - lookup in a nil map is safe - remove useless getters - simplification - remove dead code - better assertions in Test_newSettingsSecret - fix comment typos
1684b3b
to
828a939
Compare
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.
Haven't finished the code review, and haven't tested yet, but some initial comments.
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.
Almost LGTM!
} | ||
requests := make([]reconcile.Request, 0) | ||
for _, stackConfig := range stackConfigList.Items { | ||
stackConfig := stackConfig |
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.
Just to clarify I consider this a nice to have optimisation and not critical for this to be merged
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.
I did a quick review as I wanted to give it a try and understand how the feature is implemented.
Overall LGTM 👍 , I only left a few cosmetic comments.
- typo: s/Error/Errors/ - typo: s/Human/human - comment phaseOrder map - ensure AddPolicyErrorFor is called once per named resource - wrap error from GetSecureSettingsSecretSources - add unit tests in TestGarbageCollectSoftOwnedSecrets and TestGarbageCollectAllSoftOwnedOrphanSecrets - improve error messages with types
If you would like to take another look, I've taken into account all your feedback. |
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!
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.
🚀
Thanks pebrc, naemono, barkbay! |
New custom resource
StackConfigPolicy
to configure cluster settings, snapshot repositorires and lifecycle policies for a list of Elasticsearch clusters matching a labels selector.Notables details:
The namespaces used to find Elasticsearch clusters to configure depend on the StackConfigPolicy namespace. If it is the operator namespace, all namespaces managed by the operator are used, otherwise only the StackConfigPolicy namespace.
A new FileSettings Secret
<esName>-es-file-settings
owns by Elasticsearch is created empty and mounted as data volume by the Elasticsearch controller. The StackConfigPolicy controller soft owns the Secret and only updates it. On deletion, soft owned labels are used to find Secrets to reset.For the SecureSettings Secrets defined in the StackConfigPolicy, the StackConfigPolicy controller writes the Secret namespaces and names in an annotation of the FileSettings Secret. The ES controller watches and reads the Secrets from that and merges their content with the user-provided Secrets of the Elasticsearch resource in the existing Secret
<esName>-es-secure-settings
.Discuss:
TODO: