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

Add metadata field to ES role model #7927

Merged
merged 6 commits into from
Jul 5, 2024

Conversation

n1v0lg
Copy link
Contributor

@n1v0lg n1v0lg commented Jul 3, 2024

Elasticsearch roles also include a metadata field (docs).

This PR updates the Role model accordingly.

Relates: ES-8909

@n1v0lg n1v0lg self-assigned this Jul 3, 2024
@botelastic botelastic bot added the triage label Jul 3, 2024
@thbkrkr thbkrkr added the >enhancement Enhancement of existing functionality label Jul 3, 2024
@botelastic botelastic bot removed the triage label Jul 3, 2024
@botelastic botelastic bot removed the triage label Jul 3, 2024
Cluster []string `json:"cluster,omitempty"`
Indices []IndexRole `json:"indices,omitempty"`
Applications []ApplicationRole `json:"applications,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems reasonable. The original PR that implemented this:

https://github.com/elastic/cloud-on-k8s/pull/426/files#diff-8529b163021d25abbacbdccef966e4be6e2430b357fa6eafa299e23efd1f184bR48

had Metadata as a slightly different field. What was the intent of the previous design @thbkrkr (since you made the change).

Looking back over v6, v7, and v8 of Elasticsearch, this metadata field has existed in the same form object, so I see no backwards compatibility issues with this change.

Copy link
Contributor

@thbkrkr thbkrkr Jul 3, 2024

Choose a reason for hiding this comment

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

AFAIR, there was no real intention, it was unnecessary premature anticipation. I had left in comments, because not used, different fields seen in an ES response that we could potentially have used one day. We removed them in #2777.
I think the small change of this PR is ok. Nit: we could use the any alias which is more pleasant to read:

Metadata     map[string]any `json:"metadata,omitempty"`

Copy link
Contributor Author

@n1v0lg n1v0lg Jul 4, 2024

Choose a reason for hiding this comment

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

Thanks both. I pushed the readability improvement

@n1v0lg n1v0lg marked this pull request as ready for review July 4, 2024 10:44
@thbkrkr
Copy link
Contributor

thbkrkr commented Jul 4, 2024

buildkite test this -f p=gke,E2E_TAGS=es -m s=7.17.8,s=8.14.1,s=8.15.0-SNAPSHOT

@n1v0lg
Copy link
Contributor Author

n1v0lg commented Jul 5, 2024

buildkite test this -f p=gke,E2E_TAGS=es -m s=7.17.8,s=8.14.1,s=8.15.0-SNAPSHOT

@n1v0lg
Copy link
Contributor Author

n1v0lg commented Jul 5, 2024

@thbkrkr thanks for the review! Could you merge this once CI is green? Turns out I don't have permissions to merge.

@thbkrkr thbkrkr merged commit 3751246 into main Jul 5, 2024
5 checks passed
@thbkrkr thbkrkr deleted the add-metadata-to-es-client-role-model branch July 5, 2024 17:54
@barkbay barkbay added the exclude-from-release-notes Exclude this PR from appearing in the release notes label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality exclude-from-release-notes Exclude this PR from appearing in the release notes v2.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants