-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d86d7d6
commit 27e2119
Showing
6 changed files
with
71 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"npm/npmjs/-/landing-page/0.1.0": "Theia Cloud Internal Package", | ||
"npm/npmjs/-/testing-page/0.1.0": "Theia Cloud Internal Package" | ||
"npm/npmjs/-/testing-page/0.1.0": "Theia Cloud Internal Package", | ||
"npm/npmjs/-/e2e-tests/0.12.0-next": "Theia Cloud Internal Package" | ||
} |
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 const namespace = 'theiacloud'; | ||
export const resourceGroup = 'theia.cloud'; | ||
export const resourceVersion = 'v1beta8'; | ||
export const resourcePlural = 'sessions'; | ||
export const sessionVersion = 'v1beta8'; | ||
export const sessionPlural = 'sessions'; | ||
export const workspaceVersion = 'v1beta5'; | ||
export const workspacePlural = 'workspaces'; |
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,44 @@ | ||
import { KubeConfig, CustomObjectsApi } from '@kubernetes/client-node'; | ||
import { namespace, resourceGroup, sessionPlural, sessionVersion, workspacePlural, workspaceVersion } from './constats'; | ||
|
||
const kc = new KubeConfig(); | ||
kc.loadFromDefault(); | ||
export const k8sApi = kc.makeApiClient(CustomObjectsApi); | ||
|
||
export async function deleteAllSessions(): Promise<void> { | ||
const sessions: any = await k8sApi.listNamespacedCustomObject( | ||
resourceGroup, | ||
sessionVersion, | ||
namespace, | ||
sessionPlural | ||
); | ||
|
||
for (const resource of sessions.body.items) { | ||
await k8sApi.deleteNamespacedCustomObject( | ||
resourceGroup, | ||
sessionVersion, | ||
namespace, | ||
sessionPlural, | ||
resource.metadata.name | ||
); | ||
} | ||
} | ||
|
||
export async function deleteAllWorkspaces(): Promise<void> { | ||
const sessions: any = await k8sApi.listNamespacedCustomObject( | ||
resourceGroup, | ||
workspaceVersion, | ||
namespace, | ||
workspacePlural | ||
); | ||
|
||
for (const resource of sessions.body.items) { | ||
await k8sApi.deleteNamespacedCustomObject( | ||
resourceGroup, | ||
workspaceVersion, | ||
namespace, | ||
workspacePlural, | ||
resource.metadata.name | ||
); | ||
} | ||
} |
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
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