@backstage/plugin-kubernetes-cluster 0.0.0-nightly-20231005021327
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 +17 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.esm.js +298 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +81 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @backstage/plugin-kubernetes-cluster
|
|
2
|
+
|
|
3
|
+
## 0.0.0-nightly-20231005021327
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 95518765ee6b: Add Kubernetes cluster plugin. Viewing Kubernetes clusters as an Admin from Backstage
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-catalog-react@0.0.0-nightly-20231005021327
|
|
10
|
+
- @backstage/core-plugin-api@0.0.0-nightly-20231005021327
|
|
11
|
+
- @backstage/core-components@0.0.0-nightly-20231005021327
|
|
12
|
+
- @backstage/plugin-kubernetes-react@0.0.0-nightly-20231005021327
|
|
13
|
+
- @backstage/plugin-kubernetes-common@0.0.0-nightly-20231005021327
|
|
14
|
+
- @backstage/config@1.1.0
|
|
15
|
+
- @backstage/catalog-model@1.4.2
|
|
16
|
+
- @backstage/errors@1.2.2
|
|
17
|
+
- @backstage/theme@0.4.2
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Entity } from '@backstage/catalog-model';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Props of EntityKubernetesContent
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
type EntityKubernetesClusterContentProps = {};
|
|
11
|
+
/**
|
|
12
|
+
* Props of EntityKubernetesContent
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
declare const EntityKubernetesClusterContent: (props: EntityKubernetesClusterContentProps) => JSX.Element;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
declare const isKubernetesClusterAvailable: (entity: Entity) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
declare const Router: () => React.JSX.Element;
|
|
30
|
+
|
|
31
|
+
export { EntityKubernetesClusterContent, EntityKubernetesClusterContentProps, Router, isKubernetesClusterAvailable };
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { createRouteRef, createPlugin, createRoutableExtension, useApi } from '@backstage/core-plugin-api';
|
|
2
|
+
import React, { useState, useCallback, useContext, useEffect } from 'react';
|
|
3
|
+
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
4
|
+
import { Routes, Route } from 'react-router-dom';
|
|
5
|
+
import { Table, StructuredMetadataTable, InfoCard, WarningPanel, MissingAnnotationEmptyState } from '@backstage/core-components';
|
|
6
|
+
import { ANNOTATION_KUBERNETES_API_SERVER } from '@backstage/plugin-kubernetes-common';
|
|
7
|
+
import useAsync from 'react-use/lib/useAsync';
|
|
8
|
+
import { kubernetesApiRef, KubernetesDrawer } from '@backstage/plugin-kubernetes-react';
|
|
9
|
+
import { makeStyles, Grid, Typography, createStyles } from '@material-ui/core';
|
|
10
|
+
import { Skeleton } from '@material-ui/lab';
|
|
11
|
+
|
|
12
|
+
const rootCatalogKubernetesClusterRouteRef = createRouteRef({
|
|
13
|
+
id: "kubernetes-cluster"
|
|
14
|
+
});
|
|
15
|
+
const kubernetesClusterPlugin = createPlugin({
|
|
16
|
+
id: "kubernetes-cluster",
|
|
17
|
+
apis: [],
|
|
18
|
+
routes: {
|
|
19
|
+
entityContent: rootCatalogKubernetesClusterRouteRef
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const EntityKubernetesClusterContent = kubernetesClusterPlugin.provide(
|
|
23
|
+
createRoutableExtension({
|
|
24
|
+
name: "EntityKubernetesClusterContent",
|
|
25
|
+
component: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.Router),
|
|
26
|
+
mountPoint: rootCatalogKubernetesClusterRouteRef
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const useApiResources = ({ clusterName }) => {
|
|
31
|
+
const kubernetesApi = useApi(kubernetesApiRef);
|
|
32
|
+
return useAsync(async () => {
|
|
33
|
+
return await kubernetesApi.proxy({
|
|
34
|
+
clusterName,
|
|
35
|
+
path: "/apis"
|
|
36
|
+
}).then((r) => {
|
|
37
|
+
return r.json();
|
|
38
|
+
});
|
|
39
|
+
}, [clusterName]);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const KubernetesClusterErrorContext = React.createContext({
|
|
43
|
+
setError: (_) => {
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const KubernetesClusterErrorProvider = ({
|
|
47
|
+
children
|
|
48
|
+
}) => {
|
|
49
|
+
const [error, setError] = useState(void 0);
|
|
50
|
+
const contextValue = {
|
|
51
|
+
error,
|
|
52
|
+
setError: useCallback((message) => setError(message), [])
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ React.createElement(KubernetesClusterErrorContext.Provider, { value: contextValue }, children);
|
|
55
|
+
};
|
|
56
|
+
const useKubernetesClusterError = () => {
|
|
57
|
+
return useContext(KubernetesClusterErrorContext);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const useStyles$2 = makeStyles((theme) => ({
|
|
61
|
+
empty: {
|
|
62
|
+
padding: theme.spacing(2),
|
|
63
|
+
display: "flex",
|
|
64
|
+
justifyContent: "center"
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
const defaultColumns$1 = [
|
|
68
|
+
{
|
|
69
|
+
title: "Name",
|
|
70
|
+
highlight: true,
|
|
71
|
+
render: (apiGroup) => {
|
|
72
|
+
return apiGroup.name;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: "Preferred Version",
|
|
77
|
+
highlight: true,
|
|
78
|
+
render: (apiGroup) => {
|
|
79
|
+
var _a;
|
|
80
|
+
return (_a = apiGroup.preferredVersion) == null ? void 0 : _a.groupVersion;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
const ApiResources = () => {
|
|
85
|
+
var _a;
|
|
86
|
+
const classes = useStyles$2();
|
|
87
|
+
const { entity } = useEntity();
|
|
88
|
+
const { setError } = useKubernetesClusterError();
|
|
89
|
+
const setErrorCallback = useCallback(setError, [setError]);
|
|
90
|
+
const { value, error, loading } = useApiResources({
|
|
91
|
+
clusterName: entity.metadata.name
|
|
92
|
+
});
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (error) {
|
|
95
|
+
setErrorCallback(error.message);
|
|
96
|
+
}
|
|
97
|
+
}, [error, setErrorCallback]);
|
|
98
|
+
return /* @__PURE__ */ React.createElement(
|
|
99
|
+
Table,
|
|
100
|
+
{
|
|
101
|
+
title: "API Resources",
|
|
102
|
+
options: { paging: true, search: false, emptyRowsWhenPaging: false },
|
|
103
|
+
isLoading: !value && loading,
|
|
104
|
+
data: (_a = value == null ? void 0 : value.groups) != null ? _a : [],
|
|
105
|
+
emptyContent: /* @__PURE__ */ React.createElement("div", { className: classes.empty }, error !== void 0 ? "Error loading API Resources" : "No API Resources found"),
|
|
106
|
+
columns: defaultColumns$1
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const useNodes = ({ clusterName }) => {
|
|
112
|
+
const kubernetesApi = useApi(kubernetesApiRef);
|
|
113
|
+
return useAsync(async () => {
|
|
114
|
+
return await kubernetesApi.proxy({
|
|
115
|
+
clusterName,
|
|
116
|
+
path: "/api/v1/nodes?limit=500"
|
|
117
|
+
}).then((r) => {
|
|
118
|
+
return r.json();
|
|
119
|
+
});
|
|
120
|
+
}, [clusterName]);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const useStyles$1 = makeStyles((theme) => ({
|
|
124
|
+
empty: {
|
|
125
|
+
padding: theme.spacing(2),
|
|
126
|
+
display: "flex",
|
|
127
|
+
justifyContent: "center"
|
|
128
|
+
}
|
|
129
|
+
}));
|
|
130
|
+
const defaultColumns = [
|
|
131
|
+
{
|
|
132
|
+
title: "Name",
|
|
133
|
+
highlight: true,
|
|
134
|
+
width: "auto",
|
|
135
|
+
render: (node) => {
|
|
136
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
137
|
+
return /* @__PURE__ */ React.createElement(
|
|
138
|
+
KubernetesDrawer,
|
|
139
|
+
{
|
|
140
|
+
kubernetesObject: node,
|
|
141
|
+
label: (_b = (_a = node.metadata) == null ? void 0 : _a.name) != null ? _b : "unknown-node"
|
|
142
|
+
},
|
|
143
|
+
/* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Node Info"), /* @__PURE__ */ React.createElement(StructuredMetadataTable, { metadata: (_d = (_c = node.status) == null ? void 0 : _c.nodeInfo) != null ? _d : {} })), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Addresses"), /* @__PURE__ */ React.createElement(
|
|
144
|
+
StructuredMetadataTable,
|
|
145
|
+
{
|
|
146
|
+
metadata: (_g = (_f = (_e = node.status) == null ? void 0 : _e.addresses) == null ? void 0 : _f.reduce((accum, next) => {
|
|
147
|
+
accum[next.type] = next.address;
|
|
148
|
+
return accum;
|
|
149
|
+
}, {})) != null ? _g : {}
|
|
150
|
+
}
|
|
151
|
+
)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Taints"), /* @__PURE__ */ React.createElement(
|
|
152
|
+
StructuredMetadataTable,
|
|
153
|
+
{
|
|
154
|
+
metadata: (_j = (_i = (_h = node.spec) == null ? void 0 : _h.taints) == null ? void 0 : _i.reduce((accum, next) => {
|
|
155
|
+
accum[`${next.effect}`] = `${next.key} (${next.value})`;
|
|
156
|
+
return accum;
|
|
157
|
+
}, {})) != null ? _j : {}
|
|
158
|
+
}
|
|
159
|
+
)))
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
title: "Schedulable",
|
|
165
|
+
align: "center",
|
|
166
|
+
width: "auto",
|
|
167
|
+
render: (node) => {
|
|
168
|
+
var _a;
|
|
169
|
+
if ((_a = node.spec) == null ? void 0 : _a.unschedulable) {
|
|
170
|
+
return "\u274C";
|
|
171
|
+
}
|
|
172
|
+
return "\u2705";
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
title: "Status",
|
|
177
|
+
width: "auto",
|
|
178
|
+
render: (node) => {
|
|
179
|
+
var _a, _b;
|
|
180
|
+
const readyCondition = (_b = (_a = node.status) == null ? void 0 : _a.conditions) == null ? void 0 : _b.find((c) => {
|
|
181
|
+
return c.type === "Ready";
|
|
182
|
+
});
|
|
183
|
+
if (!readyCondition) {
|
|
184
|
+
return "Unknown";
|
|
185
|
+
}
|
|
186
|
+
return readyCondition.status === "True" ? "Ready" : "Not Ready";
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
title: "OS",
|
|
191
|
+
width: "auto",
|
|
192
|
+
render: (node) => {
|
|
193
|
+
var _a, _b, _c, _d, _e, _f;
|
|
194
|
+
return `${(_c = (_b = (_a = node.status) == null ? void 0 : _a.nodeInfo) == null ? void 0 : _b.operatingSystem) != null ? _c : "unknown"} (${(_f = (_e = (_d = node.status) == null ? void 0 : _d.nodeInfo) == null ? void 0 : _e.architecture) != null ? _f : "?"})`;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
];
|
|
198
|
+
const Nodes = () => {
|
|
199
|
+
var _a;
|
|
200
|
+
const classes = useStyles$1();
|
|
201
|
+
const { entity } = useEntity();
|
|
202
|
+
const { value, error, loading } = useNodes({
|
|
203
|
+
clusterName: entity.metadata.name
|
|
204
|
+
});
|
|
205
|
+
const { setError } = useKubernetesClusterError();
|
|
206
|
+
const setErrorCallback = useCallback(setError, [setError]);
|
|
207
|
+
useEffect(() => {
|
|
208
|
+
if (error) {
|
|
209
|
+
setErrorCallback(error.message);
|
|
210
|
+
}
|
|
211
|
+
}, [error, setErrorCallback]);
|
|
212
|
+
return /* @__PURE__ */ React.createElement(
|
|
213
|
+
Table,
|
|
214
|
+
{
|
|
215
|
+
title: "Nodes",
|
|
216
|
+
options: { paging: true, search: false, emptyRowsWhenPaging: false },
|
|
217
|
+
isLoading: !value && loading,
|
|
218
|
+
data: (_a = value == null ? void 0 : value.items) != null ? _a : [],
|
|
219
|
+
emptyContent: /* @__PURE__ */ React.createElement("div", { className: classes.empty }, error !== void 0 ? "Error loading nodes" : "No nodes found"),
|
|
220
|
+
columns: defaultColumns
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const useCluster = ({ clusterName }) => {
|
|
226
|
+
const kubernetesApi = useApi(kubernetesApiRef);
|
|
227
|
+
return useAsync(async () => {
|
|
228
|
+
return await kubernetesApi.getCluster(clusterName);
|
|
229
|
+
}, [clusterName]);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const useStyles = makeStyles(
|
|
233
|
+
(_theme) => createStyles({
|
|
234
|
+
root: {
|
|
235
|
+
height: "100%"
|
|
236
|
+
}
|
|
237
|
+
})
|
|
238
|
+
);
|
|
239
|
+
const ClusterOverview = () => {
|
|
240
|
+
var _a, _b;
|
|
241
|
+
const classes = useStyles();
|
|
242
|
+
const { entity } = useEntity();
|
|
243
|
+
const { value, loading, error } = useCluster({
|
|
244
|
+
clusterName: entity.metadata.name
|
|
245
|
+
});
|
|
246
|
+
const { setError } = useKubernetesClusterError();
|
|
247
|
+
const setErrorCallback = useCallback(setError, [setError]);
|
|
248
|
+
useEffect(() => {
|
|
249
|
+
if (error) {
|
|
250
|
+
setErrorCallback(error.message);
|
|
251
|
+
}
|
|
252
|
+
}, [error, setErrorCallback]);
|
|
253
|
+
return /* @__PURE__ */ React.createElement(InfoCard, { title: "Cluster Overview", className: classes.root }, !value && loading && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Skeleton, { height: "35rem" })), value && /* @__PURE__ */ React.createElement(
|
|
254
|
+
StructuredMetadataTable,
|
|
255
|
+
{
|
|
256
|
+
metadata: {
|
|
257
|
+
name: value.name,
|
|
258
|
+
"Backstage auth provider": value.authProvider,
|
|
259
|
+
"OIDC Token Provider": (_a = value.oidcTokenProvider) != null ? _a : "N/A",
|
|
260
|
+
"Dashboard Link": (_b = value.dashboardUrl) != null ? _b : "N/A"
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
));
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const ContentGrid = () => {
|
|
267
|
+
const { error } = useKubernetesClusterError();
|
|
268
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Grid, { container: true }, error && /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(WarningPanel, { title: "Error loading Kubernetes Cluster Plugin" }, /* @__PURE__ */ React.createElement(Typography, null, error))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(ClusterOverview, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(ApiResources, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Nodes, null))));
|
|
269
|
+
};
|
|
270
|
+
const KubernetesClusterContent = () => {
|
|
271
|
+
return /* @__PURE__ */ React.createElement(KubernetesClusterErrorProvider, null, /* @__PURE__ */ React.createElement(ContentGrid, null));
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const isKubernetesClusterAvailable = (entity) => {
|
|
275
|
+
var _a;
|
|
276
|
+
return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[ANNOTATION_KUBERNETES_API_SERVER]);
|
|
277
|
+
};
|
|
278
|
+
const Router = () => {
|
|
279
|
+
const { entity } = useEntity();
|
|
280
|
+
if (isKubernetesClusterAvailable(entity)) {
|
|
281
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, { path: "/", element: /* @__PURE__ */ React.createElement(KubernetesClusterContent, null) }));
|
|
282
|
+
}
|
|
283
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
284
|
+
MissingAnnotationEmptyState,
|
|
285
|
+
{
|
|
286
|
+
annotation: ANNOTATION_KUBERNETES_API_SERVER
|
|
287
|
+
}
|
|
288
|
+
));
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
var Router$1 = /*#__PURE__*/Object.freeze({
|
|
292
|
+
__proto__: null,
|
|
293
|
+
isKubernetesClusterAvailable: isKubernetesClusterAvailable,
|
|
294
|
+
Router: Router
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
export { EntityKubernetesClusterContent, Router, isKubernetesClusterAvailable };
|
|
298
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/plugin.ts","../src/components/ApiResources/useApiResources.ts","../src/components/KubernetesClusterErrorContext/KubernetesClusterErrorContext.tsx","../src/components/ApiResources/ApiResources.tsx","../src/components/Nodes/useNodes.ts","../src/components/Nodes/Nodes.tsx","../src/components/ClusterOverview/useCluster.ts","../src/components/ClusterOverview/ClusterOverview.tsx","../src/components/KubernetesClusterContent/KubernetesClusterContent.tsx","../src/Router.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createPlugin,\n createRouteRef,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\n\nexport const rootCatalogKubernetesClusterRouteRef = createRouteRef({\n id: 'kubernetes-cluster',\n});\n\nexport const kubernetesClusterPlugin = createPlugin({\n id: 'kubernetes-cluster',\n apis: [],\n routes: {\n entityContent: rootCatalogKubernetesClusterRouteRef,\n },\n});\n\n/**\n * Props of EntityKubernetesContent\n *\n * @public\n */\nexport type EntityKubernetesClusterContentProps = {};\n\n/**\n * Props of EntityKubernetesContent\n *\n * @public\n */\nexport const EntityKubernetesClusterContent: (\n props: EntityKubernetesClusterContentProps,\n) => JSX.Element = kubernetesClusterPlugin.provide(\n createRoutableExtension({\n name: 'EntityKubernetesClusterContent',\n component: () => import('./Router').then(m => m.Router),\n mountPoint: rootCatalogKubernetesClusterRouteRef,\n }),\n);\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport useAsync from 'react-use/lib/useAsync';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { kubernetesApiRef } from '@backstage/plugin-kubernetes-react';\nimport { IAPIGroupList } from '@kubernetes-models/apimachinery/apis/meta/v1';\n\n/**\n * Arguments for useApiResources\n *\n * @public\n */\nexport interface ApiResourcesOptions {\n clusterName: string;\n}\n\n/**\n * Retrieves the logs for the given pod\n *\n * @public\n */\nexport const useApiResources = ({ clusterName }: ApiResourcesOptions) => {\n const kubernetesApi = useApi(kubernetesApiRef);\n return useAsync(async () => {\n return await kubernetesApi\n .proxy({\n clusterName,\n path: '/apis',\n })\n .then(r => {\n return r.json() as Promise<IAPIGroupList>;\n });\n }, [clusterName]);\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useContext, useState } from 'react';\n\nexport interface ErrorContext {\n error?: string;\n setError: (message: string) => void;\n}\n\nexport const KubernetesClusterErrorContext = React.createContext<ErrorContext>({\n setError: (_: string) => {},\n});\n\nexport interface KubernetesClusterErrorProviderProps {\n children: React.ReactNode;\n}\n\nexport const KubernetesClusterErrorProvider = ({\n children,\n}: KubernetesClusterErrorProviderProps) => {\n const [error, setError] = useState<string | undefined>(undefined);\n\n const contextValue: ErrorContext = {\n error,\n setError: useCallback((message: string) => setError(message), []),\n };\n\n return (\n <KubernetesClusterErrorContext.Provider value={contextValue}>\n {children}\n </KubernetesClusterErrorContext.Provider>\n );\n};\n\nexport const useKubernetesClusterError = () => {\n return useContext(KubernetesClusterErrorContext);\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useApiResources } from './useApiResources';\nimport React, { useCallback, useEffect } from 'react';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { IAPIGroup } from '@kubernetes-models/apimachinery/apis/meta/v1';\nimport { useKubernetesClusterError } from '../KubernetesClusterErrorContext/KubernetesClusterErrorContext';\nimport { makeStyles } from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\nconst defaultColumns: TableColumn<IAPIGroup>[] = [\n {\n title: 'Name',\n highlight: true,\n render: (apiGroup: IAPIGroup) => {\n return apiGroup.name;\n },\n },\n {\n title: 'Preferred Version',\n highlight: true,\n render: (apiGroup: IAPIGroup) => {\n return apiGroup.preferredVersion?.groupVersion;\n },\n },\n];\n\nexport const ApiResources = () => {\n const classes = useStyles();\n const { entity } = useEntity();\n const { setError } = useKubernetesClusterError();\n const setErrorCallback = useCallback(setError, [setError]);\n const { value, error, loading } = useApiResources({\n clusterName: entity.metadata.name,\n });\n\n useEffect(() => {\n if (error) {\n setErrorCallback(error.message);\n }\n }, [error, setErrorCallback]);\n\n return (\n <Table\n title=\"API Resources\"\n options={{ paging: true, search: false, emptyRowsWhenPaging: false }}\n isLoading={!value && loading}\n data={value?.groups ?? []}\n emptyContent={\n <div className={classes.empty}>\n {error !== undefined\n ? 'Error loading API Resources'\n : 'No API Resources found'}\n </div>\n }\n columns={defaultColumns}\n />\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport useAsync from 'react-use/lib/useAsync';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { kubernetesApiRef } from '@backstage/plugin-kubernetes-react';\nimport { NodeList } from 'kubernetes-models/v1';\n\n/**\n * Arguments for useApiResources\n *\n * @public\n */\nexport interface useNodesOptions {\n clusterName: string;\n}\n\n/**\n * Retrieves nodes for a cluster\n *\n * @public\n */\nexport const useNodes = ({ clusterName }: useNodesOptions) => {\n const kubernetesApi = useApi(kubernetesApiRef);\n return useAsync(async () => {\n return await kubernetesApi\n .proxy({\n clusterName,\n path: '/api/v1/nodes?limit=500',\n })\n .then(r => {\n return r.json() as Promise<NodeList>;\n });\n }, [clusterName]);\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useNodes } from './useNodes';\nimport React, { useCallback, useEffect } from 'react';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport {\n StructuredMetadataTable,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport { INode } from 'kubernetes-models/v1';\nimport { Grid, Typography, makeStyles } from '@material-ui/core';\nimport { useKubernetesClusterError } from '../KubernetesClusterErrorContext/KubernetesClusterErrorContext';\nimport { KubernetesDrawer } from '@backstage/plugin-kubernetes-react';\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\nconst defaultColumns: TableColumn<INode>[] = [\n {\n title: 'Name',\n highlight: true,\n width: 'auto',\n render: (node: INode) => {\n return (\n <KubernetesDrawer\n kubernetesObject={node}\n label={node.metadata?.name ?? 'unknown-node'}\n >\n <Grid container>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Node Info</Typography>\n <StructuredMetadataTable metadata={node.status?.nodeInfo ?? {}} />\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Addresses</Typography>\n <StructuredMetadataTable\n metadata={\n node.status?.addresses?.reduce((accum, next) => {\n accum[next.type] = next.address;\n return accum;\n }, {} as any) ?? {}\n }\n />\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Taints</Typography>\n <StructuredMetadataTable\n metadata={\n node.spec?.taints?.reduce((accum, next) => {\n accum[`${next.effect}`] = `${next.key} (${next.value})`;\n return accum;\n }, {} as any) ?? {}\n }\n />\n </Grid>\n </Grid>\n </KubernetesDrawer>\n );\n },\n },\n {\n title: 'Schedulable',\n align: 'center',\n width: 'auto',\n render: (node: INode) => {\n if (node.spec?.unschedulable) {\n return '❌';\n }\n return '✅';\n },\n },\n {\n title: 'Status',\n width: 'auto',\n render: (node: INode) => {\n // TODO add an icon\n const readyCondition = node.status?.conditions?.find(c => {\n return c.type === 'Ready';\n });\n if (!readyCondition) {\n return 'Unknown';\n }\n return readyCondition.status === 'True' ? 'Ready' : 'Not Ready';\n },\n },\n {\n title: 'OS',\n width: 'auto',\n render: (node: INode) => {\n return `${node.status?.nodeInfo?.operatingSystem ?? 'unknown'} (${\n node.status?.nodeInfo?.architecture ?? '?'\n })`;\n },\n },\n];\n\nexport const Nodes = () => {\n const classes = useStyles();\n const { entity } = useEntity();\n const { value, error, loading } = useNodes({\n clusterName: entity.metadata.name,\n });\n const { setError } = useKubernetesClusterError();\n const setErrorCallback = useCallback(setError, [setError]);\n useEffect(() => {\n if (error) {\n setErrorCallback(error.message);\n }\n }, [error, setErrorCallback]);\n\n return (\n <Table\n title=\"Nodes\"\n options={{ paging: true, search: false, emptyRowsWhenPaging: false }}\n isLoading={!value && loading}\n data={value?.items ?? []}\n emptyContent={\n <div className={classes.empty}>\n {error !== undefined ? 'Error loading nodes' : 'No nodes found'}\n </div>\n }\n columns={defaultColumns}\n />\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport useAsync from 'react-use/lib/useAsync';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { kubernetesApiRef } from '@backstage/plugin-kubernetes-react';\n\n/**\n * Arguments for useApiResources\n *\n * @public\n */\nexport interface UseClusterOptions {\n clusterName: string;\n}\n\n/**\n * Retrieves the logs for the given pod\n *\n * @public\n */\nexport const useCluster = ({ clusterName }: UseClusterOptions) => {\n const kubernetesApi = useApi(kubernetesApiRef);\n return useAsync(async () => {\n return await kubernetesApi.getCluster(clusterName);\n }, [clusterName]);\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useEffect } from 'react';\nimport { InfoCard, StructuredMetadataTable } from '@backstage/core-components';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { useCluster } from './useCluster';\nimport { Skeleton } from '@material-ui/lab';\nimport { Theme, createStyles, makeStyles } from '@material-ui/core';\nimport { useKubernetesClusterError } from '../KubernetesClusterErrorContext/KubernetesClusterErrorContext';\n\nconst useStyles = makeStyles((_theme: Theme) =>\n createStyles({\n root: {\n height: '100%',\n },\n }),\n);\n\nexport const ClusterOverview = () => {\n const classes = useStyles();\n const { entity } = useEntity();\n const { value, loading, error } = useCluster({\n clusterName: entity.metadata.name,\n });\n const { setError } = useKubernetesClusterError();\n const setErrorCallback = useCallback(setError, [setError]);\n useEffect(() => {\n if (error) {\n setErrorCallback(error.message);\n }\n }, [error, setErrorCallback]);\n\n return (\n <InfoCard title=\"Cluster Overview\" className={classes.root}>\n {!value && loading && (\n <>\n <Skeleton height=\"35rem\" />\n </>\n )}\n {value && (\n <StructuredMetadataTable\n metadata={{\n name: value.name,\n 'Backstage auth provider': value.authProvider,\n 'OIDC Token Provider': value.oidcTokenProvider ?? 'N/A',\n 'Dashboard Link': value.dashboardUrl ?? 'N/A',\n }}\n />\n )}\n </InfoCard>\n );\n};\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { ApiResources } from '../ApiResources/ApiResources';\nimport { Grid, Typography } from '@material-ui/core';\nimport { Nodes } from '../Nodes/Nodes';\nimport { ClusterOverview } from '../ClusterOverview';\nimport {\n KubernetesClusterErrorProvider,\n useKubernetesClusterError,\n} from '../KubernetesClusterErrorContext/KubernetesClusterErrorContext';\nimport { WarningPanel } from '@backstage/core-components';\n\nconst ContentGrid = () => {\n const { error } = useKubernetesClusterError();\n return (\n <>\n <Grid container>\n {error && (\n <Grid item xs={12}>\n <WarningPanel title=\"Error loading Kubernetes Cluster Plugin\">\n <Typography>{error}</Typography>\n </WarningPanel>\n </Grid>\n )}\n <Grid item xs={6}>\n <ClusterOverview />\n </Grid>\n <Grid item xs={6}>\n <ApiResources />\n </Grid>\n <Grid item xs={12}>\n <Nodes />\n </Grid>\n </Grid>\n </>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const KubernetesClusterContent = () => {\n return (\n <KubernetesClusterErrorProvider>\n <ContentGrid />\n </KubernetesClusterErrorProvider>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { Entity } from '@backstage/catalog-model';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { Route, Routes } from 'react-router-dom';\nimport { MissingAnnotationEmptyState } from '@backstage/core-components';\nimport { ANNOTATION_KUBERNETES_API_SERVER } from '@backstage/plugin-kubernetes-common';\nimport { KubernetesClusterContent } from './components/KubernetesClusterContent';\n\n/**\n *\n *\n * @public\n */\nexport const isKubernetesClusterAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[ANNOTATION_KUBERNETES_API_SERVER]);\n\n/**\n *\n *\n * @public\n */\nexport const Router = () => {\n const { entity } = useEntity();\n\n if (isKubernetesClusterAvailable(entity)) {\n return (\n <Routes>\n <Route path=\"/\" element={<KubernetesClusterContent />} />\n </Routes>\n );\n }\n\n return (\n <>\n <MissingAnnotationEmptyState\n annotation={ANNOTATION_KUBERNETES_API_SERVER}\n />\n </>\n );\n};\n"],"names":["useStyles","defaultColumns"],"mappings":";;;;;;;;;;;AAqBO,MAAM,uCAAuC,cAAe,CAAA;AAAA,EACjE,EAA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,MAAM,SAAS,MAAM;AAC1B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAE7B,EAAI,IAAA,4BAAA,CAA6B,MAAM,CAAG,EAAA;AACxC,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,MACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAK,KAAI,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,wBAAyB,EAAA,IAAA,CAAA,EAAI,CACzD,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,2BAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,gCAAA;AAAA,KAAA;AAAA,GAEhB,CAAA,CAAA;AAEJ;;;;;;;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backstage/plugin-kubernetes-cluster",
|
|
3
|
+
"description": "A Backstage plugin that shows details of Kubernetes clusters",
|
|
4
|
+
"version": "0.0.0-nightly-20231005021327",
|
|
5
|
+
"main": "dist/index.esm.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"main": "dist/index.esm.js",
|
|
11
|
+
"types": "dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"backstage": {
|
|
14
|
+
"role": "frontend-plugin"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://backstage.io",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/backstage/backstage",
|
|
20
|
+
"directory": "plugins/kubernetes-cluster"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"backstage",
|
|
24
|
+
"kubernetes"
|
|
25
|
+
],
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "backstage-cli package build",
|
|
29
|
+
"start": "backstage-cli package start",
|
|
30
|
+
"lint": "backstage-cli package lint",
|
|
31
|
+
"test": "backstage-cli package test",
|
|
32
|
+
"prepack": "backstage-cli package prepack",
|
|
33
|
+
"postpack": "backstage-cli package postpack",
|
|
34
|
+
"clean": "backstage-cli package clean"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@backstage/catalog-model": "^1.4.2",
|
|
38
|
+
"@backstage/config": "^1.1.0",
|
|
39
|
+
"@backstage/core-components": "^0.0.0-nightly-20231005021327",
|
|
40
|
+
"@backstage/core-plugin-api": "^0.0.0-nightly-20231005021327",
|
|
41
|
+
"@backstage/errors": "^1.2.2",
|
|
42
|
+
"@backstage/plugin-catalog-react": "^0.0.0-nightly-20231005021327",
|
|
43
|
+
"@backstage/plugin-kubernetes-common": "^0.0.0-nightly-20231005021327",
|
|
44
|
+
"@backstage/plugin-kubernetes-react": "^0.0.0-nightly-20231005021327",
|
|
45
|
+
"@backstage/theme": "^0.4.2",
|
|
46
|
+
"@kubernetes-models/apimachinery": "^1.1.0",
|
|
47
|
+
"@kubernetes-models/base": "^4.0.1",
|
|
48
|
+
"@material-ui/core": "^4.12.2",
|
|
49
|
+
"@material-ui/icons": "^4.9.1",
|
|
50
|
+
"@material-ui/lab": "4.0.0-alpha.61",
|
|
51
|
+
"@types/react": "^16.13.1 || ^17.0.0",
|
|
52
|
+
"cronstrue": "^2.2.0",
|
|
53
|
+
"js-yaml": "^4.0.0",
|
|
54
|
+
"kubernetes-models": "^4.1.0",
|
|
55
|
+
"lodash": "^4.17.21",
|
|
56
|
+
"luxon": "^3.0.0",
|
|
57
|
+
"react-use": "^17.2.4"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"react": "^16.13.1 || ^17.0.0",
|
|
61
|
+
"react-dom": "^16.13.1 || ^17.0.0",
|
|
62
|
+
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@backstage/cli": "^0.0.0-nightly-20231005021327",
|
|
66
|
+
"@backstage/core-app-api": "^0.0.0-nightly-20231005021327",
|
|
67
|
+
"@backstage/dev-utils": "^0.0.0-nightly-20231005021327",
|
|
68
|
+
"@backstage/test-utils": "^0.0.0-nightly-20231005021327",
|
|
69
|
+
"@testing-library/dom": "^8.0.0",
|
|
70
|
+
"@testing-library/jest-dom": "^5.10.1",
|
|
71
|
+
"@testing-library/react": "^12.1.3",
|
|
72
|
+
"@testing-library/react-hooks": "^8.0.0",
|
|
73
|
+
"@testing-library/user-event": "^14.0.0",
|
|
74
|
+
"@types/node": "^16.11.26",
|
|
75
|
+
"msw": "^1.0.0"
|
|
76
|
+
},
|
|
77
|
+
"files": [
|
|
78
|
+
"dist"
|
|
79
|
+
],
|
|
80
|
+
"module": "./dist/index.esm.js"
|
|
81
|
+
}
|