1 | import { Configuration } from "@atomist/automation-client";
|
2 | import { ExecuteGoalResult, GoalInvocation, GoalScheduler } from "@atomist/sdm";
|
3 | import * as k8s from "@kubernetes/client-node";
|
4 |
|
5 |
|
6 |
|
7 | export interface KubernetesGoalSchedulerOptions {
|
8 | isolateAll?: boolean;
|
9 | }
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | export declare class KubernetesGoalScheduler implements GoalScheduler {
|
18 | private readonly options;
|
19 | private podSpec;
|
20 | constructor(options?: KubernetesGoalSchedulerOptions);
|
21 | supports(gi: GoalInvocation): Promise<boolean>;
|
22 | schedule(gi: GoalInvocation): Promise<ExecuteGoalResult>;
|
23 | /**
|
24 | * Extension point for sub classes to modify k8s resources or provided jobSpec before the
|
25 | * Job gets created in k8s.
|
26 | * Note: A potentially existing job with the same name has already been deleted at this point.
|
27 | * @param gi
|
28 | * @param jobSpec
|
29 | */
|
30 | protected beforeCreation(gi: GoalInvocation, jobSpec: k8s.V1Job): Promise<void>;
|
31 | /**
|
32 | * Extension point for sub classes to modify k8s resources after the job has been created.
|
33 | * The provided jobSpec contains the result of the job creation API call.
|
34 | * @param gi
|
35 | * @param jobSpec
|
36 | */
|
37 | protected afterCreation(gi: GoalInvocation, jobSpec: k8s.V1Job): Promise<void>;
|
38 | initialize(configuration: Configuration): Promise<void>;
|
39 | /**
|
40 | * Extension point to allow for custom clean up logic.
|
41 | */
|
42 | protected cleanUp(): Promise<void>;
|
43 | }
|
44 | /**
|
45 | * Cleanup scheduled k8s goal jobs
|
46 | * @returns {Promise<void>}
|
47 | */
|
48 | export declare function cleanCompletedJobs(): Promise<void>;
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | export declare function createJobSpec(podSpec: k8s.V1Pod, podNs: string, gi: GoalInvocation): k8s.V1Job;
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | export declare function isConfiguredInEnv(...values: string[]): boolean;
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | export declare function sanitizeName(name: string): string;
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | export declare function listJobs(labelSelector?: string): Promise<k8s.V1Job[]>;
|
73 | export declare function prettyPrintError(e: any): string;
|