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

[Console] Update format of services.yaml #718

Conversation

mikaylathompson
Copy link
Collaborator

Description

The services.yaml file is the core location for information about the current deployment and making the implementation clean and easy to validate will be helpful moving forward.

There were a few recent comments regarding the file format in the reviews of the e2e branch merge & the OSI backfill additions:

For the second point, the idea is to move AWAY from:

source_cluster:
  authorization:
    type: basic_auth
    details:
      user: abc
      password: xyz

And towards:

source_cluster:
  basic_auth:
    username: abc
    password: xyz

In general, instead of having a type field, each service description should instead have a node with the name of the type that contains any relevant details. The schema validation can then be written to ensure that no mutually-exclusive nodes are present.

Notes on Approach

The bulk of this PR is updating documentation and tests--the actual schemas involved are quite small still (hence doing this refactoring now).

There was no built-in Cerberus rule to validate that exactly one block of a selection was present. I created a generator that returns a callable to verify that exactly one key from a given list is provided. I think this should be quite widely used throughout our schemas. I also think that this PR makes the schemas a bit more modularized and readable.

Issues Resolved

https://opensearch.atlassian.net/browse/MIGRATIONS-1754

Testing

Unit tests, manual

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Mikayla Thompson <thomika@amazon.com>
Signed-off-by: Mikayla Thompson <thomika@amazon.com>
Signed-off-by: Mikayla Thompson <thomika@amazon.com>
Signed-off-by: Mikayla Thompson <thomika@amazon.com>
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 97.29730% with 1 line in your changes missing coverage. Please review.

Project coverage is 62.96%. Comparing base (16c735b) to head (b1dc04f).
Report is 1 commits behind head on main.

Files Patch % Lines
...console_link/console_link/models/metrics_source.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #718      +/-   ##
============================================
- Coverage     63.29%   62.96%   -0.33%     
  Complexity     1579     1579              
============================================
  Files           220      231      +11     
  Lines          9156     9729     +573     
  Branches        793      793              
============================================
+ Hits           5795     6126     +331     
- Misses         2950     3195     +245     
+ Partials        411      408       -3     
Flag Coverage Δ
unittests 63.31% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Mikayla Thompson <thomika@amazon.com>
Signed-off-by: Mikayla Thompson <thomika@amazon.com>
@@ -17,33 +17,32 @@ For example:

```yaml
source_cluster:
endpoint: "https://capture-proxy-es:9200"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@@ -12,38 +13,47 @@
AuthMethod = Enum("AuthMethod", ["NO_AUTH", "BASIC_AUTH", "SIGV4"])
HttpMethod = Enum("HttpMethod", ["GET", "POST", "PUT", "DELETE"])


NO_AUTH_SCHEMA = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Do you have a link you can comment for what schema options like "nullable" are available for a schema

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mikaylathompson mikaylathompson merged commit 924de8e into opensearch-project:main Jun 15, 2024
9 checks passed
@mikaylathompson mikaylathompson deleted the services-yaml-format-update branch June 25, 2024 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants