-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added ChaosHub, Environments, Chaos Infrastructure pages
Signed-off-by: Hrishav <hrishav.kumar@harness.io>
- Loading branch information
1 parent
adf92ba
commit 51d4a67
Showing
133 changed files
with
8,138 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
chaoscenter/web/src/api/core/infrastructures/connectChaosInfra.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { gql, useMutation } from '@apollo/client'; | ||
import type { GqlAPIMutationRequest, GqlAPIMutationResponse } from '@api/types'; | ||
import type { Toleration } from '@models'; | ||
import type { InfrastructureInstallationType } from '@api/entities'; | ||
|
||
export interface connectChaosInfraRequest { | ||
projectID: string; | ||
request: { | ||
name: string; | ||
environmentID: string; | ||
description?: string; | ||
platformName: string; | ||
infraNamespace?: string; | ||
serviceAccount?: string; | ||
infraScope: string; | ||
infraNsExists?: boolean; | ||
infraSaExists?: boolean; | ||
skipSsl?: boolean; | ||
nodeSelector?: string; | ||
tolerations?: Array<Toleration>; | ||
infrastructureType?: InfrastructureInstallationType; | ||
tags?: Array<string>; | ||
}; | ||
} | ||
|
||
export interface connectChaosInfraManifestModeResponse { | ||
registerInfra: { | ||
manifest: string; | ||
}; | ||
} | ||
|
||
export function connectChaosInfraManifestMode( | ||
options?: GqlAPIMutationRequest<connectChaosInfraManifestModeResponse, connectChaosInfraRequest> | ||
): GqlAPIMutationResponse<connectChaosInfraManifestModeResponse, connectChaosInfraRequest> { | ||
const [connectChaosInfraMutation, result] = useMutation< | ||
connectChaosInfraManifestModeResponse, | ||
connectChaosInfraRequest | ||
>( | ||
gql` | ||
mutation registerInfra($projectID: ID!, $request: RegisterInfraRequest!) { | ||
registerInfra(projectID: $projectID, request: $request) { | ||
manifest | ||
} | ||
} | ||
`, | ||
options | ||
); | ||
|
||
return [connectChaosInfraMutation, result]; | ||
} |
29 changes: 29 additions & 0 deletions
29
chaoscenter/web/src/api/core/infrastructures/deleteKubernetesChaosInfrastructure.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { gql, useMutation } from '@apollo/client'; | ||
import type { GqlAPIMutationRequest, GqlAPIMutationResponse } from '@api/types'; | ||
|
||
export interface DeleteKubernetesChaosInfraRequest { | ||
projectID: string; | ||
infraID: string; | ||
} | ||
|
||
export interface DeleteKubernetesChaosInfraResponse { | ||
deleteChaosInfra: string; | ||
} | ||
|
||
export function deleteKubernetesChaosInfra( | ||
options?: GqlAPIMutationRequest<DeleteKubernetesChaosInfraResponse, DeleteKubernetesChaosInfraRequest> | ||
): GqlAPIMutationResponse<DeleteKubernetesChaosInfraResponse, DeleteKubernetesChaosInfraRequest> { | ||
const [deleteChaosInfraMutation, result] = useMutation< | ||
DeleteKubernetesChaosInfraResponse, | ||
DeleteKubernetesChaosInfraRequest | ||
>( | ||
gql` | ||
mutation deleteInfra($projectID: ID!, $infraID: String!) { | ||
deleteInfra(projectID: $projectID, infraID: $infraID) | ||
} | ||
`, | ||
options | ||
); | ||
|
||
return [deleteChaosInfraMutation, result]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
export * from './deleteKubernetesChaosInfrastructure'; | ||
export * from './getKubernetesChaosInfrastructureManifest'; | ||
export * from './testKubernetesChaosInfrastructureConnection'; | ||
export * from './getVersionDetails'; | ||
export * from './listKubernetesChaosInfrastructure'; | ||
export * from './getKubeObject'; |
35 changes: 35 additions & 0 deletions
35
chaoscenter/web/src/api/core/infrastructures/testKubernetesChaosInfrastructureConnection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { gql, useMutation } from '@apollo/client'; | ||
import type { GqlAPIMutationRequest, GqlAPIMutationResponse } from '@api/types'; | ||
|
||
export interface TestKubernetesChaosInfrastructureConnectionRequest { | ||
projectID: string; | ||
infraId: string; | ||
} | ||
|
||
export interface TestKubernetesChaosInfrastructureConnectionResponse { | ||
testKubernetesInfraConnection: boolean; | ||
} | ||
|
||
export function testKubernetesChaosInfrastructureConnection( | ||
options?: GqlAPIMutationRequest< | ||
TestKubernetesChaosInfrastructureConnectionResponse, | ||
TestKubernetesChaosInfrastructureConnectionRequest | ||
> | ||
): GqlAPIMutationResponse< | ||
TestKubernetesChaosInfrastructureConnectionResponse, | ||
TestKubernetesChaosInfrastructureConnectionRequest | ||
> { | ||
const [testKubernetesChaosInfrastructureConnectionMutation, result] = useMutation< | ||
TestKubernetesChaosInfrastructureConnectionResponse, | ||
TestKubernetesChaosInfrastructureConnectionRequest | ||
>( | ||
gql` | ||
mutation testKubernetesChaosInfrastuctureConnection($projectID: ID!, $infraId: String!) { | ||
testKubernetesInfraConnection(projectID: $projectID, infraId: $infraId) | ||
} | ||
`, | ||
options | ||
); | ||
|
||
return [testKubernetesChaosInfrastructureConnectionMutation, result]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import { gql, useMutation } from '@apollo/client'; | ||
import type { Identifiers, Probe, ProbeType } from '@api/entities'; | ||
import type { GqlAPIMutationRequest, GqlAPIMutationResponse } from '@api/types'; | ||
|
||
export interface AddProbeRequest { | ||
identifiers: Identifiers; | ||
request: { | ||
probeId?: string; | ||
name: string; | ||
description?: string; | ||
tags?: Array<string>; | ||
type: ProbeType; | ||
httpProperties?: Probe['httpProperties']; | ||
cmdProperties?: Probe['cmdProperties']; | ||
k8sProperties?: Probe['k8sProperties']; | ||
promProperties?: Probe['promProperties']; | ||
}; | ||
} | ||
|
||
export interface AddProbeResponse { | ||
addProbe: Probe; | ||
} | ||
|
||
export function addHTTPProbe( | ||
options?: GqlAPIMutationRequest<AddProbeResponse, AddProbeRequest> | ||
): GqlAPIMutationResponse<AddProbeResponse, AddProbeRequest> { | ||
const [addHTTPProbeMutation, result] = useMutation<AddProbeResponse, AddProbeRequest>( | ||
gql` | ||
mutation addHTTPProbe($request: ProbeRequest!, $identifiers: IdentifiersRequest!) { | ||
addProbe(request: $request, identifiers: $identifiers) { | ||
probeId | ||
name | ||
description | ||
type | ||
httpProperties { | ||
probeTimeout | ||
interval | ||
url | ||
insecureSkipVerify | ||
} | ||
} | ||
} | ||
`, | ||
options | ||
); | ||
|
||
return [addHTTPProbeMutation, result]; | ||
} | ||
|
||
export function addCMDProbe( | ||
options?: GqlAPIMutationRequest<AddProbeResponse, AddProbeRequest> | ||
): GqlAPIMutationResponse<AddProbeResponse, AddProbeRequest> { | ||
const [addCMDProbeMutation, result] = useMutation<AddProbeResponse, AddProbeRequest>( | ||
gql` | ||
mutation addCMDProbe($request: ProbeRequest!, $identifiers: IdentifiersRequest!) { | ||
addProbe(request: $request, identifiers: $identifiers) { | ||
probeId | ||
name | ||
description | ||
type | ||
cmdProperties { | ||
probeTimeout | ||
interval | ||
command | ||
comparator { | ||
type | ||
value | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
options | ||
); | ||
|
||
return [addCMDProbeMutation, result]; | ||
} | ||
|
||
export function addPROMProbe( | ||
options?: GqlAPIMutationRequest<AddProbeResponse, AddProbeRequest> | ||
): GqlAPIMutationResponse<AddProbeResponse, AddProbeRequest> { | ||
const [addPROMProbeMutation, result] = useMutation<AddProbeResponse, AddProbeRequest>( | ||
gql` | ||
mutation addPROMProbe($request: ProbeRequest!, $identifiers: IdentifiersRequest!) { | ||
addProbe(request: $request, identifiers: $identifiers) { | ||
probeId | ||
name | ||
description | ||
type | ||
promProperties { | ||
probeTimeout | ||
interval | ||
retry | ||
comparator { | ||
type | ||
value | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
options | ||
); | ||
|
||
return [addPROMProbeMutation, result]; | ||
} | ||
|
||
export function addK8SProbe( | ||
options?: GqlAPIMutationRequest<AddProbeResponse, AddProbeRequest> | ||
): GqlAPIMutationResponse<AddProbeResponse, AddProbeRequest> { | ||
const [addK8SProbeMutation, result] = useMutation<AddProbeResponse, AddProbeRequest>( | ||
gql` | ||
mutation addK8SProbe($request: ProbeRequest!, $identifiers: IdentifiersRequest!) { | ||
addProbe(request: $request, identifiers: $identifiers) { | ||
probeId | ||
name | ||
description | ||
type | ||
k8sProperties { | ||
probeTimeout | ||
interval | ||
retry | ||
group | ||
version | ||
resource | ||
namespace | ||
} | ||
} | ||
} | ||
`, | ||
options | ||
); | ||
|
||
return [addK8SProbeMutation, result]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { gql, useMutation } from '@apollo/client'; | ||
import type { Identifiers } from '@api/entities'; | ||
import type { GqlAPIMutationRequest, GqlAPIMutationResponse } from '@api/types'; | ||
|
||
export interface DeleteProbeRequest { | ||
identifiers: Identifiers; | ||
probeID: string; | ||
} | ||
|
||
export interface DeleteProbeResponse { | ||
deleteProbe: boolean; | ||
} | ||
|
||
export function deleteProbe( | ||
options?: GqlAPIMutationRequest<DeleteProbeResponse, DeleteProbeRequest> | ||
): GqlAPIMutationResponse<DeleteProbeResponse, DeleteProbeRequest> { | ||
const [deleteProbeMutation, result] = useMutation<DeleteProbeResponse, DeleteProbeRequest>( | ||
gql` | ||
mutation deleteChaosHub($probeID: ID!, $identifiers: IdentifiersRequest!) { | ||
deleteProbe(probeID: $probeID, identifiers: $identifiers) | ||
} | ||
`, | ||
options | ||
); | ||
|
||
return [deleteProbeMutation, result]; | ||
} |
Oops, something went wrong.