-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmeshrc-cm.yaml
523 lines (519 loc) · 24.5 KB
/
meshrc-cm.yaml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
apiVersion: v1
data:
.meshrc.yaml: |-
# merger: federation
sources:
- name: graphqlMeshK8s
handler:
openapi:
source: /work/swagger.json
baseUrl: http://mesh-svc:8001/
skipSchemaValidation: true
additionalTypeDefs: |
interface K8sResourceInterface {
kind: String
apiVersion: String
metadata: IoK8sApimachineryPkgApisMetaV1ObjectMeta
}
extend type IoK8sApiCoreV1ConfigMap implements K8sResourceInterface
extend type IoK8sApiCoreV1PersistentVolumeClaim implements K8sResourceInterface
extend type IoK8sApiCoreV1Secret implements K8sResourceInterface
extend type IoK8sApiCoreV1Pod {
parent: IoK8sApiAppsV1ReplicaSet
connected: IoK8sApiCoreV1ServiceList
mounting: [K8sResourceInterface]
}
extend type IoK8sApiAppsV1ReplicaSet {
parent: IoK8sApiAppsV1Deployment
children: IoK8sApiCoreV1PodList
}
extend type IoK8sApiAppsV1Deployment {
children: IoK8sApiAppsV1ReplicaSetList
}
extend type IoK8sApiCoreV1Service {
connecting: IoK8sApiCoreV1PodList
}
extend type Query {
nodes: IoK8sApiCoreV1NodeList
namespaces: IoK8sApiCoreV1NamespaceList
clusterrolebindings: IoK8sApiRbacV1ClusterRoleBindingList
clusterroles: IoK8sApiRbacV1ClusterRoleList
storageclasses: IoK8sApiStorageV1StorageClassList
mutatingwebhookconfigurations: IoK8sApiAdmissionregistrationV1MutatingWebhookConfigurationList
validatingwebhookconfigurations: IoK8sApiAdmissionregistrationV1ValidatingWebhookConfigurationList
certificatesigningrequests: IoK8sApiCertificatesV1beta1CertificateSigningRequestList
podsecuritypolicies: IoK8sApiPolicyV1beta1PodSecurityPolicyList
componentstatuses: IoK8sApiCoreV1ComponentStatusList
customresourcedefinitions: IoK8sApiextensionsApiserverPkgApisApiextensionsV1CustomResourceDefinitionList
priorityclasses: IoK8sApiSchedulingV1PriorityClassList
csidrivers: IoK8sApiStorageV1CSIDriverList
csinodes: IoK8sApiStorageV1CSINodeList
volumeattachments: IoK8sApiStorageV1VolumeAttachmentList
pods(namespace: String!): IoK8sApiCoreV1PodList
services(namespace: String!): IoK8sApiCoreV1ServiceList
ingresses(namespace: String!): IoK8sApiNetworkingV1beta1IngressClassList
replicasets(namespace: String!): IoK8sApiAppsV1ReplicaSetList
deployments(namespace: String!): IoK8sApiAppsV1Deployment
daemonsets(namespace: String!): IoK8sApiAppsV1DaemonSetList
statefulsets(namespace: String!): IoK8sApiAppsV1StatefulSetList
replicationcontrollers(namespace: String!): IoK8sApiCoreV1ReplicationControllerList
horizontalpodautoscalers(namespace: String!): IoK8sApiAutoscalingV1HorizontalPodAutoscalerList
cronjobs(namespace: String!): IoK8sApiBatchV1beta1CronJobList
jobs(namespace: String!): IoK8sApiBatchV1JobList
rolebindings(namespace: String!): IoK8sApiRbacV1RoleBindingList
roles(namespace: String!): IoK8sApiRbacV1RoleList
serviceaccounts(namespace: String!): IoK8sApiCoreV1ServiceAccountList
resourcequotas(namespace: String!): IoK8sApiCoreV1ResourceQuotaList
endpoints(namespace: String!): IoK8sApiCoreV1EndpointsList
controllerrevisions(namespace: String!): IoK8sApiAppsV1ControllerRevisionList
networkpolicies(namespace: String!): IoK8sApiNetworkingV1NetworkPolicyList
poddisruptionbudgets(namespace: String!): IoK8sApiPolicyV1beta1PodDisruptionBudgetList
limitranges(namespace: String!): IoK8sApiCoreV1LimitRangeList
podtemplates(namespace: String!): IoK8sApiCoreV1PodTemplateList
events(namespace: String!): IoK8sApiEventsV1beta1EventList
persistentvolumeclaims(namespace: String!): IoK8sApiCoreV1PersistentVolumeClaimList
persistentvolumes(namespace: String!): IoK8sApiCoreV1PersistentVolumeList
secrets(namespace: String!): IoK8sApiCoreV1SecretList
configmaps(namespace: String!): IoK8sApiCoreV1ConfigMapList
no: IoK8sApiCoreV1NodeList
ns: IoK8sApiCoreV1NamespaceList
sc: IoK8sApiStorageV1StorageClassList
csr: IoK8sApiCertificatesV1beta1CertificateSigningRequestList
psp: IoK8sApiPolicyV1beta1PodSecurityPolicyList
cs: IoK8sApiCoreV1ComponentStatusList
crd: IoK8sApiextensionsApiserverPkgApisApiextensionsV1CustomResourceDefinitionList
pc: IoK8sApiSchedulingV1PriorityClassList
po(namespace: String!): IoK8sApiCoreV1PodList
svc(namespace: String!): IoK8sApiCoreV1ServiceList
rs(namespace: String!): IoK8sApiAppsV1ReplicaSetList
deploy(namespace: String!): IoK8sApiAppsV1Deployment
pvc(namespace: String!): IoK8sApiCoreV1PersistentVolumeClaimList
pv(namespace: String!): IoK8sApiCoreV1PersistentVolumeList
ing(namespace: String!): IoK8sApiNetworkingV1beta1IngressClassList
ds(namespace: String!): IoK8sApiAppsV1DaemonSetList
sts(namespace: String!): IoK8sApiAppsV1StatefulSetList
rc(namespace: String!): IoK8sApiCoreV1ReplicationControllerList
hpa(namespace: String!): IoK8sApiAutoscalingV1HorizontalPodAutoscalerList
cj(namespace: String!): IoK8sApiBatchV1beta1CronJobList
sa(namespace: String!): IoK8sApiCoreV1ServiceAccountList
quota(namespace: String!): IoK8sApiCoreV1ResourceQuotaList
ep(namespace: String!): IoK8sApiCoreV1EndpointsList
netpol(namespace: String!): IoK8sApiNetworkingV1NetworkPolicyList
pdb(namespace: String!): IoK8sApiPolicyV1beta1PodDisruptionBudgetList
limits(namespace: String!): IoK8sApiCoreV1LimitRangeList
ev(namespace: String!): IoK8sApiEventsV1beta1EventList
cm(namespace: String!): IoK8sApiCoreV1ConfigMapList
}
additionalResolvers:
- ./additional-resolvers.js
example-query.graphql: |-
query q {
pods(namespace: "default") {
items {
metadata {
name
}
parent {
parent {
metadata {
name
}
}
children {
items {
metadata {
name
ownerReferences {
name
}
}
}
}
}
connected {
items {
metadata {
name
}
spec {
selector
}
connecting {
items {
metadata {
name
labels
}
}
}
}
}
}
}
}
init.sh: |-
#!/bin/bash
curl -L http://mesh-svc:8001/openapi/v2 -o swagger.json
additional-resolvers.js: |-
const createParentResolver = (readfn) => {
var resolve = async (obj, args, {graphqlMeshK8s}) => {
console.log("createParentResolver");
var namespace = obj.metadata && obj.metadata.namespace;
var ownerReferences = obj.metadata && obj.metadata.ownerReferences;
if((!ownerReferences) ||(!ownerReferences.length) || (!namespace)) {
return null;
}
var name = ownerReferences[0].name;
var _function = graphqlMeshK8s.api[readfn];
var values = await _function({ name, namespace });
return values;
};
var selectionSet = `{ metadata { name namespace ownerReferences { name }}}`;
return { resolve, selectionSet };
}
const createChildrenResolver = (listfn) => {
var resolve = async (obj, args, {graphqlMeshK8s}) => {
console.log("createChildrenResolver");
var namespace = obj.metadata && obj.metadata.namespace;
var name = obj.metadata && obj.metadata.name;
if((!name) || (!namespace)) {
return null;
}
console.log(name, namespace);
var _function = graphqlMeshK8s.api[listfn];
var list = await _function({ namespace }, { fields: { items: {metadata: { labels: true, ownerReferences: {name: true}}}}});
console.log("children base", JSON.stringify(list.items));
var returnItems = list.items.filter(elem => {
var ownerReferences = elem.metadata && elem.metadata.ownerReferences;
if((!ownerReferences) || (!ownerReferences.length)) {
return false;
}
return name == ownerReferences[0].name;
});
list.items = returnItems;
//console.log(list);
return list;
};
var selectionSet = `{ metadata {name namespace}}`;
return { resolve, selectionSet };
}
const createConnectingResolver = (listfn) => {
var resolve = async (obj, args, { graphqlMeshK8s }) => {
console.log("createConnectingResolver");
var namespace = obj.metadata && obj.metadata.namespace;
var selector = obj.spec && obj.spec.selector;
if((!selector) || (!namespace)) {
return [];
}
var _function = graphqlMeshK8s.api[listfn];
//var labelSelector = Object.keys(selector).map(key => key+"="+selector[key]).join(",");
var list = await _function({ namespace }, { fields: { items: { metadata: {labels: true}}}});
console.log("connecting base", JSON.stringify(list.items));
//console.log("selector", selector);
var returnItems = list.items.filter(elem => {
var labels = elem.metadata.labels;
return Object.keys(selector).reduce((result, key) => {
return result && (selector[key] == labels[key])
}, true)
});
list.items = returnItems;
return list;
}
var selectionSet = `{ metadata { name namespace } spec {selector} }`;
return { resolve, selectionSet };
}
const createConnectedResolver = (listfn) => {
var resolve = async (obj, args, { graphqlMeshK8s }) => {
console.log("createConnectedResolver");
var namespace = obj.metadata && obj.metadata.namespace;
var labels = obj.metadata && obj.metadata.labels;
if((!labels) || (!namespace)) {
return [];
}
var _function = graphqlMeshK8s.api[listfn];
var list = await _function({ namespace }, { selectionSet: `{ items {spec {selector }}}`, depth: 4});
console.log("connected base", JSON.stringify(list.items));
var returnItems = list.items.filter(elem => {
var selector = elem.spec && elem.spec.selector;
//console.log("selector", selector);
if(!selector) {
return false;
}
return Object.keys(selector).reduce((result, key) => {
return result && (selector[key] == labels[key])
}, true)
});
list.items = returnItems;
return list;
}
var selectionSet = `{ metadata { name namespace labels }}`;
return { resolve, selectionSet };
}
const createMountingResolver = () => {
var resolve = async (obj, args, {graphqlMeshK8s}) => {
console.log("createMountingResolver");
var namespace = obj.metadata && obj.metadata.namespace;
var volumes = obj.spec && obj.spec.volumes;
if((!volumes) ||(!volumes.length) || (!namespace)) {
return [];
}
var promises = volumes.map(elem => {
if(elem.configMap) {
return graphqlMeshK8s.api.readCoreV1NamespacedConfigMap({name: elem.configMap.name, namespace });
} else if(elem.persistentVolumeClaim) {
return graphqlMeshK8s.api.readCoreV1NamespacedPersistentVolumeClaim({name: elem.persistentVolumeClaim.claimName, namespace});
} else if(elem.secret) {
return graphqlMeshK8s.api.readCoreV1NamespacedSecret({name: elem.secret.secretName, namespace});
}
});
return await Promise.all(promises);
};
var selectionSet = `{ metadata { name namespace } spec {volumes {configMap {name} persistentVolumeClaim {claimName} secret {secretName}}}}`;
return { resolve, selectionSet };
}
const resolvers = {
IoK8sApiCoreV1Pod: {
parent: createParentResolver("readAppsV1NamespacedReplicaSet"),
connected: createConnectedResolver("listCoreV1NamespacedService"),
mounting: createMountingResolver()
},
IoK8sApiAppsV1ReplicaSet: {
parent: createParentResolver("readAppsV1NamespacedDeployment"),
children: createChildrenResolver("listCoreV1NamespacedPod")
},
IoK8sApiAppsV1Deployment: {
children: createChildrenResolver("listAppsV1NamespacedReplicaSet")
},
IoK8sApiCoreV1Service: {
connecting: createConnectingResolver("listCoreV1NamespacedPod")
},
Query: {
nodes: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1Node();
},
namespaces: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1Namespace();
},
clusterrolebindings: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listRbacAuthorizationV1ClusterRoleBinding();
},
clusterroles: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listRbacAuthorizationV1ClusterRole();
},
storageclasses: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listStorageV1StorageClass();
},
mutatingwebhookconfigurations: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAdmissionregistrationV1MutatingWebhookConfiguration();
},
validatingwebhookconfigurations: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAdmissionregistrationV1ValidatingWebhookConfiguration();
},
certificatesigningrequests: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCertificatesV1beta1CertificateSigningRequest();
},
podsecuritypolicies: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listPolicyV1beta1PodSecurityPolicy();
},
componentstatuses: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1ComponentStatus();
},
customresourcedefinitions: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listApiextensionsV1CustomResourceDefinition();
},
priorityclasses: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listSchedulingV1PriorityClass();
},
csidrivers: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listStorageV1CSIDriver();
},
csinodes: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listStorageV1CSINode();
},
volumeattachments: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.IoK8sApiStorageV1VolumeAttachmentList();
},
pods: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedPod({namespace});
},
services: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedService({namespace});
},
ingresses: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listNetworkingV1beta1IngressClass({namespace});
},
replicasets: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAppsV1NamespacedReplicaSet({namespace});
},
deployments: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAppsV1NamespacedDeployment({namespace});
},
statefulsets: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAppsV1NamespacedStatefulSet({namespace});
},
daemonsets: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAppsV1NamespacedDaemonSet({namespace});
},
replicationcontrollers: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedReplicationController({namespace});
},
horizontalpodautoscalers: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAutoscalingV1NamespacedHorizontalPodAutoscaler({namespace});
},
cronjobs: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listBatchV1beta1NamespacedCronJob({namespace});
},
jobs: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listBatchV1beta1NamespacedJob({namespace});
},
rolebindings: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listRbacAuthorizationV1NamespacedRoleBinding({namespace});
},
roles: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listRbacAuthorizationV1NamespacedRole({namespace});
},
serviceaccounts: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedServiceAccount({namespace});
},
resourcequotas: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedResourceQuota({namespace});
},
endpoints: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedEndpoints({namespace});
},
controllerrevisions: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedEndpoints({namespace});
},
networkpolicies: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listNetworkingV1NamespacedNetworkPolicy({namespace});
},
poddisruptionbudgets: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listPolicyV1beta1NamespacedPodDisruptionBudget({namespace});
},
limitranges: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedLimitRange({namespace});
},
podtemplates: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedPodTemplate({namespace});
},
events: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listEventsV1beta1NamespacedEvent({namespace});
},
persistentvolumeclaims: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedPersistentVolumeClaim({namespace});
},
persistentvolumes: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedPersistentVolume({namespace});
},
secrets: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedSecret({namespace});
},
configmaps: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedConfigMap({namespace});
},
no: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1Node();
},
ns: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1Namespace();
},
sc: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listStorageV1StorageClass();
},
csr: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCertificatesV1beta1CertificateSigningRequest();
},
psp: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listPolicyV1beta1PodSecurityPolicy();
},
cs: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1ComponentStatus();
},
crd: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listApiextensionsV1CustomResourceDefinition();
},
pc: async (obj, _, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listSchedulingV1PriorityClass();
},
po: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedPod({namespace});
},
svc: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedService({namespace});
},
rs: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAppsV1NamespacedReplicaSet({namespace});
},
deploy: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAppsV1NamespacedDeployment({namespace});
},
pvc: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedPersistentVolumeClaim({namespace});
},
pv: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedPersistentVolume({namespace});
},
ing: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listNetworkingV1beta1IngressClass({namespace});
},
sts: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAppsV1NamespacedStatefulSet({namespace});
},
ds: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAppsV1NamespacedDaemonSet({namespace});
},
rc: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedReplicationController({namespace});
},
hpa: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listAutoscalingV1NamespacedHorizontalPodAutoscaler({namespace});
},
cj: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listBatchV1beta1NamespacedCronJob({namespace});
},
sa: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedServiceAccount({namespace});
},
quota: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedResourceQuota({namespace});
},
ep: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedEndpoints({namespace});
},
netpol: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listNetworkingV1NamespacedNetworkPolicy({namespace});
},
pdb: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listPolicyV1beta1NamespacedPodDisruptionBudget({namespace});
},
limits: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedLimitRange({namespace});
},
ev: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listEventsV1beta1NamespacedEvent({namespace});
},
cm: async (obj, {namespace}, { graphqlMeshK8s }) => {
return await graphqlMeshK8s.api.listCoreV1NamespacedConfigMap({namespace});
}
},
K8sResourceInterface: {
__resolveType(obj, context, info){
if(obj.kind == "ConfigMap"){
return 'IoK8sApiCoreV1ConfigMap';
}
if(obj.kind == "persistentVolumeClaim"){
return 'IoK8sApiCoreV1PersistentVolumeClaim';
}
if(obj.kind == "Secret"){
return 'IoK8sApiCoreV1Secret';
}
return null;
}
}
};
module.exports = { resolvers };
kind: ConfigMap
metadata:
creationTimestamp: null
name: meshrc-cm
namespace: default