Skip to content

Commit

Permalink
feat: Litmus 3.0: Added enhancements in graphql (litmuschaos#4025)
Browse files Browse the repository at this point in the history
* Added base setup for graphql and authentication protos

Signed-off-by: Saranya-jena <[email protected]>

* Added graphql schemas

Signed-off-by: Saranya-jena <[email protected]>

* Added cluster and namespace scope manifests

Signed-off-by: Saranya-jena <[email protected]>

* Added utilities and environment variables

Signed-off-by: Saranya-jena <[email protected]>

* Added logger and authentication middleware

Signed-off-by: Saranya-jena <[email protected]>

* Added api and mongodb handler functions for chaos experiments, experiment runs and infra

Signed-off-by: Saranya-jena <[email protected]>

* Added api and mongodb handler functions for chaoshub, environment, grpc and project

Signed-off-by: Saranya-jena <[email protected]>

* Added api and mongodb handler functions for image registry, gitopns and file handlers

Signed-off-by: Saranya-jena <[email protected]>

* Updated go version

Signed-off-by: Saranya-jena <[email protected]>

* Removed unused packages and chaoshub test suite

Signed-off-by: Saranya-jena <[email protected]>

---------

Signed-off-by: Saranya-jena <[email protected]>
  • Loading branch information
Saranya-jena authored and SohamRatnaparkhi committed Jun 29, 2023
1 parent 3b8a5b9 commit d8d4f14
Show file tree
Hide file tree
Showing 107 changed files with 54,642 additions and 0 deletions.
788 changes: 788 additions & 0 deletions chaoscenter/graphql/definitions/shared/chaos_experiment.graphqls

Large diffs are not rendered by default.

667 changes: 667 additions & 0 deletions chaoscenter/graphql/definitions/shared/chaos_infrastructure.graphqls

Large diffs are not rendered by default.

655 changes: 655 additions & 0 deletions chaoscenter/graphql/definitions/shared/chaoshub.graphqls

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions chaoscenter/graphql/definitions/shared/common.graphqls
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

interface ResourceDetails {
name: String!
description: String
tags:[String!]
}

interface Audit {
updatedAt: String
createdAt: String
updatedBy: UserDetails
createdBy: UserDetails
}

type UserDetails {
userID: String!
username: String!
email: String!
}

116 changes: 116 additions & 0 deletions chaoscenter/graphql/definitions/shared/environment.graphqls
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@

enum EnvironmentType{
PROD
NON_PROD
}

type Environment implements ResourceDetails & Audit {
projectID:String!
environmentID : String!
name: String!
description: String
tags:[String!]
type: EnvironmentType!
createdAt: String!
createdBy: UserDetails
updatedBy: UserDetails
updatedAt: String!
isRemoved: Boolean
infraIDs:[String!]
}

input CreateEnvironmentRequest{
environmentID : String! #check if human readable ID is required
name: String!
type: EnvironmentType!
description: String
tags:[String!]
}

input UpdateEnvironmentRequest{
environmentID : String!
name: String
description: String
tags:[String]
type: EnvironmentType
}

"""
Defines filter options for infras
"""
input EnvironmentFilterInput {
"""
Name of the environment
"""
name: String
"""
ID of the environment
"""
description: String
"""
Type name of environment
"""
type: String
"""
Tags of an environment
"""
tags: [EnvironmentType]
}
enum EnvironmentSortingField {
NAME
TIME
}

"""
Defines sorting options for experiment
"""
input EnvironmentSortInput {
"""
Field in which sorting will be done
"""
field: EnvironmentSortingField!
"""
Bool value indicating whether the sorting will be done in ascending order
"""
ascending: Boolean
}


input ListEnvironmentRequest{
"""
Environment ID
"""
environmentIDs: [ID!]
"""
Details for fetching paginated data
"""
pagination: Pagination
"""
Details for fetching filtered data
"""
filter: EnvironmentFilterInput
"""
Details for fetching sorted data
"""
sort: EnvironmentSortInput
}

type ListEnvironmentResponse{
"""
Total number of environment
"""
totalNoOfEnvironments: Int!
environments:[Environment]
}

extend type Query {

getEnvironment(projectID: ID!, environmentID: ID!) : Environment @authorized
listEnvironments (projectID: ID!, request: ListEnvironmentRequest): ListEnvironmentResponse @authorized
}

extend type Mutation{
createEnvironment( projectID:ID!,request:CreateEnvironmentRequest): Environment @authorized
updateEnvironment( projectID:ID!,request:UpdateEnvironmentRequest): String! @authorized
deleteEnvironment(projectID:ID!,environmentID: ID!): String! @authorized
}
126 changes: 126 additions & 0 deletions chaoscenter/graphql/definitions/shared/gitops.graphqls
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@

"""
Defines the SSHKey details
"""
type SSHKey {
"""
Public SSH key authenticating into git repository
"""
publicKey: String!
"""
Private SSH key authenticating into git repository
"""
privateKey: String!
}

"""
Details of setting a Git repository
"""
input GitConfig {
"""
ID of the project where GitOps is configured
"""
projectID: ID!
"""
Git branch where the chaos charts will be pushed and synced
"""
branch: String!
"""
URL of the Git repository
"""
repoURL: String!
"""
Type of authentication used: BASIC, SSH, TOKEN
"""
authType: AuthType!
"""
Token used for private repository
"""
token: String
"""
Git username
"""
userName: String
"""
Git password
"""
password: String
"""
Private SSH key authenticating into git repository
"""
sshPrivateKey: String
}

"""
Response received after configuring GitOps
"""
type GitConfigResponse {
"""
Bool value indicating whether GitOps is enabled or not
"""
enabled: Boolean!
"""
ID of the project where GitOps is configured
"""
projectID: String!
"""
Git branch where the chaos charts will be pushed and synced
"""
branch: String
"""
URL of the Git repository
"""
repoURL: String
"""
Type of authentication used: BASIC, SSH, TOKEN
"""
authType: AuthType
"""
Token used for private repository
"""
token: String
"""
Git username
"""
userName: String
"""
Git password
"""
password: String
"""
Private SSH key authenticating into git repository
"""
sshPrivateKey: String
}

extend type Query {
# GIT-OPS OPERATIONS
"""
Returns the git configuration for gitops
"""
getGitOpsDetails(projectID: ID!): GitConfigResponse! @authorized
}

extend type Mutation {
# GIT-OPS OPERATIONS
"""
Sends workflow run request(single run workflow only) to agent on gitops notification
"""
# authorized directive not required
gitopsNotifier(clusterInfo: InfraIdentity!, workflowID: ID!): String!

"""
Enables gitops settings in the project
"""
enableGitOps(configurations: GitConfig!): Boolean! @authorized

"""
Disables gitops settings in the project
"""
disableGitOps(projectID: String!): Boolean! @authorized

"""
Updates gitops settings in the project
"""
updateGitOps(configurations: GitConfig!): Boolean! @authorized
}
Loading

0 comments on commit d8d4f14

Please sign in to comment.