@backstage/plugin-kubernetes 0.6.5 → 0.6.6-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +187 -10
- package/dist/index.esm.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @backstage/plugin-kubernetes
|
|
2
2
|
|
|
3
|
+
## 0.6.6-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4328737af6: Add support to fetch data for Stateful Sets and display an accordion in the same way as with Deployments
|
|
8
|
+
- 81304e3e91: Fix for HPA matching when deploying same HPA in multiple namespaces
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/plugin-catalog-react@1.1.1-next.0
|
|
11
|
+
- @backstage/core-components@0.9.5-next.0
|
|
12
|
+
- @backstage/plugin-kubernetes-common@0.3.0-next.0
|
|
13
|
+
|
|
3
14
|
## 0.6.5
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { DiscoveryApi, IdentityApi, OAuthApi, OpenIdConnectApi } from '@backstag
|
|
|
4
4
|
import { Entity } from '@backstage/catalog-model';
|
|
5
5
|
import { KubernetesRequestBody, ObjectsByEntityResponse, ClusterObjects, ClientPodStatus, ClusterAttributes } from '@backstage/plugin-kubernetes-common';
|
|
6
6
|
import { JsonObject } from '@backstage/types';
|
|
7
|
-
import { V1Pod, V1ReplicaSet, V1Deployment, V1HorizontalPodAutoscaler, V1Service, V1ConfigMap, V1Ingress, V1Job, V1CronJob, V1ObjectMeta } from '@kubernetes/client-node';
|
|
7
|
+
import { V1Pod, V1ReplicaSet, V1Deployment, V1HorizontalPodAutoscaler, V1Service, V1ConfigMap, V1Ingress, V1Job, V1CronJob, V1StatefulSet, V1ObjectMeta } from '@kubernetes/client-node';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
10
|
declare const kubernetesPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
@@ -101,6 +101,7 @@ interface GroupedResponses extends DeploymentResources {
|
|
|
101
101
|
jobs: V1Job[];
|
|
102
102
|
cronJobs: V1CronJob[];
|
|
103
103
|
customResources: any[];
|
|
104
|
+
statefulsets: V1StatefulSet[];
|
|
104
105
|
}
|
|
105
106
|
interface ClusterLinksFormatterOptions {
|
|
106
107
|
dashboardUrl?: URL;
|
package/dist/index.esm.js
CHANGED
|
@@ -340,6 +340,9 @@ const groupResponses = (fetchResponse) => {
|
|
|
340
340
|
case "customresources":
|
|
341
341
|
prev.customResources.push(...next.resources);
|
|
342
342
|
break;
|
|
343
|
+
case "statefulsets":
|
|
344
|
+
prev.statefulsets.push(...next.resources);
|
|
345
|
+
break;
|
|
343
346
|
}
|
|
344
347
|
return prev;
|
|
345
348
|
}, {
|
|
@@ -352,7 +355,8 @@ const groupResponses = (fetchResponse) => {
|
|
|
352
355
|
ingresses: [],
|
|
353
356
|
jobs: [],
|
|
354
357
|
cronJobs: [],
|
|
355
|
-
customResources: []
|
|
358
|
+
customResources: [],
|
|
359
|
+
statefulsets: []
|
|
356
360
|
});
|
|
357
361
|
};
|
|
358
362
|
|
|
@@ -677,7 +681,8 @@ const GroupedResponsesContext = React__default.createContext({
|
|
|
677
681
|
ingresses: [],
|
|
678
682
|
jobs: [],
|
|
679
683
|
cronJobs: [],
|
|
680
|
-
customResources: []
|
|
684
|
+
customResources: [],
|
|
685
|
+
statefulsets: []
|
|
681
686
|
});
|
|
682
687
|
|
|
683
688
|
const ClusterContext = React__default.createContext({
|
|
@@ -689,7 +694,8 @@ const kindMappings$3 = {
|
|
|
689
694
|
pod: "pod",
|
|
690
695
|
ingress: "ingress",
|
|
691
696
|
service: "service",
|
|
692
|
-
horizontalpodautoscaler: "deployment"
|
|
697
|
+
horizontalpodautoscaler: "deployment",
|
|
698
|
+
statefulset: "statefulset"
|
|
693
699
|
};
|
|
694
700
|
function standardFormatter(options) {
|
|
695
701
|
var _a, _b, _c, _d;
|
|
@@ -1241,10 +1247,10 @@ const getOwnedPodsThroughReplicaSets = (potentialOwner, replicaSets, pods) => {
|
|
|
1241
1247
|
return accum.concat(getOwnedResources(rs, pods));
|
|
1242
1248
|
}, []);
|
|
1243
1249
|
};
|
|
1244
|
-
const getMatchingHpa = (
|
|
1250
|
+
const getMatchingHpa = (owner, hpas) => {
|
|
1245
1251
|
return hpas.find((hpa) => {
|
|
1246
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1247
|
-
return ((_c = (_b = (_a = hpa.spec) == null ? void 0 : _a.scaleTargetRef) == null ? void 0 : _b.kind) != null ? _c : "").toLocaleLowerCase("en-US") ===
|
|
1252
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1253
|
+
return ((_c = (_b = (_a = hpa.spec) == null ? void 0 : _a.scaleTargetRef) == null ? void 0 : _b.kind) != null ? _c : "").toLocaleLowerCase("en-US") === owner.kind.toLocaleLowerCase("en-US") && ((_e = (_d = hpa.metadata) == null ? void 0 : _d.namespace) != null ? _e : "") === ((_f = owner.namespace) != null ? _f : "unknown-namespace") && ((_i = (_h = (_g = hpa.spec) == null ? void 0 : _g.scaleTargetRef) == null ? void 0 : _h.name) != null ? _i : "") === ((_j = owner.name) != null ? _j : "unknown-deployment");
|
|
1248
1254
|
});
|
|
1249
1255
|
};
|
|
1250
1256
|
|
|
@@ -1340,7 +1346,7 @@ const DeploymentsAccordions = ({}) => {
|
|
|
1340
1346
|
justifyContent: "flex-start",
|
|
1341
1347
|
alignItems: "flex-start"
|
|
1342
1348
|
}, groupedResponses.deployments.map((deployment, i) => {
|
|
1343
|
-
var _a;
|
|
1349
|
+
var _a, _b;
|
|
1344
1350
|
return /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1345
1351
|
container: true,
|
|
1346
1352
|
item: true,
|
|
@@ -1350,13 +1356,178 @@ const DeploymentsAccordions = ({}) => {
|
|
|
1350
1356
|
item: true,
|
|
1351
1357
|
xs: true
|
|
1352
1358
|
}, /* @__PURE__ */ React__default.createElement(DeploymentAccordion, {
|
|
1353
|
-
matchingHpa: getMatchingHpa(
|
|
1359
|
+
matchingHpa: getMatchingHpa({
|
|
1360
|
+
name: (_a = deployment.metadata) == null ? void 0 : _a.name,
|
|
1361
|
+
namespace: (_b = deployment.metadata) == null ? void 0 : _b.namespace,
|
|
1362
|
+
kind: "deployment"
|
|
1363
|
+
}, groupedResponses.horizontalPodAutoscalers),
|
|
1354
1364
|
ownedPods: getOwnedPodsThroughReplicaSets(deployment, groupedResponses.replicaSets, groupedResponses.pods),
|
|
1355
1365
|
deployment
|
|
1356
1366
|
})));
|
|
1357
1367
|
}));
|
|
1358
1368
|
};
|
|
1359
1369
|
|
|
1370
|
+
const StatefulSetDrawer = ({
|
|
1371
|
+
statefulset,
|
|
1372
|
+
expanded
|
|
1373
|
+
}) => {
|
|
1374
|
+
var _a, _b, _c;
|
|
1375
|
+
const namespace = (_a = statefulset.metadata) == null ? void 0 : _a.namespace;
|
|
1376
|
+
return /* @__PURE__ */ React__default.createElement(KubernetesDrawer, {
|
|
1377
|
+
object: statefulset,
|
|
1378
|
+
expanded,
|
|
1379
|
+
kind: "StatefulSet",
|
|
1380
|
+
renderObject: (statefulsetObj) => {
|
|
1381
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1382
|
+
const conditions = ((_b2 = (_a2 = statefulsetObj.status) == null ? void 0 : _a2.conditions) != null ? _b2 : []).map(renderCondition).reduce((accum, next) => {
|
|
1383
|
+
accum[next[0]] = next[1];
|
|
1384
|
+
return accum;
|
|
1385
|
+
}, {});
|
|
1386
|
+
return {
|
|
1387
|
+
updateStrategy: (_d = (_c2 = statefulset.spec) == null ? void 0 : _c2.updateStrategy) != null ? _d : "???",
|
|
1388
|
+
podManagementPolicy: (_f = (_e = statefulset.spec) == null ? void 0 : _e.podManagementPolicy) != null ? _f : "???",
|
|
1389
|
+
serviceName: (_h = (_g = statefulset.spec) == null ? void 0 : _g.serviceName) != null ? _h : "???",
|
|
1390
|
+
selector: (_j = (_i = statefulset.spec) == null ? void 0 : _i.selector) != null ? _j : "???",
|
|
1391
|
+
revisionHistoryLimit: (_l = (_k = statefulset.spec) == null ? void 0 : _k.revisionHistoryLimit) != null ? _l : "???",
|
|
1392
|
+
...conditions
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1396
|
+
container: true,
|
|
1397
|
+
direction: "column",
|
|
1398
|
+
justifyContent: "flex-start",
|
|
1399
|
+
alignItems: "flex-start",
|
|
1400
|
+
spacing: 0
|
|
1401
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1402
|
+
item: true
|
|
1403
|
+
}, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
1404
|
+
variant: "h5"
|
|
1405
|
+
}, (_c = (_b = statefulset.metadata) == null ? void 0 : _b.name) != null ? _c : "unknown object")), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1406
|
+
item: true
|
|
1407
|
+
}, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
1408
|
+
color: "textSecondary",
|
|
1409
|
+
variant: "body1"
|
|
1410
|
+
}, "Stateful Set")), namespace && /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1411
|
+
item: true
|
|
1412
|
+
}, /* @__PURE__ */ React__default.createElement(Chip, {
|
|
1413
|
+
size: "small",
|
|
1414
|
+
label: `namespace: ${namespace}`
|
|
1415
|
+
}))));
|
|
1416
|
+
};
|
|
1417
|
+
|
|
1418
|
+
const StatefulSetSummary = ({
|
|
1419
|
+
statefulset,
|
|
1420
|
+
numberOfCurrentPods,
|
|
1421
|
+
numberOfPodsWithErrors,
|
|
1422
|
+
hpa
|
|
1423
|
+
}) => {
|
|
1424
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1425
|
+
return /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1426
|
+
container: true,
|
|
1427
|
+
direction: "row",
|
|
1428
|
+
justifyContent: "flex-start",
|
|
1429
|
+
alignItems: "center"
|
|
1430
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1431
|
+
xs: 3,
|
|
1432
|
+
item: true
|
|
1433
|
+
}, /* @__PURE__ */ React__default.createElement(StatefulSetDrawer, {
|
|
1434
|
+
statefulset
|
|
1435
|
+
})), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1436
|
+
item: true,
|
|
1437
|
+
xs: 1
|
|
1438
|
+
}, /* @__PURE__ */ React__default.createElement(Divider, {
|
|
1439
|
+
style: { height: "5em" },
|
|
1440
|
+
orientation: "vertical"
|
|
1441
|
+
})), hpa && /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1442
|
+
item: true,
|
|
1443
|
+
xs: 3
|
|
1444
|
+
}, /* @__PURE__ */ React__default.createElement(HorizontalPodAutoscalerDrawer, {
|
|
1445
|
+
hpa
|
|
1446
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1447
|
+
item: true,
|
|
1448
|
+
container: true,
|
|
1449
|
+
direction: "column",
|
|
1450
|
+
justifyContent: "flex-start",
|
|
1451
|
+
alignItems: "flex-start",
|
|
1452
|
+
spacing: 0
|
|
1453
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1454
|
+
item: true
|
|
1455
|
+
}, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
1456
|
+
variant: "subtitle2"
|
|
1457
|
+
}, "min replicas ", (_b = (_a = hpa.spec) == null ? void 0 : _a.minReplicas) != null ? _b : "?", " / max replicas", " ", (_d = (_c = hpa.spec) == null ? void 0 : _c.maxReplicas) != null ? _d : "?")), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1458
|
+
item: true
|
|
1459
|
+
}, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
1460
|
+
variant: "subtitle2"
|
|
1461
|
+
}, "current CPU usage:", " ", (_f = (_e = hpa.status) == null ? void 0 : _e.currentCPUUtilizationPercentage) != null ? _f : "?", "%")), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1462
|
+
item: true
|
|
1463
|
+
}, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
1464
|
+
variant: "subtitle2"
|
|
1465
|
+
}, "target CPU usage:", " ", (_h = (_g = hpa.spec) == null ? void 0 : _g.targetCPUUtilizationPercentage) != null ? _h : "?", "%"))))), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1466
|
+
item: true,
|
|
1467
|
+
container: true,
|
|
1468
|
+
xs: 3,
|
|
1469
|
+
direction: "column",
|
|
1470
|
+
justifyContent: "flex-start",
|
|
1471
|
+
alignItems: "flex-start"
|
|
1472
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1473
|
+
item: true
|
|
1474
|
+
}, /* @__PURE__ */ React__default.createElement(StatusOK, null, numberOfCurrentPods, " pods")), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1475
|
+
item: true
|
|
1476
|
+
}, numberOfPodsWithErrors > 0 ? /* @__PURE__ */ React__default.createElement(StatusError, null, numberOfPodsWithErrors, " pod", numberOfPodsWithErrors > 1 ? "s" : "", " with errors") : /* @__PURE__ */ React__default.createElement(StatusOK, null, "No pods with errors"))));
|
|
1477
|
+
};
|
|
1478
|
+
const StatefulSetAccordion = ({
|
|
1479
|
+
statefulset,
|
|
1480
|
+
ownedPods,
|
|
1481
|
+
matchingHpa
|
|
1482
|
+
}) => {
|
|
1483
|
+
const podNamesWithErrors = useContext(PodNamesWithErrorsContext);
|
|
1484
|
+
const podsWithErrors = ownedPods.filter((p) => {
|
|
1485
|
+
var _a, _b;
|
|
1486
|
+
return podNamesWithErrors.has((_b = (_a = p.metadata) == null ? void 0 : _a.name) != null ? _b : "");
|
|
1487
|
+
});
|
|
1488
|
+
return /* @__PURE__ */ React__default.createElement(Accordion, {
|
|
1489
|
+
TransitionProps: { unmountOnExit: true }
|
|
1490
|
+
}, /* @__PURE__ */ React__default.createElement(AccordionSummary, {
|
|
1491
|
+
expandIcon: /* @__PURE__ */ React__default.createElement(ExpandMoreIcon, null)
|
|
1492
|
+
}, /* @__PURE__ */ React__default.createElement(StatefulSetSummary, {
|
|
1493
|
+
statefulset,
|
|
1494
|
+
numberOfCurrentPods: ownedPods.length,
|
|
1495
|
+
numberOfPodsWithErrors: podsWithErrors.length,
|
|
1496
|
+
hpa: matchingHpa
|
|
1497
|
+
})), /* @__PURE__ */ React__default.createElement(AccordionDetails, null, /* @__PURE__ */ React__default.createElement(PodsTable, {
|
|
1498
|
+
pods: ownedPods,
|
|
1499
|
+
extraColumns: [READY_COLUMNS, RESOURCE_COLUMNS]
|
|
1500
|
+
})));
|
|
1501
|
+
};
|
|
1502
|
+
const StatefulSetsAccordions = ({}) => {
|
|
1503
|
+
const groupedResponses = useContext(GroupedResponsesContext);
|
|
1504
|
+
return /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1505
|
+
container: true,
|
|
1506
|
+
direction: "column",
|
|
1507
|
+
justifyContent: "flex-start",
|
|
1508
|
+
alignItems: "flex-start"
|
|
1509
|
+
}, groupedResponses.statefulsets.map((statefulset, i) => {
|
|
1510
|
+
var _a, _b;
|
|
1511
|
+
return /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1512
|
+
container: true,
|
|
1513
|
+
item: true,
|
|
1514
|
+
key: i,
|
|
1515
|
+
xs: true
|
|
1516
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1517
|
+
item: true,
|
|
1518
|
+
xs: true
|
|
1519
|
+
}, /* @__PURE__ */ React__default.createElement(StatefulSetAccordion, {
|
|
1520
|
+
matchingHpa: getMatchingHpa({
|
|
1521
|
+
name: (_a = statefulset.metadata) == null ? void 0 : _a.name,
|
|
1522
|
+
namespace: (_b = statefulset.metadata) == null ? void 0 : _b.namespace,
|
|
1523
|
+
kind: "statefulset"
|
|
1524
|
+
}, groupedResponses.horizontalPodAutoscalers),
|
|
1525
|
+
ownedPods: getOwnedResources(statefulset, groupedResponses.pods),
|
|
1526
|
+
statefulset
|
|
1527
|
+
})));
|
|
1528
|
+
}));
|
|
1529
|
+
};
|
|
1530
|
+
|
|
1360
1531
|
const IngressDrawer = ({
|
|
1361
1532
|
ingress,
|
|
1362
1533
|
expanded
|
|
@@ -1953,7 +2124,7 @@ const RolloutAccordions = ({
|
|
|
1953
2124
|
justifyContent: "flex-start",
|
|
1954
2125
|
alignItems: "flex-start"
|
|
1955
2126
|
}, rollouts.map((rollout, i) => {
|
|
1956
|
-
var _a;
|
|
2127
|
+
var _a, _b;
|
|
1957
2128
|
return /* @__PURE__ */ React__default.createElement(Grid, {
|
|
1958
2129
|
container: true,
|
|
1959
2130
|
item: true,
|
|
@@ -1964,7 +2135,11 @@ const RolloutAccordions = ({
|
|
|
1964
2135
|
xs: true
|
|
1965
2136
|
}, /* @__PURE__ */ React__default.createElement(RolloutAccordion, {
|
|
1966
2137
|
defaultExpanded,
|
|
1967
|
-
matchingHpa: getMatchingHpa(
|
|
2138
|
+
matchingHpa: getMatchingHpa({
|
|
2139
|
+
name: (_a = rollout.metadata) == null ? void 0 : _a.name,
|
|
2140
|
+
namespace: (_b = rollout.metadata) == null ? void 0 : _b.namespace,
|
|
2141
|
+
kind: "rollout"
|
|
2142
|
+
}, groupedResponses.horizontalPodAutoscalers),
|
|
1968
2143
|
ownedPods: getOwnedPodsThroughReplicaSets(rollout, groupedResponses.replicaSets, groupedResponses.pods),
|
|
1969
2144
|
rollout
|
|
1970
2145
|
})));
|
|
@@ -2172,6 +2347,8 @@ const Cluster = ({ clusterObjects, podsWithErrors }) => {
|
|
|
2172
2347
|
item: true
|
|
2173
2348
|
}, /* @__PURE__ */ React__default.createElement(DeploymentsAccordions, null)), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
2174
2349
|
item: true
|
|
2350
|
+
}, /* @__PURE__ */ React__default.createElement(StatefulSetsAccordions, null)), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
2351
|
+
item: true
|
|
2175
2352
|
}, /* @__PURE__ */ React__default.createElement(IngressesAccordions, null)), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
2176
2353
|
item: true
|
|
2177
2354
|
}, /* @__PURE__ */ React__default.createElement(ServicesAccordions, null)), /* @__PURE__ */ React__default.createElement(Grid, {
|