@backstage/plugin-kubernetes 0.11.9 → 0.11.10-next.1
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 +21 -0
- package/dist/KubernetesContent.esm.js +71 -0
- package/dist/KubernetesContent.esm.js.map +1 -0
- package/dist/Router.esm.js +47 -0
- package/dist/Router.esm.js.map +1 -0
- package/dist/index.esm.js +2 -201
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin.esm.js +87 -0
- package/dist/plugin.esm.js.map +1 -0
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @backstage/plugin-kubernetes
|
|
2
2
|
|
|
3
|
+
## 0.11.10-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/core-components@0.14.6-next.1
|
|
9
|
+
- @backstage/plugin-kubernetes-react@0.3.5-next.1
|
|
10
|
+
- @backstage/plugin-catalog-react@1.11.4-next.1
|
|
11
|
+
|
|
12
|
+
## 0.11.10-next.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/catalog-model@1.5.0-next.0
|
|
18
|
+
- @backstage/core-components@0.14.5-next.0
|
|
19
|
+
- @backstage/plugin-catalog-react@1.11.4-next.0
|
|
20
|
+
- @backstage/plugin-kubernetes-common@0.7.6-next.0
|
|
21
|
+
- @backstage/plugin-kubernetes-react@0.3.5-next.0
|
|
22
|
+
- @backstage/core-plugin-api@1.9.2
|
|
23
|
+
|
|
3
24
|
## 0.11.9
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Grid from '@material-ui/core/Grid';
|
|
3
|
+
import Typography from '@material-ui/core/Typography';
|
|
4
|
+
import { useKubernetesObjects, DetectedErrorsContext, ErrorPanel, ErrorReporting, Cluster } from '@backstage/plugin-kubernetes-react';
|
|
5
|
+
import { detectErrors } from '@backstage/plugin-kubernetes-common';
|
|
6
|
+
import { Page, Content, Progress, EmptyState } from '@backstage/core-components';
|
|
7
|
+
|
|
8
|
+
const KubernetesContent = ({
|
|
9
|
+
entity,
|
|
10
|
+
refreshIntervalMs
|
|
11
|
+
}) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const { kubernetesObjects, error } = useKubernetesObjects(
|
|
14
|
+
entity,
|
|
15
|
+
refreshIntervalMs
|
|
16
|
+
);
|
|
17
|
+
const clusters = (_a = kubernetesObjects == null ? void 0 : kubernetesObjects.items.map((item) => item.cluster)) != null ? _a : [];
|
|
18
|
+
const clustersWithErrors = (_b = kubernetesObjects == null ? void 0 : kubernetesObjects.items.filter((r) => r.errors.length > 0)) != null ? _b : [];
|
|
19
|
+
const detectedErrors = kubernetesObjects !== void 0 ? detectErrors(kubernetesObjects) : /* @__PURE__ */ new Map();
|
|
20
|
+
return /* @__PURE__ */ React.createElement(DetectedErrorsContext.Provider, { value: [...detectedErrors.values()].flat() }, /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Content, null, kubernetesObjects === void 0 && error === void 0 && /* @__PURE__ */ React.createElement(Progress, null), clustersWithErrors.length > 0 && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
|
|
21
|
+
ErrorPanel,
|
|
22
|
+
{
|
|
23
|
+
entityName: entity.metadata.name,
|
|
24
|
+
clustersWithErrors
|
|
25
|
+
}
|
|
26
|
+
))), error !== void 0 && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
|
|
27
|
+
ErrorPanel,
|
|
28
|
+
{
|
|
29
|
+
entityName: entity.metadata.name,
|
|
30
|
+
errorMessage: error
|
|
31
|
+
}
|
|
32
|
+
))), kubernetesObjects && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
|
|
33
|
+
ErrorReporting,
|
|
34
|
+
{
|
|
35
|
+
detectedErrors,
|
|
36
|
+
clusters
|
|
37
|
+
}
|
|
38
|
+
)), /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(Typography, { variant: "h3" }, "Your Clusters")), /* @__PURE__ */ React.createElement(Grid, { item: true, container: true }, (kubernetesObjects == null ? void 0 : kubernetesObjects.items.length) <= 0 && /* @__PURE__ */ React.createElement(
|
|
39
|
+
Grid,
|
|
40
|
+
{
|
|
41
|
+
container: true,
|
|
42
|
+
justifyContent: "space-around",
|
|
43
|
+
direction: "row",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
spacing: 2
|
|
46
|
+
},
|
|
47
|
+
/* @__PURE__ */ React.createElement(Grid, { item: true, xs: 8 }, /* @__PURE__ */ React.createElement(
|
|
48
|
+
EmptyState,
|
|
49
|
+
{
|
|
50
|
+
missing: "data",
|
|
51
|
+
title: "No Kubernetes resources",
|
|
52
|
+
description: `No resources on any known clusters for ${entity.metadata.name}`
|
|
53
|
+
}
|
|
54
|
+
))
|
|
55
|
+
), (kubernetesObjects == null ? void 0 : kubernetesObjects.items.length) > 0 && (kubernetesObjects == null ? void 0 : kubernetesObjects.items.map((item, i) => {
|
|
56
|
+
var _a2;
|
|
57
|
+
const podsWithErrors = new Set(
|
|
58
|
+
(_a2 = detectedErrors.get(item.cluster.name)) == null ? void 0 : _a2.filter((de) => de.sourceRef.kind === "Pod").map((de) => de.sourceRef.name)
|
|
59
|
+
);
|
|
60
|
+
return /* @__PURE__ */ React.createElement(Grid, { item: true, key: i, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
61
|
+
Cluster,
|
|
62
|
+
{
|
|
63
|
+
clusterObjects: item,
|
|
64
|
+
podsWithErrors
|
|
65
|
+
}
|
|
66
|
+
));
|
|
67
|
+
})))))));
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { KubernetesContent };
|
|
71
|
+
//# sourceMappingURL=KubernetesContent.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KubernetesContent.esm.js","sources":["../src/KubernetesContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n ErrorPanel,\n ErrorReporting,\n Cluster,\n useKubernetesObjects,\n DetectedErrorsContext,\n} from '@backstage/plugin-kubernetes-react';\nimport {\n DetectedError,\n detectErrors,\n} from '@backstage/plugin-kubernetes-common';\nimport {\n Content,\n EmptyState,\n Page,\n Progress,\n} from '@backstage/core-components';\n\ntype KubernetesContentProps = {\n entity: Entity;\n refreshIntervalMs?: number;\n children?: React.ReactNode;\n};\n\nexport const KubernetesContent = ({\n entity,\n refreshIntervalMs,\n}: KubernetesContentProps) => {\n const { kubernetesObjects, error } = useKubernetesObjects(\n entity,\n refreshIntervalMs,\n );\n\n const clusters = kubernetesObjects?.items.map(item => item.cluster) ?? [];\n\n const clustersWithErrors =\n kubernetesObjects?.items.filter(r => r.errors.length > 0) ?? [];\n\n const detectedErrors =\n kubernetesObjects !== undefined\n ? detectErrors(kubernetesObjects)\n : new Map<string, DetectedError[]>();\n\n return (\n <DetectedErrorsContext.Provider value={[...detectedErrors.values()].flat()}>\n <Page themeId=\"tool\">\n <Content>\n {kubernetesObjects === undefined && error === undefined && (\n <Progress />\n )}\n\n {/* errors retrieved from the kubernetes clusters */}\n {clustersWithErrors.length > 0 && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorPanel\n entityName={entity.metadata.name}\n clustersWithErrors={clustersWithErrors}\n />\n </Grid>\n </Grid>\n )}\n\n {/* other errors */}\n {error !== undefined && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorPanel\n entityName={entity.metadata.name}\n errorMessage={error}\n />\n </Grid>\n </Grid>\n )}\n\n {kubernetesObjects && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorReporting\n detectedErrors={detectedErrors}\n clusters={clusters}\n />\n </Grid>\n <Grid item>\n <Typography variant=\"h3\">Your Clusters</Typography>\n </Grid>\n <Grid item container>\n {kubernetesObjects?.items.length <= 0 && (\n <Grid\n container\n justifyContent=\"space-around\"\n direction=\"row\"\n alignItems=\"center\"\n spacing={2}\n >\n <Grid item xs={8}>\n <EmptyState\n missing=\"data\"\n title=\"No Kubernetes resources\"\n description={`No resources on any known clusters for ${entity.metadata.name}`}\n />\n </Grid>\n </Grid>\n )}\n {kubernetesObjects?.items.length > 0 &&\n kubernetesObjects?.items.map((item, i) => {\n const podsWithErrors = new Set<string>(\n detectedErrors\n .get(item.cluster.name)\n ?.filter(de => de.sourceRef.kind === 'Pod')\n .map(de => de.sourceRef.name),\n );\n\n return (\n <Grid item key={i} xs={12}>\n <Cluster\n clusterObjects={item}\n podsWithErrors={podsWithErrors}\n />\n </Grid>\n );\n })}\n </Grid>\n </Grid>\n )}\n </Content>\n </Page>\n </DetectedErrorsContext.Provider>\n );\n};\n"],"names":["_a"],"mappings":";;;;;;;AA4CO,MAAM,oBAAoB,CAAC;AAAA,EAChC,MAAA;AAAA,EACA,iBAAA;AACF,CAA8B,KAAA;AA/C9B,EAAA,IAAA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
|
2
|
+
import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
|
|
3
|
+
import { Routes, Route } from 'react-router-dom';
|
|
4
|
+
import { KubernetesContent } from './KubernetesContent.esm.js';
|
|
5
|
+
import Button from '@material-ui/core/Button';
|
|
6
|
+
|
|
7
|
+
const KUBERNETES_ANNOTATION = "backstage.io/kubernetes-id";
|
|
8
|
+
const KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION = "backstage.io/kubernetes-label-selector";
|
|
9
|
+
const isKubernetesAvailable = (entity) => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[KUBERNETES_ANNOTATION]) || Boolean(
|
|
12
|
+
(_b = entity.metadata.annotations) == null ? void 0 : _b[KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION]
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
const Router = (props) => {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const { entity } = useEntity();
|
|
18
|
+
const kubernetesAnnotationValue = (_a = entity.metadata.annotations) == null ? void 0 : _a[KUBERNETES_ANNOTATION];
|
|
19
|
+
const kubernetesLabelSelectorQueryAnnotationValue = (_b = entity.metadata.annotations) == null ? void 0 : _b[KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION];
|
|
20
|
+
if (kubernetesAnnotationValue || kubernetesLabelSelectorQueryAnnotationValue) {
|
|
21
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(
|
|
22
|
+
Route,
|
|
23
|
+
{
|
|
24
|
+
path: "/",
|
|
25
|
+
element: /* @__PURE__ */ React.createElement(
|
|
26
|
+
KubernetesContent,
|
|
27
|
+
{
|
|
28
|
+
entity,
|
|
29
|
+
refreshIntervalMs: props.refreshIntervalMs
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
));
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, { annotation: KUBERNETES_ANNOTATION }), /* @__PURE__ */ React.createElement("h1", null, "Or use a label selector query, which takes precedence over the previous annotation."), /* @__PURE__ */ React.createElement(
|
|
36
|
+
Button,
|
|
37
|
+
{
|
|
38
|
+
variant: "contained",
|
|
39
|
+
color: "primary",
|
|
40
|
+
href: "https://backstage.io/docs/features/kubernetes/configuration#surfacing-your-kubernetes-components-as-part-of-an-entity"
|
|
41
|
+
},
|
|
42
|
+
"Read Kubernetes Plugin Docs"
|
|
43
|
+
));
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { Router, isKubernetesAvailable };
|
|
47
|
+
//# sourceMappingURL=Router.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Router.esm.js","sources":["../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 */\n\nimport React from 'react';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { Route, Routes } from 'react-router-dom';\nimport { KubernetesContent } from './KubernetesContent';\nimport Button from '@material-ui/core/Button';\n\nconst KUBERNETES_ANNOTATION = 'backstage.io/kubernetes-id';\nconst KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION =\n 'backstage.io/kubernetes-label-selector';\n\nexport const isKubernetesAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[KUBERNETES_ANNOTATION]) ||\n Boolean(\n entity.metadata.annotations?.[KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION],\n );\n\nexport const Router = (props: { refreshIntervalMs?: number }) => {\n const { entity } = useEntity();\n\n const kubernetesAnnotationValue =\n entity.metadata.annotations?.[KUBERNETES_ANNOTATION];\n\n const kubernetesLabelSelectorQueryAnnotationValue =\n entity.metadata.annotations?.[KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION];\n\n if (\n kubernetesAnnotationValue ||\n kubernetesLabelSelectorQueryAnnotationValue\n ) {\n return (\n <Routes>\n <Route\n path=\"/\"\n element={\n <KubernetesContent\n entity={entity}\n refreshIntervalMs={props.refreshIntervalMs}\n />\n }\n />\n </Routes>\n );\n }\n\n return (\n <>\n <MissingAnnotationEmptyState annotation={KUBERNETES_ANNOTATION} />\n <h1>\n Or use a label selector query, which takes precedence over the previous\n annotation.\n </h1>\n <Button\n variant=\"contained\"\n color=\"primary\"\n href=\"https://backstage.io/docs/features/kubernetes/configuration#surfacing-your-kubernetes-components-as-part-of-an-entity\"\n >\n Read Kubernetes Plugin Docs\n </Button>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BA,MAAM,qBAAwB,GAAA,4BAAA,CAAA;AAC9B,MAAM,0CACJ,GAAA,wCAAA,CAAA;AAEW,MAAA,qBAAA,GAAwB,CAAC,MAAgB,KAAA;AA9BtD,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AA+BE,EAAA,OAAA,OAAA,CAAA,CAAQ,EAAO,GAAA,MAAA,CAAA,QAAA,CAAS,WAAhB,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAA8B,sBAAsB,CAC5D,IAAA,OAAA;AAAA,IACE,CAAA,EAAA,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,KAAhB,IAA8B,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,0CAAA,CAAA;AAAA,GAChC,CAAA;AAAA,EAAA;AAEW,MAAA,MAAA,GAAS,CAAC,KAA0C,KAAA;AApCjE,EAAA,IAA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ernetesContent, kubernetesPlugin, kubernetesPlugin as plugin } from './plugin.esm.js';
|
|
2
|
+
export { Router, isKubernetesAvailable } from './Router.esm.js';
|
|
2
3
|
export * from '@backstage/plugin-kubernetes-react';
|
|
3
|
-
import { createRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, gitlabAuthApiRef, googleAuthApiRef, microsoftAuthApiRef, oktaAuthApiRef, oneloginAuthApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
|
|
6
|
-
import { Routes, Route } from 'react-router-dom';
|
|
7
|
-
import Grid from '@material-ui/core/Grid';
|
|
8
|
-
import Typography from '@material-ui/core/Typography';
|
|
9
|
-
import { detectErrors } from '@backstage/plugin-kubernetes-common';
|
|
10
|
-
import { Page, Content, Progress, EmptyState } from '@backstage/core-components';
|
|
11
|
-
import Button from '@material-ui/core/Button';
|
|
12
|
-
|
|
13
|
-
const rootCatalogKubernetesRouteRef = createRouteRef({
|
|
14
|
-
id: "kubernetes"
|
|
15
|
-
});
|
|
16
|
-
const kubernetesPlugin = createPlugin({
|
|
17
|
-
id: "kubernetes",
|
|
18
|
-
apis: [
|
|
19
|
-
createApiFactory({
|
|
20
|
-
api: kubernetesApiRef,
|
|
21
|
-
deps: {
|
|
22
|
-
discoveryApi: discoveryApiRef,
|
|
23
|
-
identityApi: identityApiRef,
|
|
24
|
-
kubernetesAuthProvidersApi: kubernetesAuthProvidersApiRef
|
|
25
|
-
},
|
|
26
|
-
factory: ({ discoveryApi, identityApi, kubernetesAuthProvidersApi }) => new KubernetesBackendClient({
|
|
27
|
-
discoveryApi,
|
|
28
|
-
identityApi,
|
|
29
|
-
kubernetesAuthProvidersApi
|
|
30
|
-
})
|
|
31
|
-
}),
|
|
32
|
-
createApiFactory({
|
|
33
|
-
api: kubernetesProxyApiRef,
|
|
34
|
-
deps: {
|
|
35
|
-
kubernetesApi: kubernetesApiRef
|
|
36
|
-
},
|
|
37
|
-
factory: ({ kubernetesApi }) => new KubernetesProxyClient({
|
|
38
|
-
kubernetesApi
|
|
39
|
-
})
|
|
40
|
-
}),
|
|
41
|
-
createApiFactory({
|
|
42
|
-
api: kubernetesAuthProvidersApiRef,
|
|
43
|
-
deps: {
|
|
44
|
-
gitlabAuthApi: gitlabAuthApiRef,
|
|
45
|
-
googleAuthApi: googleAuthApiRef,
|
|
46
|
-
microsoftAuthApi: microsoftAuthApiRef,
|
|
47
|
-
oktaAuthApi: oktaAuthApiRef,
|
|
48
|
-
oneloginAuthApi: oneloginAuthApiRef
|
|
49
|
-
},
|
|
50
|
-
factory: ({
|
|
51
|
-
gitlabAuthApi,
|
|
52
|
-
googleAuthApi,
|
|
53
|
-
microsoftAuthApi,
|
|
54
|
-
oktaAuthApi,
|
|
55
|
-
oneloginAuthApi
|
|
56
|
-
}) => {
|
|
57
|
-
const oidcProviders = {
|
|
58
|
-
gitlab: gitlabAuthApi,
|
|
59
|
-
google: googleAuthApi,
|
|
60
|
-
microsoft: microsoftAuthApi,
|
|
61
|
-
okta: oktaAuthApi,
|
|
62
|
-
onelogin: oneloginAuthApi
|
|
63
|
-
};
|
|
64
|
-
return new KubernetesAuthProviders({
|
|
65
|
-
microsoftAuthApi,
|
|
66
|
-
googleAuthApi,
|
|
67
|
-
oidcProviders
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}),
|
|
71
|
-
createApiFactory({
|
|
72
|
-
api: kubernetesClusterLinkFormatterApiRef,
|
|
73
|
-
deps: { googleAuthApi: googleAuthApiRef },
|
|
74
|
-
factory: (deps) => {
|
|
75
|
-
const formatters = getDefaultFormatters(deps);
|
|
76
|
-
return new KubernetesClusterLinkFormatter({
|
|
77
|
-
formatters,
|
|
78
|
-
defaultFormatterName: DEFAULT_FORMATTER_NAME
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
],
|
|
83
|
-
routes: {
|
|
84
|
-
entityContent: rootCatalogKubernetesRouteRef
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
const EntityKubernetesContent = kubernetesPlugin.provide(
|
|
88
|
-
createRoutableExtension({
|
|
89
|
-
name: "EntityKubernetesContent",
|
|
90
|
-
component: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.Router),
|
|
91
|
-
mountPoint: rootCatalogKubernetesRouteRef
|
|
92
|
-
})
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
const KubernetesContent = ({
|
|
96
|
-
entity,
|
|
97
|
-
refreshIntervalMs
|
|
98
|
-
}) => {
|
|
99
|
-
var _a, _b;
|
|
100
|
-
const { kubernetesObjects, error } = useKubernetesObjects(
|
|
101
|
-
entity,
|
|
102
|
-
refreshIntervalMs
|
|
103
|
-
);
|
|
104
|
-
const clusters = (_a = kubernetesObjects == null ? void 0 : kubernetesObjects.items.map((item) => item.cluster)) != null ? _a : [];
|
|
105
|
-
const clustersWithErrors = (_b = kubernetesObjects == null ? void 0 : kubernetesObjects.items.filter((r) => r.errors.length > 0)) != null ? _b : [];
|
|
106
|
-
const detectedErrors = kubernetesObjects !== void 0 ? detectErrors(kubernetesObjects) : /* @__PURE__ */ new Map();
|
|
107
|
-
return /* @__PURE__ */ React.createElement(DetectedErrorsContext.Provider, { value: [...detectedErrors.values()].flat() }, /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Content, null, kubernetesObjects === void 0 && error === void 0 && /* @__PURE__ */ React.createElement(Progress, null), clustersWithErrors.length > 0 && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
|
|
108
|
-
ErrorPanel,
|
|
109
|
-
{
|
|
110
|
-
entityName: entity.metadata.name,
|
|
111
|
-
clustersWithErrors
|
|
112
|
-
}
|
|
113
|
-
))), error !== void 0 && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
|
|
114
|
-
ErrorPanel,
|
|
115
|
-
{
|
|
116
|
-
entityName: entity.metadata.name,
|
|
117
|
-
errorMessage: error
|
|
118
|
-
}
|
|
119
|
-
))), kubernetesObjects && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
|
|
120
|
-
ErrorReporting,
|
|
121
|
-
{
|
|
122
|
-
detectedErrors,
|
|
123
|
-
clusters
|
|
124
|
-
}
|
|
125
|
-
)), /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(Typography, { variant: "h3" }, "Your Clusters")), /* @__PURE__ */ React.createElement(Grid, { item: true, container: true }, (kubernetesObjects == null ? void 0 : kubernetesObjects.items.length) <= 0 && /* @__PURE__ */ React.createElement(
|
|
126
|
-
Grid,
|
|
127
|
-
{
|
|
128
|
-
container: true,
|
|
129
|
-
justifyContent: "space-around",
|
|
130
|
-
direction: "row",
|
|
131
|
-
alignItems: "center",
|
|
132
|
-
spacing: 2
|
|
133
|
-
},
|
|
134
|
-
/* @__PURE__ */ React.createElement(Grid, { item: true, xs: 8 }, /* @__PURE__ */ React.createElement(
|
|
135
|
-
EmptyState,
|
|
136
|
-
{
|
|
137
|
-
missing: "data",
|
|
138
|
-
title: "No Kubernetes resources",
|
|
139
|
-
description: `No resources on any known clusters for ${entity.metadata.name}`
|
|
140
|
-
}
|
|
141
|
-
))
|
|
142
|
-
), (kubernetesObjects == null ? void 0 : kubernetesObjects.items.length) > 0 && (kubernetesObjects == null ? void 0 : kubernetesObjects.items.map((item, i) => {
|
|
143
|
-
var _a2;
|
|
144
|
-
const podsWithErrors = new Set(
|
|
145
|
-
(_a2 = detectedErrors.get(item.cluster.name)) == null ? void 0 : _a2.filter((de) => de.sourceRef.kind === "Pod").map((de) => de.sourceRef.name)
|
|
146
|
-
);
|
|
147
|
-
return /* @__PURE__ */ React.createElement(Grid, { item: true, key: i, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
148
|
-
Cluster,
|
|
149
|
-
{
|
|
150
|
-
clusterObjects: item,
|
|
151
|
-
podsWithErrors
|
|
152
|
-
}
|
|
153
|
-
));
|
|
154
|
-
})))))));
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
const KUBERNETES_ANNOTATION = "backstage.io/kubernetes-id";
|
|
158
|
-
const KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION = "backstage.io/kubernetes-label-selector";
|
|
159
|
-
const isKubernetesAvailable = (entity) => {
|
|
160
|
-
var _a, _b;
|
|
161
|
-
return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[KUBERNETES_ANNOTATION]) || Boolean(
|
|
162
|
-
(_b = entity.metadata.annotations) == null ? void 0 : _b[KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION]
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
const Router = (props) => {
|
|
166
|
-
var _a, _b;
|
|
167
|
-
const { entity } = useEntity();
|
|
168
|
-
const kubernetesAnnotationValue = (_a = entity.metadata.annotations) == null ? void 0 : _a[KUBERNETES_ANNOTATION];
|
|
169
|
-
const kubernetesLabelSelectorQueryAnnotationValue = (_b = entity.metadata.annotations) == null ? void 0 : _b[KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION];
|
|
170
|
-
if (kubernetesAnnotationValue || kubernetesLabelSelectorQueryAnnotationValue) {
|
|
171
|
-
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(
|
|
172
|
-
Route,
|
|
173
|
-
{
|
|
174
|
-
path: "/",
|
|
175
|
-
element: /* @__PURE__ */ React.createElement(
|
|
176
|
-
KubernetesContent,
|
|
177
|
-
{
|
|
178
|
-
entity,
|
|
179
|
-
refreshIntervalMs: props.refreshIntervalMs
|
|
180
|
-
}
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
));
|
|
184
|
-
}
|
|
185
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, { annotation: KUBERNETES_ANNOTATION }), /* @__PURE__ */ React.createElement("h1", null, "Or use a label selector query, which takes precedence over the previous annotation."), /* @__PURE__ */ React.createElement(
|
|
186
|
-
Button,
|
|
187
|
-
{
|
|
188
|
-
variant: "contained",
|
|
189
|
-
color: "primary",
|
|
190
|
-
href: "https://backstage.io/docs/features/kubernetes/configuration#surfacing-your-kubernetes-components-as-part-of-an-entity"
|
|
191
|
-
},
|
|
192
|
-
"Read Kubernetes Plugin Docs"
|
|
193
|
-
));
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
var Router$1 = /*#__PURE__*/Object.freeze({
|
|
197
|
-
__proto__: null,
|
|
198
|
-
Router: Router,
|
|
199
|
-
isKubernetesAvailable: isKubernetesAvailable
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
export { EntityKubernetesContent, Router, isKubernetesAvailable, kubernetesPlugin, kubernetesPlugin as plugin };
|
|
203
4
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/plugin.ts","../src/KubernetesContent.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 KubernetesBackendClient,\n kubernetesApiRef,\n kubernetesProxyApiRef,\n kubernetesAuthProvidersApiRef,\n KubernetesAuthProviders,\n KubernetesProxyClient,\n kubernetesClusterLinkFormatterApiRef,\n getDefaultFormatters,\n KubernetesClusterLinkFormatter,\n DEFAULT_FORMATTER_NAME,\n} from '@backstage/plugin-kubernetes-react';\nimport {\n createApiFactory,\n createPlugin,\n createRouteRef,\n discoveryApiRef,\n identityApiRef,\n gitlabAuthApiRef,\n googleAuthApiRef,\n microsoftAuthApiRef,\n oktaAuthApiRef,\n oneloginAuthApiRef,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\n\nexport const rootCatalogKubernetesRouteRef = createRouteRef({\n id: 'kubernetes',\n});\n\nexport const kubernetesPlugin = createPlugin({\n id: 'kubernetes',\n apis: [\n createApiFactory({\n api: kubernetesApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n identityApi: identityApiRef,\n kubernetesAuthProvidersApi: kubernetesAuthProvidersApiRef,\n },\n factory: ({ discoveryApi, identityApi, kubernetesAuthProvidersApi }) =>\n new KubernetesBackendClient({\n discoveryApi,\n identityApi,\n kubernetesAuthProvidersApi,\n }),\n }),\n createApiFactory({\n api: kubernetesProxyApiRef,\n deps: {\n kubernetesApi: kubernetesApiRef,\n },\n factory: ({ kubernetesApi }) =>\n new KubernetesProxyClient({\n kubernetesApi,\n }),\n }),\n createApiFactory({\n api: kubernetesAuthProvidersApiRef,\n deps: {\n gitlabAuthApi: gitlabAuthApiRef,\n googleAuthApi: googleAuthApiRef,\n microsoftAuthApi: microsoftAuthApiRef,\n oktaAuthApi: oktaAuthApiRef,\n oneloginAuthApi: oneloginAuthApiRef,\n },\n factory: ({\n gitlabAuthApi,\n googleAuthApi,\n microsoftAuthApi,\n oktaAuthApi,\n oneloginAuthApi,\n }) => {\n const oidcProviders = {\n gitlab: gitlabAuthApi,\n google: googleAuthApi,\n microsoft: microsoftAuthApi,\n okta: oktaAuthApi,\n onelogin: oneloginAuthApi,\n };\n\n return new KubernetesAuthProviders({\n microsoftAuthApi,\n googleAuthApi,\n oidcProviders,\n });\n },\n }),\n createApiFactory({\n api: kubernetesClusterLinkFormatterApiRef,\n deps: { googleAuthApi: googleAuthApiRef },\n factory: deps => {\n const formatters = getDefaultFormatters(deps);\n return new KubernetesClusterLinkFormatter({\n formatters,\n defaultFormatterName: DEFAULT_FORMATTER_NAME,\n });\n },\n }),\n ],\n routes: {\n entityContent: rootCatalogKubernetesRouteRef,\n },\n});\n\n/**\n * Props of EntityKubernetesContent\n *\n * @public\n */\nexport type EntityKubernetesContentProps = {\n /**\n * Sets the refresh interval in milliseconds. The default value is 10000 (10 seconds)\n */\n refreshIntervalMs?: number;\n};\n\nexport const EntityKubernetesContent: (\n props: EntityKubernetesContentProps,\n) => JSX.Element = kubernetesPlugin.provide(\n createRoutableExtension({\n name: 'EntityKubernetesContent',\n component: () => import('./Router').then(m => m.Router),\n mountPoint: rootCatalogKubernetesRouteRef,\n }),\n);\n","/*\n * Copyright 2021 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 Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n ErrorPanel,\n ErrorReporting,\n Cluster,\n useKubernetesObjects,\n DetectedErrorsContext,\n} from '@backstage/plugin-kubernetes-react';\nimport {\n DetectedError,\n detectErrors,\n} from '@backstage/plugin-kubernetes-common';\nimport {\n Content,\n EmptyState,\n Page,\n Progress,\n} from '@backstage/core-components';\n\ntype KubernetesContentProps = {\n entity: Entity;\n refreshIntervalMs?: number;\n children?: React.ReactNode;\n};\n\nexport const KubernetesContent = ({\n entity,\n refreshIntervalMs,\n}: KubernetesContentProps) => {\n const { kubernetesObjects, error } = useKubernetesObjects(\n entity,\n refreshIntervalMs,\n );\n\n const clusters = kubernetesObjects?.items.map(item => item.cluster) ?? [];\n\n const clustersWithErrors =\n kubernetesObjects?.items.filter(r => r.errors.length > 0) ?? [];\n\n const detectedErrors =\n kubernetesObjects !== undefined\n ? detectErrors(kubernetesObjects)\n : new Map<string, DetectedError[]>();\n\n return (\n <DetectedErrorsContext.Provider value={[...detectedErrors.values()].flat()}>\n <Page themeId=\"tool\">\n <Content>\n {kubernetesObjects === undefined && error === undefined && (\n <Progress />\n )}\n\n {/* errors retrieved from the kubernetes clusters */}\n {clustersWithErrors.length > 0 && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorPanel\n entityName={entity.metadata.name}\n clustersWithErrors={clustersWithErrors}\n />\n </Grid>\n </Grid>\n )}\n\n {/* other errors */}\n {error !== undefined && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorPanel\n entityName={entity.metadata.name}\n errorMessage={error}\n />\n </Grid>\n </Grid>\n )}\n\n {kubernetesObjects && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorReporting\n detectedErrors={detectedErrors}\n clusters={clusters}\n />\n </Grid>\n <Grid item>\n <Typography variant=\"h3\">Your Clusters</Typography>\n </Grid>\n <Grid item container>\n {kubernetesObjects?.items.length <= 0 && (\n <Grid\n container\n justifyContent=\"space-around\"\n direction=\"row\"\n alignItems=\"center\"\n spacing={2}\n >\n <Grid item xs={8}>\n <EmptyState\n missing=\"data\"\n title=\"No Kubernetes resources\"\n description={`No resources on any known clusters for ${entity.metadata.name}`}\n />\n </Grid>\n </Grid>\n )}\n {kubernetesObjects?.items.length > 0 &&\n kubernetesObjects?.items.map((item, i) => {\n const podsWithErrors = new Set<string>(\n detectedErrors\n .get(item.cluster.name)\n ?.filter(de => de.sourceRef.kind === 'Pod')\n .map(de => de.sourceRef.name),\n );\n\n return (\n <Grid item key={i} xs={12}>\n <Cluster\n clusterObjects={item}\n podsWithErrors={podsWithErrors}\n />\n </Grid>\n );\n })}\n </Grid>\n </Grid>\n )}\n </Content>\n </Page>\n </DetectedErrorsContext.Provider>\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 {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { Route, Routes } from 'react-router-dom';\nimport { KubernetesContent } from './KubernetesContent';\nimport Button from '@material-ui/core/Button';\n\nconst KUBERNETES_ANNOTATION = 'backstage.io/kubernetes-id';\nconst KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION =\n 'backstage.io/kubernetes-label-selector';\n\nexport const isKubernetesAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[KUBERNETES_ANNOTATION]) ||\n Boolean(\n entity.metadata.annotations?.[KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION],\n );\n\nexport const Router = (props: { refreshIntervalMs?: number }) => {\n const { entity } = useEntity();\n\n const kubernetesAnnotationValue =\n entity.metadata.annotations?.[KUBERNETES_ANNOTATION];\n\n const kubernetesLabelSelectorQueryAnnotationValue =\n entity.metadata.annotations?.[KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION];\n\n if (\n kubernetesAnnotationValue ||\n kubernetesLabelSelectorQueryAnnotationValue\n ) {\n return (\n <Routes>\n <Route\n path=\"/\"\n element={\n <KubernetesContent\n entity={entity}\n refreshIntervalMs={props.refreshIntervalMs}\n />\n }\n />\n </Routes>\n );\n }\n\n return (\n <>\n <MissingAnnotationEmptyState annotation={KUBERNETES_ANNOTATION} />\n <h1>\n Or use a label selector query, which takes precedence over the previous\n annotation.\n </h1>\n <Button\n variant=\"contained\"\n color=\"primary\"\n href=\"https://backstage.io/docs/features/kubernetes/configuration#surfacing-your-kubernetes-components-as-part-of-an-entity\"\n >\n Read Kubernetes Plugin Docs\n </Button>\n </>\n );\n};\n"],"names":["_a"],"mappings":";;;;;;;;;;;;AAyCO,MAAM,gCAAgC,cAAe,CAAA;AAAA,EAC1D,EAAI,EAAA,YAAA;AACN,CAAC,CAAA,CAAA;AAEM,MAAM,mBAAmB,YAAa,CAAA;AAAA,EAC3C,EAAI,EAAA,YAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,gBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,WAAa,EAAA,cAAA;AAAA,QACb,0BAA4B,EAAA,6BAAA;AAAA,OAC9B;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,aAAa,0BAA2B,EAAA,KAChE,IAAI,uBAAwB,CAAA;AAAA,QAC1B,YAAA;AAAA,QACA,WAAA;AAAA,QACA,0BAAA;AAAA,OACD,CAAA;AAAA,KACJ,CAAA;AAAA,IACD,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,qBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,aAAe,EAAA,gBAAA;AAAA,OACjB;AAAA,MACA,SAAS,CAAC,EAAE,aAAc,EAAA,KACxB,IAAI,qBAAsB,CAAA;AAAA,QACxB,aAAA;AAAA,OACD,CAAA;AAAA,KACJ,CAAA;AAAA,IACD,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,6BAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,aAAe,EAAA,gBAAA;AAAA,QACf,aAAe,EAAA,gBAAA;AAAA,QACf,gBAAkB,EAAA,mBAAA;AAAA,QAClB,WAAa,EAAA,cA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AAAA,SAC3B;AAAA,OAAA;AAAA,KAGN,CAAA,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,sCACG,2BAA4B,EAAA,EAAA,UAAA,EAAY,uBAAuB,CAChE,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAG,EAAA,IAAA,EAAA,qFAGJ,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,WAAA;AAAA,MACR,KAAM,EAAA,SAAA;AAAA,MACN,IAAK,EAAA,uHAAA;AAAA,KAAA;AAAA,IACN,6BAAA;AAAA,GAGH,CAAA,CAAA;AAEJ;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { kubernetesApiRef, kubernetesAuthProvidersApiRef, KubernetesBackendClient, kubernetesProxyApiRef, KubernetesProxyClient, KubernetesAuthProviders, kubernetesClusterLinkFormatterApiRef, getDefaultFormatters, KubernetesClusterLinkFormatter, DEFAULT_FORMATTER_NAME } from '@backstage/plugin-kubernetes-react';
|
|
2
|
+
import { createRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, gitlabAuthApiRef, googleAuthApiRef, microsoftAuthApiRef, oktaAuthApiRef, oneloginAuthApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
|
|
3
|
+
|
|
4
|
+
const rootCatalogKubernetesRouteRef = createRouteRef({
|
|
5
|
+
id: "kubernetes"
|
|
6
|
+
});
|
|
7
|
+
const kubernetesPlugin = createPlugin({
|
|
8
|
+
id: "kubernetes",
|
|
9
|
+
apis: [
|
|
10
|
+
createApiFactory({
|
|
11
|
+
api: kubernetesApiRef,
|
|
12
|
+
deps: {
|
|
13
|
+
discoveryApi: discoveryApiRef,
|
|
14
|
+
identityApi: identityApiRef,
|
|
15
|
+
kubernetesAuthProvidersApi: kubernetesAuthProvidersApiRef
|
|
16
|
+
},
|
|
17
|
+
factory: ({ discoveryApi, identityApi, kubernetesAuthProvidersApi }) => new KubernetesBackendClient({
|
|
18
|
+
discoveryApi,
|
|
19
|
+
identityApi,
|
|
20
|
+
kubernetesAuthProvidersApi
|
|
21
|
+
})
|
|
22
|
+
}),
|
|
23
|
+
createApiFactory({
|
|
24
|
+
api: kubernetesProxyApiRef,
|
|
25
|
+
deps: {
|
|
26
|
+
kubernetesApi: kubernetesApiRef
|
|
27
|
+
},
|
|
28
|
+
factory: ({ kubernetesApi }) => new KubernetesProxyClient({
|
|
29
|
+
kubernetesApi
|
|
30
|
+
})
|
|
31
|
+
}),
|
|
32
|
+
createApiFactory({
|
|
33
|
+
api: kubernetesAuthProvidersApiRef,
|
|
34
|
+
deps: {
|
|
35
|
+
gitlabAuthApi: gitlabAuthApiRef,
|
|
36
|
+
googleAuthApi: googleAuthApiRef,
|
|
37
|
+
microsoftAuthApi: microsoftAuthApiRef,
|
|
38
|
+
oktaAuthApi: oktaAuthApiRef,
|
|
39
|
+
oneloginAuthApi: oneloginAuthApiRef
|
|
40
|
+
},
|
|
41
|
+
factory: ({
|
|
42
|
+
gitlabAuthApi,
|
|
43
|
+
googleAuthApi,
|
|
44
|
+
microsoftAuthApi,
|
|
45
|
+
oktaAuthApi,
|
|
46
|
+
oneloginAuthApi
|
|
47
|
+
}) => {
|
|
48
|
+
const oidcProviders = {
|
|
49
|
+
gitlab: gitlabAuthApi,
|
|
50
|
+
google: googleAuthApi,
|
|
51
|
+
microsoft: microsoftAuthApi,
|
|
52
|
+
okta: oktaAuthApi,
|
|
53
|
+
onelogin: oneloginAuthApi
|
|
54
|
+
};
|
|
55
|
+
return new KubernetesAuthProviders({
|
|
56
|
+
microsoftAuthApi,
|
|
57
|
+
googleAuthApi,
|
|
58
|
+
oidcProviders
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
createApiFactory({
|
|
63
|
+
api: kubernetesClusterLinkFormatterApiRef,
|
|
64
|
+
deps: { googleAuthApi: googleAuthApiRef },
|
|
65
|
+
factory: (deps) => {
|
|
66
|
+
const formatters = getDefaultFormatters(deps);
|
|
67
|
+
return new KubernetesClusterLinkFormatter({
|
|
68
|
+
formatters,
|
|
69
|
+
defaultFormatterName: DEFAULT_FORMATTER_NAME
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
],
|
|
74
|
+
routes: {
|
|
75
|
+
entityContent: rootCatalogKubernetesRouteRef
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const EntityKubernetesContent = kubernetesPlugin.provide(
|
|
79
|
+
createRoutableExtension({
|
|
80
|
+
name: "EntityKubernetesContent",
|
|
81
|
+
component: () => import('./Router.esm.js').then((m) => m.Router),
|
|
82
|
+
mountPoint: rootCatalogKubernetesRouteRef
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
export { EntityKubernetesContent, kubernetesPlugin, rootCatalogKubernetesRouteRef };
|
|
87
|
+
//# sourceMappingURL=plugin.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 KubernetesBackendClient,\n kubernetesApiRef,\n kubernetesProxyApiRef,\n kubernetesAuthProvidersApiRef,\n KubernetesAuthProviders,\n KubernetesProxyClient,\n kubernetesClusterLinkFormatterApiRef,\n getDefaultFormatters,\n KubernetesClusterLinkFormatter,\n DEFAULT_FORMATTER_NAME,\n} from '@backstage/plugin-kubernetes-react';\nimport {\n createApiFactory,\n createPlugin,\n createRouteRef,\n discoveryApiRef,\n identityApiRef,\n gitlabAuthApiRef,\n googleAuthApiRef,\n microsoftAuthApiRef,\n oktaAuthApiRef,\n oneloginAuthApiRef,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\n\nexport const rootCatalogKubernetesRouteRef = createRouteRef({\n id: 'kubernetes',\n});\n\nexport const kubernetesPlugin = createPlugin({\n id: 'kubernetes',\n apis: [\n createApiFactory({\n api: kubernetesApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n identityApi: identityApiRef,\n kubernetesAuthProvidersApi: kubernetesAuthProvidersApiRef,\n },\n factory: ({ discoveryApi, identityApi, kubernetesAuthProvidersApi }) =>\n new KubernetesBackendClient({\n discoveryApi,\n identityApi,\n kubernetesAuthProvidersApi,\n }),\n }),\n createApiFactory({\n api: kubernetesProxyApiRef,\n deps: {\n kubernetesApi: kubernetesApiRef,\n },\n factory: ({ kubernetesApi }) =>\n new KubernetesProxyClient({\n kubernetesApi,\n }),\n }),\n createApiFactory({\n api: kubernetesAuthProvidersApiRef,\n deps: {\n gitlabAuthApi: gitlabAuthApiRef,\n googleAuthApi: googleAuthApiRef,\n microsoftAuthApi: microsoftAuthApiRef,\n oktaAuthApi: oktaAuthApiRef,\n oneloginAuthApi: oneloginAuthApiRef,\n },\n factory: ({\n gitlabAuthApi,\n googleAuthApi,\n microsoftAuthApi,\n oktaAuthApi,\n oneloginAuthApi,\n }) => {\n const oidcProviders = {\n gitlab: gitlabAuthApi,\n google: googleAuthApi,\n microsoft: microsoftAuthApi,\n okta: oktaAuthApi,\n onelogin: oneloginAuthApi,\n };\n\n return new KubernetesAuthProviders({\n microsoftAuthApi,\n googleAuthApi,\n oidcProviders,\n });\n },\n }),\n createApiFactory({\n api: kubernetesClusterLinkFormatterApiRef,\n deps: { googleAuthApi: googleAuthApiRef },\n factory: deps => {\n const formatters = getDefaultFormatters(deps);\n return new KubernetesClusterLinkFormatter({\n formatters,\n defaultFormatterName: DEFAULT_FORMATTER_NAME,\n });\n },\n }),\n ],\n routes: {\n entityContent: rootCatalogKubernetesRouteRef,\n },\n});\n\n/**\n * Props of EntityKubernetesContent\n *\n * @public\n */\nexport type EntityKubernetesContentProps = {\n /**\n * Sets the refresh interval in milliseconds. The default value is 10000 (10 seconds)\n */\n refreshIntervalMs?: number;\n};\n\nexport const EntityKubernetesContent: (\n props: EntityKubernetesContentProps,\n) => JSX.Element = kubernetesPlugin.provide(\n createRoutableExtension({\n name: 'EntityKubernetesContent',\n component: () => import('./Router').then(m => m.Router),\n mountPoint: rootCatalogKubernetesRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;AAyCO,MAAM,gCAAgC,cAAe,CAAA;AAAA,EAC1D,EAAI,EAAA,YAAA;AACN,CAAC,EAAA;AAEM,MAAM,mBAAmB,YAAa,CAAA;AAAA,EAC3C,EAAI,EAAA,YAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,gBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,WAAa,EAAA,cAAA;AAAA,QACb,0BAA4B,EAAA,6BAAA;AAAA,OAC9B;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,aAAa,0BAA2B,EAAA,KAChE,IAAI,uBAAwB,CAAA;AAAA,QAC1B,YAAA;AAAA,QACA,WAAA;AAAA,QACA,0BAAA;AAAA,OACD,CAAA;AAAA,KACJ,CAAA;AAAA,IACD,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,qBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,aAAe,EAAA,gBAAA;AAAA,OACjB;AAAA,MACA,SAAS,CAAC,EAAE,aAAc,EAAA,KACxB,IAAI,qBAAsB,CAAA;AAAA,QACxB,aAAA;AAAA,OACD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wB,CAAA;AAAA,IACtB,IAAM,EAAA,yBAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,iBAAU,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,MAAM,CAAA;AAAA,IACtD,UAAY,EAAA,6BAAA;AAAA,GACb,CAAA;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-kubernetes",
|
|
3
3
|
"description": "A Backstage plugin that integrates towards Kubernetes",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.10-next.1",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"clean": "backstage-cli package clean"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@backstage/catalog-model": "^1.
|
|
38
|
-
"@backstage/core-components": "^0.14.
|
|
37
|
+
"@backstage/catalog-model": "^1.5.0-next.0",
|
|
38
|
+
"@backstage/core-components": "^0.14.6-next.1",
|
|
39
39
|
"@backstage/core-plugin-api": "^1.9.2",
|
|
40
|
-
"@backstage/plugin-catalog-react": "^1.11.
|
|
41
|
-
"@backstage/plugin-kubernetes-common": "^0.7.
|
|
42
|
-
"@backstage/plugin-kubernetes-react": "^0.3.
|
|
40
|
+
"@backstage/plugin-catalog-react": "^1.11.4-next.1",
|
|
41
|
+
"@backstage/plugin-kubernetes-common": "^0.7.6-next.0",
|
|
42
|
+
"@backstage/plugin-kubernetes-react": "^0.3.5-next.1",
|
|
43
43
|
"@kubernetes-models/apimachinery": "^1.1.0",
|
|
44
44
|
"@kubernetes-models/base": "^4.0.1",
|
|
45
45
|
"@kubernetes/client-node": "0.20.0",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@backstage/cli": "^0.26.
|
|
64
|
-
"@backstage/dev-utils": "^1.0.
|
|
65
|
-
"@backstage/test-utils": "^1.5.
|
|
63
|
+
"@backstage/cli": "^0.26.5-next.0",
|
|
64
|
+
"@backstage/dev-utils": "^1.0.32-next.1",
|
|
65
|
+
"@backstage/test-utils": "^1.5.5-next.0",
|
|
66
66
|
"@testing-library/dom": "^10.0.0",
|
|
67
67
|
"@testing-library/jest-dom": "^6.0.0",
|
|
68
68
|
"@testing-library/react": "^15.0.0"
|