-
Notifications
You must be signed in to change notification settings - Fork 3
/
querys.ts
41 lines (35 loc) · 1.38 KB
/
querys.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import * as kq from "@pulumi/query-kubernetes";
export async function querysts() {
return kq
.list("apps/v1", "StatefulSet")
//.flatMap(sts => sts.status.currentReplicas)
//.map(sts => sts.status)
.filter(sts => sts.status.readyReplicas>0 && sts.metadata.name=="quickstart-es-master")
.first();
}
/*
export async function addToZ(): Promise<boolean> {
for await (const e of kq.watch("v1", "Event")) {
const { apiVersion, kind, name } = e.object.involvedObject;
if (
apiVersion === "apps/v1" &&
kind === "StatefulSet" &&
name === "quickstart-es-elastic-user"
) {
console.log("inigo rules");
const sts = kq
.list("apps/v1", "StatefulSet")
//.flatMap(sts => sts.status.currentReplicas)
//.map(sts => sts.status)
.filter(sts => sts.status.readyReplicas>0 && sts.metadata.name=="quickstart-es-master")
.first();
const { type, reason, message } = e.object;
if (reason == "SuccessfulCreate")
sts.then({
//console.log(`${type} [${reason}] ${message}`);
return true;
}
);
}
return false;
}*/