-
Notifications
You must be signed in to change notification settings - Fork 109
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
feat: add chaos mesh api description and table schema #633
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,9 @@ tags: | |
- name: Webhooks | ||
description: | | ||
This resource allows you to configure webhooks. | ||
- name: Chaos Experiments | ||
description: | | ||
This resource allows you to add chaos mesh experiments as part of the running job | ||
x-tagGroups: | ||
- name: Reference | ||
tags: | ||
|
@@ -1890,6 +1893,185 @@ paths: | |
application/json: | ||
schema: | ||
$ref: '#/components/schemas/upload_file_response' | ||
/v1/chaos-experiments: | ||
parameters: | ||
- $ref: '#/components/parameters/context_id' | ||
post: | ||
operationId: create-chaos-experiment | ||
tags: | ||
- Chaos Experiments | ||
summary: Create chaos file | ||
description: >- | ||
Create a chaos experiment. | ||
responses: | ||
'201': | ||
description: Success | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/chaosExperiment' | ||
'400': | ||
description: Bad request | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/error_response' | ||
'422': | ||
description: Unprocessable entity | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/error_response' | ||
'500': | ||
description: Internal server error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/error_response' | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/chaosExperiment' | ||
description: The chaos experiment to create | ||
required: true | ||
get: | ||
operationId: retrieve-all-choos-experiments | ||
tags: | ||
- Chaos Experiments | ||
summary: Retrieve all chaos experiments | ||
description: Retrieve all chaos experiments | ||
parameters: | ||
- in: query | ||
name: from | ||
description: From which result to start retrieve data - pagination | ||
required: false | ||
schema: | ||
type: integer | ||
minimum: 0 | ||
default: 0 | ||
- in: query | ||
name: limit | ||
description: Max results to return from this query ( Limit to 100 ) | ||
required: false | ||
schema: | ||
type: integer | ||
maximum: 200 | ||
default: 100 | ||
- in: query | ||
name: template | ||
description: filter to get templates only | ||
required: false | ||
schema: | ||
type: boolean | ||
example: true | ||
- in: query | ||
name: exclude | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd just a common option in the crud sometimes not to show everything |
||
description: fields to exclude from response | ||
required: false | ||
schema: | ||
type: array | ||
items: | ||
type: string | ||
enum: | ||
- kubeObject | ||
responses: | ||
'200': | ||
description: Success | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/chaosExperiment' | ||
'400': | ||
description: Bad request | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/error_response' | ||
'500': | ||
description: Internal server error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/error_response' | ||
/v1/chaos-experiments/{experiment_id}: | ||
parameters: | ||
- $ref: '#/components/parameters/context_id' | ||
get: | ||
operationId: retrieve-chaos-experiment | ||
tags: | ||
- Chaos Experiments | ||
summary: Retrieve chaos experiment | ||
description: Retrieve a specific chaos experiment. | ||
parameters: | ||
- in: path | ||
name: experiment_id | ||
description: The id of the experiment to retrieve. | ||
required: true | ||
schema: | ||
type: string | ||
responses: | ||
'200': | ||
description: Success | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/chaosExperiment' | ||
'400': | ||
description: Bad request | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/error_response' | ||
'404': | ||
description: Not found | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/error_response' | ||
'500': | ||
description: Internal server error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/error_response' | ||
delete: | ||
operationId: delete-chaos-experiment | ||
tags: | ||
- Chaos Experiments | ||
summary: Delete chaos experiment | ||
description: Delete a specific chaos experiment | ||
parameters: | ||
- in: path | ||
name: experiment_id | ||
description: The id of the experiment to retrieve. | ||
required: true | ||
schema: | ||
type: string | ||
responses: | ||
'204': | ||
description: Success | ||
'400': | ||
description: Bad request | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/error_response' | ||
'409': | ||
description: Conflict | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/error_response' | ||
'500': | ||
description: Internal server error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/error_response' | ||
|
||
components: | ||
parameters: | ||
context_id: | ||
|
@@ -2956,3 +3138,70 @@ components: | |
url: | ||
type: string | ||
description: Webhook url to post events | ||
chaosExperiment: | ||
required: | ||
- name | ||
- kind | ||
- namespace | ||
properties: | ||
id: | ||
description: Unique experiment identifier | ||
type: string | ||
format: uuid | ||
readOnly: true | ||
name: | ||
type: string | ||
minLength: 1 | ||
description: The name of the experiment. | ||
example: Custom javascript for logging | ||
kubeObject: | ||
$ref: '#/components/schemas/kubeObject' | ||
updated_at: | ||
type: string | ||
format: date-time | ||
description: The date and time that the procesor file was updated. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "procesor file" not relevant in this case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
readOnly: true | ||
created_at: | ||
type: string | ||
format: date-time | ||
description: The date and time that the procesor file was created. | ||
readOnly: true | ||
kubeObject: | ||
required: | ||
- apiVersion | ||
- kind | ||
- namespace | ||
- name | ||
- spec | ||
properties: | ||
apiVersion: | ||
type: string | ||
enum: | ||
- "chaos-mesh.org/v1alpha1" | ||
kind: | ||
type: string | ||
enum: | ||
- 'dnschaos' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one is small letters on purpose? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
- 'PodChaos' | ||
- 'AWSChaos' | ||
- 'HTTPChaos' | ||
- 'StressChaos' | ||
description: A description of the experiment. | ||
example: 'PodChaos' | ||
namespace: | ||
type: string | ||
example: "apps" | ||
name: | ||
type: string | ||
example: "my-pod-chaos" | ||
spec: | ||
type: object | ||
example: | ||
selector: | ||
namespaces: | ||
- apps | ||
labelSelectors: | ||
app: live-balances-api | ||
mode: all | ||
action: pod-kill | ||
duration: 1m |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const sequelizeConnector = require('./sequelize/sequelizeConnector'); | ||
const databaseConnector = sequelizeConnector; | ||
module.exports = { | ||
init, | ||
getAllChaosExperiments, | ||
insertChaosExperiment, | ||
getChaosExperimentById, | ||
getChaosExperimentByName, | ||
deleteChaosExperiment, | ||
closeConnection | ||
}; | ||
|
||
async function init() { | ||
return databaseConnector.init(); | ||
} | ||
|
||
function closeConnection() { | ||
return databaseConnector.closeConnection(); | ||
} | ||
|
||
async function insertChaosExperiment(experimentId, experiment, contextId) { | ||
return databaseConnector.insertChaosExperiment(experimentId, experiment, contextId); | ||
} | ||
|
||
async function getAllChaosExperiments(from, limit, exclude, contextId) { | ||
return databaseConnector.getAllChaosExperiments(from, limit, exclude, contextId); | ||
} | ||
|
||
async function getChaosExperimentById(experimentId, contextId) { | ||
return databaseConnector.getChaosExperimentById(experimentId, contextId); | ||
} | ||
|
||
async function getChaosExperimentByName(name, contextId) { | ||
return databaseConnector.getChaosExperimentByName(name, contextId); | ||
} | ||
|
||
async function deleteChaosExperiment(experimentId) { | ||
return databaseConnector.deleteChaosExperiment(experimentId); | ||
} |
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.
Isn't it irrelevant? all are templates
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.
removed - but I closed this MR please see #635