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 workload management querygroup api specs #649

Merged
merged 4 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
tests: plugins/notifications
- version: 2.17.0
tests: plugins/query_insights
- version: 2.17.0
tests: plugins/wlm
- version: 2.18.0
hub: opensearchstaging
ref: '@sha256:57a1cd1142d68c203e2e4aa0666d9a691e1e409a5d14aa4a8f5044036f05cf06'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `config_id` and `config_id_list` to `/_plugins/_notifications/configs` query parameters ([#594](https://github.com/opensearch-project/opensearch-api-specification/pull/594))
- Added a release workflow triggered on a tag ([#635](https://github.com/opensearch-project/opensearch-api-specification/pull/635))
- Added API spec for query insights plugin ([#625](https://github.com/opensearch-project/opensearch-api-specification/pull/625))
- Added API specs for query groups lifecycle APIs ([#649](https://github.com/opensearch-project/opensearch-api-specification/pull/649))
Copy link
Member

Choose a reason for hiding this comment

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

@ruai0511 I missed this, but we released 0.1.0, could you please move this in another PR to the unreleased section? thanks

- Added API spec for `adjust_pure_negative` for bool queries ([#641](https://github.com/opensearch-project/opensearch-api-specification/pull/641))
- Added a spec style checker [#620](https://github.com/opensearch-project/opensearch-api-specification/pull/620).
- Added `remote_store` to node `Stats` ([#643](https://github.com/opensearch-project/opensearch-api-specification/pull/643))
Expand Down
127 changes: 127 additions & 0 deletions spec/namespaces/query_group.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
openapi: 3.1.0
ruai0511 marked this conversation as resolved.
Show resolved Hide resolved
info:
title: OpenSearch Workload Management Query Group API
description: Query group lifecycle APIs for the workload management plugin.
version: 1.0.0
paths:
/_wlm/query_group:
get:
operationId: query_group.get.0
x-operation-group: query_group.get
x-version-added: '2.17'
description: Gets the specified QueryGroup or get all if no name is provided.
responses:
'200':
$ref: '#/components/responses/query_group.get@200'
put:
operationId: query_group.create.0
x-operation-group: query_group.create
x-version-added: '2.17'
description: Creates a specified query group.
requestBody:
$ref: '#/components/requestBodies/query_group.create'
responses:
'200':
$ref: '#/components/responses/query_group.create@200'
/_wlm/query_group/{name}:
get:
operationId: query_group.get.1
x-operation-group: query_group.get
x-version-added: '2.17'
description: Gets the specified QueryGroup or get all if no name is provided.
parameters:
- $ref: '#/components/parameters/query_group.get::path.name'
responses:
'200':
$ref: '#/components/responses/query_group.get@200'
put:
operationId: query_group.update.0
x-operation-group: query_group.update
x-version-added: '2.17'
description: Updates a specified query group.
parameters:
- $ref: '#/components/parameters/query_group.update::path.name'
requestBody:
$ref: '#/components/requestBodies/query_group.update'
responses:
'200':
$ref: '#/components/responses/query_group.update@200'
delete:
operationId: query_group.delete.1
x-operation-group: query_group.delete
x-version-added: '2.17'
description: Deletes the specified QueryGroups or delete all if no name is provided.
parameters:
- $ref: '#/components/parameters/query_group.delete::path.name'
responses:
'200':
$ref: '#/components/responses/query_group.delete@200'
components:
requestBodies:
query_group.create:
content:
application/json:
schema:
$ref: '../schemas/query_group._common.yaml#/components/schemas/QueryGroupCreate'
required: true
query_group.update:
content:
application/json:
schema:
$ref: '../schemas/query_group._common.yaml#/components/schemas/QueryGroupUpdate'
required: true
responses:
query_group.create@200:
description: ''
content:
application/json:
schema:
$ref: '../schemas/query_group._common.yaml#/components/schemas/QueryGroupResponse'
query_group.update@200:
description: ''
content:
application/json:
schema:
$ref: '../schemas/query_group._common.yaml#/components/schemas/QueryGroupResponse'
query_group.delete@200:
description: ''
content:
application/json:
schema:
type: object
properties:
acknowledged:
type: boolean
query_group.get@200:
description: ''
content:
application/json:
schema:
type: object
properties:
query_groups:
type: array
items:
$ref: '../schemas/query_group._common.yaml#/components/schemas/QueryGroupResponse'
parameters:
query_group.update::path.name:
name: name
in: path
description: QueryGroup name.
schema:
type: string
required: true
query_group.delete::path.name:
name: name
in: path
description: QueryGroup name.
schema:
type: string
required: true
query_group.get::path.name:
name: name
in: path
description: QueryGroup name.
schema:
type: string
required: true
100 changes: 100 additions & 0 deletions spec/schemas/query_group._common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
openapi: 3.1.0
info:
title: Schemas of wlm._common category
description: Schemas of wlm._common category
version: 1.0.0
paths: {}
components:
schemas:
QueryGroupResponse:
type: object
properties:
_id:
type: string
name:
type: string
resiliency_mode:
type: string
enum: [enforced, monitor,soft]
updated_at:
type: integer
format: int64
resource_limits:
anyOf:
- type: object
properties:
memory:
type: number
format: double
cpu:
type: number
format: double
required:
- memory
- type: object
properties:
memory:
type: number
format: double
cpu:
type: number
format: double
required:
- cpu
required:
- _id
- name
- resiliency_mode
- resource_limits
- updated_at
QueryGroupCreate:
type: object
properties:
name:
type: string
resiliency_mode:
type: string
enum: [enforced, monitor,soft]
resource_limits:
anyOf:
- type: object
properties:
memory:
type: number
format: double
cpu:
type: number
format: double
required:
- memory
- type: object
properties:
memory:
type: number
format: double
cpu:
type: number
format: double
required:
- cpu
required:
- name
- resiliency_mode
- resource_limits
QueryGroupUpdate:
type: object
properties:
resiliency_mode:
type: string
enum: [enforced, monitor,soft]
resource_limits:
$ref: '#/components/schemas/ResourceLimitsSchema'
ResourceLimitsSchema:
type: object
properties:
memory:
type: number
format: double
cpu:
type: number
format: double
6 changes: 6 additions & 0 deletions tests/plugins/wlm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG OPENSEARCH_DOCKER_HUB_PROJECT
ARG OPENSEARCH_VERSION
ARG OPENSEARCH_DOCKER_REF

FROM ${OPENSEARCH_DOCKER_HUB_PROJECT}/opensearch:${OPENSEARCH_VERSION}${OPENSEARCH_DOCKER_REF}

Check failure on line 5 in tests/plugins/wlm/Dockerfile

View workflow job for this annotation

GitHub Actions / check

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'OpenSearch' instead of 'opensearch'. Raw Output: {"message": "[Vale.Terms] Use 'OpenSearch' instead of 'opensearch'.", "location": {"path": "tests/plugins/wlm/Dockerfile", "range": {"start": {"line": 5, "column": 39}}}, "severity": "ERROR"}
RUN ./bin/opensearch-plugin install -b workload-management

Check failure on line 6 in tests/plugins/wlm/Dockerfile

View workflow job for this annotation

GitHub Actions / check

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'OpenSearch' instead of 'opensearch'. Raw Output: {"message": "[Vale.Terms] Use 'OpenSearch' instead of 'opensearch'.", "location": {"path": "tests/plugins/wlm/Dockerfile", "range": {"start": {"line": 6, "column": 11}}}, "severity": "ERROR"}
17 changes: 17 additions & 0 deletions tests/plugins/wlm/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3'

services:
opensearch-cluster:

Check failure on line 4 in tests/plugins/wlm/docker-compose.yml

View workflow job for this annotation

GitHub Actions / check

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'OpenSearch' instead of 'opensearch'. Raw Output: {"message": "[Vale.Terms] Use 'OpenSearch' instead of 'opensearch'.", "location": {"path": "tests/plugins/wlm/docker-compose.yml", "range": {"start": {"line": 4, "column": 3}}}, "severity": "ERROR"}
build:
context: .
args:

Check failure on line 7 in tests/plugins/wlm/docker-compose.yml

View workflow job for this annotation

GitHub Actions / check

[vale] reported by reviewdog 🐶 [OpenSearch.Spelling] Error: args. If you are referencing a setting, variable, format, function, or repository, surround it with tic marks. Raw Output: {"message": "[OpenSearch.Spelling] Error: args. If you are referencing a setting, variable, format, function, or repository, surround it with tic marks.", "location": {"path": "tests/plugins/wlm/docker-compose.yml", "range": {"start": {"line": 7, "column": 7}}}, "severity": "ERROR"}
- OPENSEARCH_DOCKER_HUB_PROJECT=${OPENSEARCH_DOCKER_HUB_PROJECT:-opensearchproject}
- OPENSEARCH_DOCKER_REF=${OPENSEARCH_DOCKER_REF}
- OPENSEARCH_VERSION=2.17.0
ports:
- 9200:9200
- 9600:9600
environment:
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD:-myStrongPassword123!}
- OPENSEARCH_JAVA_OPTS=${OPENSEARCH_JAVA_OPTS}
- discovery.type=single-node

Check failure on line 17 in tests/plugins/wlm/docker-compose.yml

View workflow job for this annotation

GitHub Actions / check

[vale] reported by reviewdog 🐶 [OpenSearch.SpacingPunctuation] There should be no space before and one space after the punctuation mark in 'discovery.type'. Raw Output: {"message": "[OpenSearch.SpacingPunctuation] There should be no space before and one space after the punctuation mark in 'discovery.type'.", "location": {"path": "tests/plugins/wlm/docker-compose.yml", "range": {"start": {"line": 17, "column": 9}}}, "severity": "ERROR"}
67 changes: 67 additions & 0 deletions tests/plugins/wlm/query_group/query_group.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
$schema: ../../../../json_schemas/test_story.schema.yaml
ruai0511 marked this conversation as resolved.
Show resolved Hide resolved

description: This story tests all endpoints relevant to QueryGroups, from creation to deletion.

prologues:
- path: /_wlm/query_group
version: '>= 2.17'
method: PUT
request:
payload:
name: analytics
resource_limits:
memory: 0.1
resiliency_mode: monitor
status: [200]
- path: /_wlm/query_group
version: '>= 2.17'
method: PUT
request:
payload:
name: analytics2
resource_limits:
memory: 0.15
cpu: 0.05
resiliency_mode: monitor
status: [200]

chapters:
- synopsis: Update the QueryGroup named `analytics2`, with resiliency_mode to be enforced and memory to be 0.25 and cpu to be 0.25.
version: '>= 2.17'
path: /_wlm/query_group/{name}
method: PUT
parameters:
name: analytics2
request:
payload:
resource_limits:
memory: 0.25
cpu: 0.25
resiliency_mode: enforced
response:
status: 200
- synopsis: Get the QueryGroup named `analytics2`.
version: '>= 2.17'
path: /_wlm/query_group/{name}
method: GET
parameters:
name: analytics2
response:
status: 200
payload:
query_groups:
- name: analytics2
resource_limits:
memory: 0.25
cpu: 0.25
resiliency_mode: enforced

epilogues:
- path: /_wlm/query_group/analytics
version: '>= 2.17'
method: DELETE
status: [200]
- path: /_wlm/query_group/analytics2
version: '>= 2.17'
method: DELETE
status: [200]
Loading