@backstage/plugin-kubernetes-react 0.3.6-next.0 → 0.4.0-next.2
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 +24 -0
- package/dist/api/KubernetesBackendClient.esm.js +7 -20
- package/dist/api/KubernetesBackendClient.esm.js.map +1 -1
- package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js +8 -2
- package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js.map +1 -1
- package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js +8 -2
- package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js.map +1 -1
- package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js +10 -3
- package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js.map +1 -1
- package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js +8 -2
- package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/utils/owner.esm.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @backstage/plugin-kubernetes-react
|
|
2
2
|
|
|
3
|
+
## 0.4.0-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/core-components@0.14.8-next.1
|
|
9
|
+
- @backstage/core-plugin-api@1.9.3-next.0
|
|
10
|
+
- @backstage/catalog-model@1.5.0
|
|
11
|
+
- @backstage/errors@1.2.4
|
|
12
|
+
- @backstage/types@1.1.1
|
|
13
|
+
- @backstage/plugin-kubernetes-common@0.8.0-next.0
|
|
14
|
+
|
|
15
|
+
## 0.4.0-next.1
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 4f92394: Migrate from identityApi to fetchApi in frontend plugins.
|
|
20
|
+
- 0177f75: Update kubernetes plugins to use autoscaling/v2
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
- @backstage/plugin-kubernetes-common@0.8.0-next.0
|
|
26
|
+
|
|
3
27
|
## 0.3.6-next.0
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -3,11 +3,11 @@ import { NotFoundError } from '@backstage/errors';
|
|
|
3
3
|
|
|
4
4
|
class KubernetesBackendClient {
|
|
5
5
|
discoveryApi;
|
|
6
|
-
|
|
6
|
+
fetchApi;
|
|
7
7
|
kubernetesAuthProvidersApi;
|
|
8
8
|
constructor(options) {
|
|
9
9
|
this.discoveryApi = options.discoveryApi;
|
|
10
|
-
this.
|
|
10
|
+
this.fetchApi = options.fetchApi;
|
|
11
11
|
this.kubernetesAuthProvidersApi = options.kubernetesAuthProvidersApi;
|
|
12
12
|
}
|
|
13
13
|
async handleResponse(response) {
|
|
@@ -27,12 +27,10 @@ class KubernetesBackendClient {
|
|
|
27
27
|
}
|
|
28
28
|
async postRequired(path, requestBody) {
|
|
29
29
|
const url = `${await this.discoveryApi.getBaseUrl("kubernetes")}${path}`;
|
|
30
|
-
const
|
|
31
|
-
const response = await fetch(url, {
|
|
30
|
+
const response = await this.fetchApi.fetch(url, {
|
|
32
31
|
method: "POST",
|
|
33
32
|
headers: {
|
|
34
|
-
"Content-Type": "application/json"
|
|
35
|
-
...idToken && { Authorization: `Bearer ${idToken}` }
|
|
33
|
+
"Content-Type": "application/json"
|
|
36
34
|
},
|
|
37
35
|
body: JSON.stringify(requestBody)
|
|
38
36
|
});
|
|
@@ -72,14 +70,8 @@ class KubernetesBackendClient {
|
|
|
72
70
|
});
|
|
73
71
|
}
|
|
74
72
|
async getClusters() {
|
|
75
|
-
const { token: idToken } = await this.identityApi.getCredentials();
|
|
76
73
|
const url = `${await this.discoveryApi.getBaseUrl("kubernetes")}/clusters`;
|
|
77
|
-
const response = await fetch(url
|
|
78
|
-
method: "GET",
|
|
79
|
-
headers: {
|
|
80
|
-
...idToken && { Authorization: `Bearer ${idToken}` }
|
|
81
|
-
}
|
|
82
|
-
});
|
|
74
|
+
const response = await this.fetchApi.fetch(url);
|
|
83
75
|
return (await this.handleResponse(response)).items;
|
|
84
76
|
}
|
|
85
77
|
async proxy(options) {
|
|
@@ -91,17 +83,15 @@ class KubernetesBackendClient {
|
|
|
91
83
|
oidcTokenProvider
|
|
92
84
|
);
|
|
93
85
|
const url = `${await this.discoveryApi.getBaseUrl("kubernetes")}/proxy${options.path}`;
|
|
94
|
-
const identityResponse = await this.identityApi.getCredentials();
|
|
95
86
|
const headers = KubernetesBackendClient.getKubernetesHeaders(
|
|
96
87
|
options,
|
|
97
88
|
kubernetesCredentials?.token,
|
|
98
|
-
identityResponse,
|
|
99
89
|
authProvider,
|
|
100
90
|
oidcTokenProvider
|
|
101
91
|
);
|
|
102
|
-
return await fetch(url, { ...options.init, headers });
|
|
92
|
+
return await this.fetchApi.fetch(url, { ...options.init, headers });
|
|
103
93
|
}
|
|
104
|
-
static getKubernetesHeaders(options, k8sToken,
|
|
94
|
+
static getKubernetesHeaders(options, k8sToken, authProvider, oidcTokenProvider) {
|
|
105
95
|
const kubernetesAuthHeader = KubernetesBackendClient.getKubernetesAuthHeaderByAuthProvider(
|
|
106
96
|
authProvider,
|
|
107
97
|
oidcTokenProvider
|
|
@@ -111,9 +101,6 @@ class KubernetesBackendClient {
|
|
|
111
101
|
[`Backstage-Kubernetes-Cluster`]: options.clusterName,
|
|
112
102
|
...k8sToken && {
|
|
113
103
|
[kubernetesAuthHeader]: k8sToken
|
|
114
|
-
},
|
|
115
|
-
...identityResponse.token && {
|
|
116
|
-
Authorization: `Bearer ${identityResponse.token}`
|
|
117
104
|
}
|
|
118
105
|
};
|
|
119
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KubernetesBackendClient.esm.js","sources":["../../src/api/KubernetesBackendClient.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 */\n\nimport { KubernetesApi } from './types';\nimport {\n KubernetesRequestBody,\n ObjectsByEntityResponse,\n WorkloadsByEntityRequest,\n CustomObjectsByEntityRequest,\n} from '@backstage/plugin-kubernetes-common';\nimport { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { KubernetesAuthProvidersApi } from '../kubernetes-auth-provider';\nimport { NotFoundError } from '@backstage/errors';\n\n/** @public */\nexport class KubernetesBackendClient implements KubernetesApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly identityApi: IdentityApi;\n private readonly kubernetesAuthProvidersApi: KubernetesAuthProvidersApi;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n kubernetesAuthProvidersApi: KubernetesAuthProvidersApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.identityApi = options.identityApi;\n this.kubernetesAuthProvidersApi = options.kubernetesAuthProvidersApi;\n }\n\n private async handleResponse(response: Response): Promise<any> {\n if (!response.ok) {\n const payload = await response.text();\n let message;\n switch (response.status) {\n case 404:\n message =\n 'Could not find the Kubernetes Backend (HTTP 404). Make sure the plugin has been fully installed.';\n break;\n default:\n message = `Request failed with ${response.status} ${response.statusText}, ${payload}`;\n }\n throw new Error(message);\n }\n\n return await response.json();\n }\n\n private async postRequired(path: string, requestBody: any): Promise<any> {\n const url = `${await this.discoveryApi.getBaseUrl('kubernetes')}${path}`;\n const { token: idToken } = await this.identityApi.getCredentials();\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(idToken && { Authorization: `Bearer ${idToken}` }),\n },\n body: JSON.stringify(requestBody),\n });\n\n return this.handleResponse(response);\n }\n\n public async getCluster(clusterName: string): Promise<{\n name: string;\n authProvider: string;\n oidcTokenProvider?: string;\n }> {\n const cluster = await this.getClusters().then(clusters =>\n clusters.find(c => c.name === clusterName),\n );\n if (!cluster) {\n throw new NotFoundError(`Cluster ${clusterName} not found`);\n }\n\n return cluster;\n }\n\n private async getCredentials(\n authProvider: string,\n oidcTokenProvider?: string,\n ): Promise<{ token?: string }> {\n return await this.kubernetesAuthProvidersApi.getCredentials(\n authProvider === 'oidc'\n ? `${authProvider}.${oidcTokenProvider}`\n : authProvider,\n );\n }\n\n async getObjectsByEntity(\n requestBody: KubernetesRequestBody,\n ): Promise<ObjectsByEntityResponse> {\n return await this.postRequired(\n `/services/${requestBody.entity.metadata.name}`,\n requestBody,\n );\n }\n\n async getWorkloadsByEntity(\n request: WorkloadsByEntityRequest,\n ): Promise<ObjectsByEntityResponse> {\n return await this.postRequired('/resources/workloads/query', {\n auth: request.auth,\n entityRef: stringifyEntityRef(request.entity),\n });\n }\n\n async getCustomObjectsByEntity(\n request: CustomObjectsByEntityRequest,\n ): Promise<ObjectsByEntityResponse> {\n return await this.postRequired(`/resources/custom/query`, {\n entityRef: stringifyEntityRef(request.entity),\n auth: request.auth,\n customResources: request.customResources,\n });\n }\n\n async getClusters(): Promise<{ name: string; authProvider: string }[]> {\n const { token: idToken } = await this.identityApi.getCredentials();\n const url = `${await this.discoveryApi.getBaseUrl('kubernetes')}/clusters`;\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n ...(idToken && { Authorization: `Bearer ${idToken}` }),\n },\n });\n\n return (await this.handleResponse(response)).items;\n }\n\n async proxy(options: {\n clusterName: string;\n path: string;\n init?: RequestInit;\n }): Promise<Response> {\n const { authProvider, oidcTokenProvider } = await this.getCluster(\n options.clusterName,\n );\n const kubernetesCredentials = await this.getCredentials(\n authProvider,\n oidcTokenProvider,\n );\n const url = `${await this.discoveryApi.getBaseUrl('kubernetes')}/proxy${\n options.path\n }`;\n const identityResponse = await this.identityApi.getCredentials();\n const headers = KubernetesBackendClient.getKubernetesHeaders(\n options,\n kubernetesCredentials?.token,\n identityResponse,\n authProvider,\n oidcTokenProvider,\n );\n return await fetch(url, { ...options.init, headers });\n }\n\n private static getKubernetesHeaders(\n options: {\n clusterName: string;\n path: string;\n init?: RequestInit;\n },\n k8sToken: string | undefined,\n identityResponse: { token?: string },\n authProvider: string,\n oidcTokenProvider: string | undefined,\n ) {\n const kubernetesAuthHeader =\n KubernetesBackendClient.getKubernetesAuthHeaderByAuthProvider(\n authProvider,\n oidcTokenProvider,\n );\n return {\n ...options.init?.headers,\n [`Backstage-Kubernetes-Cluster`]: options.clusterName,\n ...(k8sToken && {\n [kubernetesAuthHeader]: k8sToken,\n }),\n ...(identityResponse.token && {\n Authorization: `Bearer ${identityResponse.token}`,\n }),\n };\n }\n\n private static getKubernetesAuthHeaderByAuthProvider(\n authProvider: string,\n oidcTokenProvider: string | undefined,\n ): string {\n let header: string = 'Backstage-Kubernetes-Authorization';\n\n header = header.concat('-', authProvider);\n\n if (oidcTokenProvider) header = header.concat('-', oidcTokenProvider);\n\n return header;\n }\n}\n"],"names":[],"mappings":";;;AA6BO,MAAM,uBAAiD,CAAA;AAAA,EAC3C,YAAA,CAAA;AAAA,EACA,WAAA,CAAA;AAAA,EACA,0BAAA,CAAA;AAAA,EAEjB,YAAY,OAIT,EAAA;AACD,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,cAAc,OAAQ,CAAA,WAAA,CAAA;AAC3B,IAAA,IAAA,CAAK,6BAA6B,OAAQ,CAAA,0BAAA,CAAA;AAAA,GAC5C;AAAA,EAEA,MAAc,eAAe,QAAkC,EAAA;AAC7D,IAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,M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A,KACF,CAAA;AACA,IAAO,OAAA,MAAM,MAAM,GAAK,EAAA,EAAE,GAAG,OAAQ,CAAA,IAAA,EAAM,SAAS,CAAA,CAAA;AAAA,GACtD;AAAA,EAEA,OAAe,oBACb,CAAA,OAAA,EAKA,QACA,EAAA,gBAAA,EACA,cACA,iBACA,EAAA;AACA,IAAA,MAAM,uBACJ,uBAAwB,CAAA,qCAAA;AAAA,MACtB,YAAA;AAAA,MACA,iBAAA;AAAA,KACF,CAAA;AACF,IAAO,OAAA;AAAA,MACL,GAAG,QAAQ,IAAM,EAAA,OAAA;AAAA,MACjB,CAAC,CAA8B,4BAAA,CAAA,GAAG,OAAQ,CAAA,WAAA;AAAA,MAC1C,GAAI,QAAY,IAAA;AAAA,QACd,CAAC,oBAAoB,GAAG,QAAA;AAAA,OAC1B;AAAA,MACA,GAAI,iBAAiB,KAAS,IAAA;AAAA,QAC5B,aAAA,EAAe,CAAU,OAAA,EAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAAA,OACjD;AAAA,KACF,CAAA;AAAA,GACF;AAAA,EAEA,OAAe,qCACb,CAAA,YAAA,EACA,iBACQ,EAAA;AACR,IAAA,IAAI,MAAiB,GAAA,oCAAA,CAAA;AAErB,IAAS,MAAA,GAAA,MAAA,CAAO,MAAO,CAAA,GAAA,EAAK,YAAY,CAAA,CAAA;AAExC,IAAI,IAAA,iBAAA;AAAmB,MAAS,MAAA,GAAA,MAAA,CAAO,MAAO,CAAA,GAAA,EAAK,iBAAiB,CAAA,CAAA;AAEpE,IAAO,OAAA,MAAA,CAAA;AAAA,GACT;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"KubernetesBackendClient.esm.js","sources":["../../src/api/KubernetesBackendClient.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 */\n\nimport { KubernetesApi } from './types';\nimport {\n KubernetesRequestBody,\n ObjectsByEntityResponse,\n WorkloadsByEntityRequest,\n CustomObjectsByEntityRequest,\n} from '@backstage/plugin-kubernetes-common';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { KubernetesAuthProvidersApi } from '../kubernetes-auth-provider';\nimport { NotFoundError } from '@backstage/errors';\n\n/** @public */\nexport class KubernetesBackendClient implements KubernetesApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n private readonly kubernetesAuthProvidersApi: KubernetesAuthProvidersApi;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n kubernetesAuthProvidersApi: KubernetesAuthProvidersApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n this.kubernetesAuthProvidersApi = options.kubernetesAuthProvidersApi;\n }\n\n private async handleResponse(response: Response): Promise<any> {\n if (!response.ok) {\n const payload = await response.text();\n let message;\n switch (response.status) {\n case 404:\n message =\n 'Could not find the Kubernetes Backend (HTTP 404). Make sure the plugin has been fully installed.';\n break;\n default:\n message = `Request failed with ${response.status} ${response.statusText}, ${payload}`;\n }\n throw new Error(message);\n }\n\n return await response.json();\n }\n\n private async postRequired(path: string, requestBody: any): Promise<any> {\n const url = `${await this.discoveryApi.getBaseUrl('kubernetes')}${path}`;\n const response = await this.fetchApi.fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(requestBody),\n });\n\n return this.handleResponse(response);\n }\n\n public async getCluster(clusterName: string): Promise<{\n name: string;\n authProvider: string;\n oidcTokenProvider?: string;\n }> {\n const cluster = await this.getClusters().then(clusters =>\n clusters.find(c => c.name === clusterName),\n );\n if (!cluster) {\n throw new NotFoundError(`Cluster ${clusterName} not found`);\n }\n\n return cluster;\n }\n\n private async getCredentials(\n authProvider: string,\n oidcTokenProvider?: string,\n ): Promise<{ token?: string }> {\n return await this.kubernetesAuthProvidersApi.getCredentials(\n authProvider === 'oidc'\n ? `${authProvider}.${oidcTokenProvider}`\n : authProvider,\n );\n }\n\n async getObjectsByEntity(\n requestBody: KubernetesRequestBody,\n ): Promise<ObjectsByEntityResponse> {\n return await this.postRequired(\n `/services/${requestBody.entity.metadata.name}`,\n requestBody,\n );\n }\n\n async getWorkloadsByEntity(\n request: WorkloadsByEntityRequest,\n ): Promise<ObjectsByEntityResponse> {\n return await this.postRequired('/resources/workloads/query', {\n auth: request.auth,\n entityRef: stringifyEntityRef(request.entity),\n });\n }\n\n async getCustomObjectsByEntity(\n request: CustomObjectsByEntityRequest,\n ): Promise<ObjectsByEntityResponse> {\n return await this.postRequired(`/resources/custom/query`, {\n entityRef: stringifyEntityRef(request.entity),\n auth: request.auth,\n customResources: request.customResources,\n });\n }\n\n async getClusters(): Promise<{ name: string; authProvider: string }[]> {\n const url = `${await this.discoveryApi.getBaseUrl('kubernetes')}/clusters`;\n const response = await this.fetchApi.fetch(url);\n\n return (await this.handleResponse(response)).items;\n }\n\n async proxy(options: {\n clusterName: string;\n path: string;\n init?: RequestInit;\n }): Promise<Response> {\n const { authProvider, oidcTokenProvider } = await this.getCluster(\n options.clusterName,\n );\n const kubernetesCredentials = await this.getCredentials(\n authProvider,\n oidcTokenProvider,\n );\n const url = `${await this.discoveryApi.getBaseUrl('kubernetes')}/proxy${\n options.path\n }`;\n const headers = KubernetesBackendClient.getKubernetesHeaders(\n options,\n kubernetesCredentials?.token,\n authProvider,\n oidcTokenProvider,\n );\n return await this.fetchApi.fetch(url, { ...options.init, headers });\n }\n\n private static getKubernetesHeaders(\n options: {\n clusterName: string;\n path: string;\n init?: RequestInit;\n },\n k8sToken: string | undefined,\n authProvider: string,\n oidcTokenProvider: string | undefined,\n ) {\n const kubernetesAuthHeader =\n KubernetesBackendClient.getKubernetesAuthHeaderByAuthProvider(\n authProvider,\n oidcTokenProvider,\n );\n return {\n ...options.init?.headers,\n [`Backstage-Kubernetes-Cluster`]: options.clusterName,\n ...(k8sToken && {\n [kubernetesAuthHeader]: k8sToken,\n }),\n };\n }\n\n private static getKubernetesAuthHeaderByAuthProvider(\n authProvider: string,\n oidcTokenProvider: string | undefined,\n ): string {\n let header: string = 'Backstage-Kubernetes-Authorization';\n\n header = header.concat('-', authProvider);\n\n if (oidcTokenProvider) header = header.concat('-', oidcTokenProvider);\n\n return header;\n }\n}\n"],"names":[],"mappings":";;;AA6BO,MAAM,uBAAiD,CAAA;AAAA,EAC3C,YAAA,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EACA,0BAAA,CAAA;AAAA,EAEjB,YAAY,OAIT,EAAA;AACD,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAQ,CAAA,QAAA,CAAA;AACxB,IAAA,IAAA,CAAK,6BAA6B,OAAQ,CAAA,0BAAA,CAAA;AAAA,GAC5C;AAAA,EAEA,MAAc,eAAe,QAAkC,EAAA;AAC7D,IAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,MAAM,MAAA,OAAA,GAAU,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AACpC,MAAI,IAAA,OAAA,CAAA;AACJ,MAAA,QAAQ,SAAS,MAAQ;AAAA,QACvB,KAAK,GAAA;AACH,UACE,OAAA,GAAA,kGAAA,CAAA;AACF,UAAA,MAAA;AAAA,QACF;AACE,UAAA,OAAA,GAAU,uBAAuB,QAAS,CAAA,MAAM,IAAI,QAAS,CAAA,UAAU,KAAK,OAAO,CAAA,CAAA,CAAA;AAAA,OACvF;AACA,MAAM,MAAA,IAAI,MAAM,OAAO,CAAA,CAAA;AAAA,KACzB;AAEA,IAAO,OAAA,MA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,6 +74,12 @@ const RolloutSummary = ({
|
|
|
74
74
|
(p) => p.reason === "CanaryPauseStep"
|
|
75
75
|
)?.startTime;
|
|
76
76
|
const abortedMessage = findAbortedMessage(rollout);
|
|
77
|
+
const specCpuUtil = hpa?.spec?.metrics?.find(
|
|
78
|
+
(metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
|
|
79
|
+
)?.resource?.target.averageUtilization;
|
|
80
|
+
const cpuUtil = hpa?.status?.currentMetrics?.find(
|
|
81
|
+
(metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
|
|
82
|
+
)?.resource?.current.averageUtilization;
|
|
77
83
|
return /* @__PURE__ */ React__default.createElement(
|
|
78
84
|
Grid,
|
|
79
85
|
{
|
|
@@ -95,8 +101,8 @@ const RolloutSummary = ({
|
|
|
95
101
|
spacing: 0
|
|
96
102
|
},
|
|
97
103
|
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "min replicas ", hpa.spec?.minReplicas ?? "?", " / max replicas", " ", hpa.spec?.maxReplicas ?? "?")),
|
|
98
|
-
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "current CPU usage:
|
|
99
|
-
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "target CPU usage:
|
|
104
|
+
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "current CPU usage: ", cpuUtil ?? "?", "%")),
|
|
105
|
+
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "target CPU usage: ", specCpuUtil ?? "?", "%"))
|
|
100
106
|
))),
|
|
101
107
|
/* @__PURE__ */ React__default.createElement(
|
|
102
108
|
Grid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rollout.esm.js","sources":["../../../../src/components/CustomResources/ArgoRollouts/Rollout.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, { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { V1Pod, V1HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { PodsTable } from '../../Pods';\nimport { HorizontalPodAutoscalerDrawer } from '../../HorizontalPodAutoscalers';\nimport { RolloutDrawer } from './RolloutDrawer';\nimport PauseIcon from '@material-ui/icons/Pause';\nimport ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';\nimport { DateTime } from 'luxon';\nimport { StepsProgress } from './StepsProgress';\nimport {\n PodNamesWithErrorsContext,\n GroupedResponsesContext,\n} from '../../../hooks';\nimport {\n getMatchingHpa,\n getOwnedPodsThroughReplicaSets,\n} from '../../../utils/owner';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../../Pods/PodsTable';\n\ntype RolloutAccordionsProps = {\n rollouts: any[];\n defaultExpanded?: boolean;\n children?: React.ReactNode;\n};\n\ntype RolloutAccordionProps = {\n rollout: any;\n ownedPods: V1Pod[];\n defaultExpanded?: boolean;\n matchingHpa?: V1HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\ntype RolloutSummaryProps = {\n rollout: any;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V1HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\nconst AbortedTitle = (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <ErrorOutlineIcon />\n <Typography variant=\"subtitle1\">Aborted</Typography>\n </div>\n);\n\nconst findAbortedMessage = (rollout: any): string | undefined =>\n rollout.status?.conditions?.find(\n (c: any) =>\n c.type === 'Progressing' &&\n c.status === 'False' &&\n c.reason === 'RolloutAborted',\n )?.message;\n\nconst RolloutSummary = ({\n rollout,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: RolloutSummaryProps) => {\n const pauseTime: string | undefined = rollout.status?.pauseConditions?.find(\n (p: any) => p.reason === 'CanaryPauseStep',\n )?.startTime;\n const abortedMessage = findAbortedMessage(rollout);\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <RolloutDrawer rollout={rollout} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage:{' '}\n {hpa.status?.currentCPUUtilizationPercentage ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage:{' '}\n {hpa.spec?.targetCPUUtilizationPercentage ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n {pauseTime && (\n <Grid item xs={3}>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <PauseIcon />\n <Typography variant=\"subtitle1\">\n Paused ({DateTime.fromISO(pauseTime).toRelative({ locale: 'en' })}\n )\n </Typography>\n </div>\n </Grid>\n )}\n {abortedMessage && (\n <Grid item xs={3}>\n {AbortedTitle}\n </Grid>\n )}\n </Grid>\n );\n};\n\nconst RolloutAccordion = ({\n rollout,\n ownedPods,\n matchingHpa,\n defaultExpanded,\n}: RolloutAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n const currentStepIndex = rollout.status?.currentStepIndex ?? 0;\n const abortedMessage = findAbortedMessage(rollout);\n\n return (\n <Accordion\n defaultExpanded={defaultExpanded}\n TransitionProps={{ unmountOnExit: true }}\n variant=\"outlined\"\n >\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <RolloutSummary\n rollout={rollout}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <div style={{ width: '100%' }}>\n <div>\n <Typography variant=\"h6\">Rollout status</Typography>\n </div>\n <div style={{ margin: '1rem' }}>\n {abortedMessage && (\n <>\n {AbortedTitle}\n <Typography variant=\"subtitle2\">{abortedMessage}</Typography>\n </>\n )}\n <StepsProgress\n aborted={abortedMessage !== undefined}\n steps={rollout.spec?.strategy?.canary?.steps ?? []}\n currentStepIndex={currentStepIndex}\n />\n </div>\n <div>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </div>\n </div>\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const RolloutAccordions = ({\n rollouts,\n defaultExpanded = false,\n}: RolloutAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {rollouts.map((rollout, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <RolloutAccordion\n defaultExpanded={defaultExpanded}\n matchingHpa={getMatchingHpa(\n {\n name: rollout.metadata?.name,\n namespace: rollout.metadata?.namespace,\n kind: 'rollout',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n rollout,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n rollout={rollout}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAM,YACJ,mBAAAA,cAAA,CAAA,aAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,KAAO,EAAA;AAAA,MACL,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,QAAA;AAAA,MACZ,QAAU,EAAA,MAAA;AAAA,KACZ;AAAA,GAAA;AAAA,+CAEC,gBAAiB,EAAA,IAAA,CAAA;AAAA,kBACjBA,cAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,WAAA,EAAA,EAAY,SAAO,CAAA;AACzC,CAAA,CAAA;AAGF,MAAM,kBAAqB,GAAA,CAAC,OAC1B,KAAA,OAAA,CAAQ,QAAQ,UAAY,EAAA,IAAA;A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,SAAA;AAAA,WACR;AAAA,UACA,gBAAiB,CAAA,wBAAA;AAAA,SACnB;AAAA,QACA,SAAW,EAAA,8BAAA;AAAA,UACT,OAAA;AAAA,UACA,gBAAiB,CAAA,WAAA;AAAA,UACjB,gBAAiB,CAAA,IAAA;AAAA,SACnB;AAAA,QACA,OAAA;AAAA,OAAA;AAAA,KAEJ,CACF,CACD,CAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"Rollout.esm.js","sources":["../../../../src/components/CustomResources/ArgoRollouts/Rollout.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, { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { V1Pod, V2HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { PodsTable } from '../../Pods';\nimport { HorizontalPodAutoscalerDrawer } from '../../HorizontalPodAutoscalers';\nimport { RolloutDrawer } from './RolloutDrawer';\nimport PauseIcon from '@material-ui/icons/Pause';\nimport ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';\nimport { DateTime } from 'luxon';\nimport { StepsProgress } from './StepsProgress';\nimport {\n PodNamesWithErrorsContext,\n GroupedResponsesContext,\n} from '../../../hooks';\nimport {\n getMatchingHpa,\n getOwnedPodsThroughReplicaSets,\n} from '../../../utils/owner';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../../Pods/PodsTable';\n\ntype RolloutAccordionsProps = {\n rollouts: any[];\n defaultExpanded?: boolean;\n children?: React.ReactNode;\n};\n\ntype RolloutAccordionProps = {\n rollout: any;\n ownedPods: V1Pod[];\n defaultExpanded?: boolean;\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\ntype RolloutSummaryProps = {\n rollout: any;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\nconst AbortedTitle = (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <ErrorOutlineIcon />\n <Typography variant=\"subtitle1\">Aborted</Typography>\n </div>\n);\n\nconst findAbortedMessage = (rollout: any): string | undefined =>\n rollout.status?.conditions?.find(\n (c: any) =>\n c.type === 'Progressing' &&\n c.status === 'False' &&\n c.reason === 'RolloutAborted',\n )?.message;\n\nconst RolloutSummary = ({\n rollout,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: RolloutSummaryProps) => {\n const pauseTime: string | undefined = rollout.status?.pauseConditions?.find(\n (p: any) => p.reason === 'CanaryPauseStep',\n )?.startTime;\n const abortedMessage = findAbortedMessage(rollout);\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <RolloutDrawer rollout={rollout} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n {pauseTime && (\n <Grid item xs={3}>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <PauseIcon />\n <Typography variant=\"subtitle1\">\n Paused ({DateTime.fromISO(pauseTime).toRelative({ locale: 'en' })}\n )\n </Typography>\n </div>\n </Grid>\n )}\n {abortedMessage && (\n <Grid item xs={3}>\n {AbortedTitle}\n </Grid>\n )}\n </Grid>\n );\n};\n\nconst RolloutAccordion = ({\n rollout,\n ownedPods,\n matchingHpa,\n defaultExpanded,\n}: RolloutAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n const currentStepIndex = rollout.status?.currentStepIndex ?? 0;\n const abortedMessage = findAbortedMessage(rollout);\n\n return (\n <Accordion\n defaultExpanded={defaultExpanded}\n TransitionProps={{ unmountOnExit: true }}\n variant=\"outlined\"\n >\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <RolloutSummary\n rollout={rollout}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <div style={{ width: '100%' }}>\n <div>\n <Typography variant=\"h6\">Rollout status</Typography>\n </div>\n <div style={{ margin: '1rem' }}>\n {abortedMessage && (\n <>\n {AbortedTitle}\n <Typography variant=\"subtitle2\">{abortedMessage}</Typography>\n </>\n )}\n <StepsProgress\n aborted={abortedMessage !== undefined}\n steps={rollout.spec?.strategy?.canary?.steps ?? []}\n currentStepIndex={currentStepIndex}\n />\n </div>\n <div>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </div>\n </div>\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const RolloutAccordions = ({\n rollouts,\n defaultExpanded = false,\n}: RolloutAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {rollouts.map((rollout, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <RolloutAccordion\n defaultExpanded={defaultExpanded}\n matchingHpa={getMatchingHpa(\n {\n name: rollout.metadata?.name,\n namespace: rollout.metadata?.namespace,\n kind: 'rollout',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n rollout,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n rollout={rollout}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAM,YACJ,mBAAAA,cAAA,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il = hpa?.spec?.metrics?.find(
|
|
56
|
+
(metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
|
|
57
|
+
)?.resource?.target.averageUtilization;
|
|
58
|
+
const cpuUtil = hpa?.status?.currentMetrics?.find(
|
|
59
|
+
(metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
|
|
60
|
+
)?.resource?.current.averageUtilization;
|
|
55
61
|
return /* @__PURE__ */ React__default.createElement(
|
|
56
62
|
Grid,
|
|
57
63
|
{
|
|
@@ -73,8 +79,8 @@ const DeploymentSummary = ({
|
|
|
73
79
|
spacing: 0
|
|
74
80
|
},
|
|
75
81
|
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "min replicas ", hpa.spec?.minReplicas ?? "?", " / max replicas", " ", hpa.spec?.maxReplicas ?? "?")),
|
|
76
|
-
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "current CPU usage:
|
|
77
|
-
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "target CPU usage:
|
|
82
|
+
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "current CPU usage: ", cpuUtil ?? "?", "%")),
|
|
83
|
+
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "target CPU usage: ", specCpuUtil ?? "?", "%"))
|
|
78
84
|
))),
|
|
79
85
|
/* @__PURE__ */ React__default.createElement(
|
|
80
86
|
Grid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeploymentsAccordions.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentsAccordions.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, { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport {\n V1Deployment,\n V1Pod,\n V1HorizontalPodAutoscaler,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DeploymentDrawer } from './DeploymentDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport {\n getOwnedPodsThroughReplicaSets,\n getMatchingHpa,\n} from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype DeploymentsAccordionsProps = {\n children?: React.ReactNode;\n};\n\ntype DeploymentAccordionProps = {\n deployment: V1Deployment;\n ownedPods: V1Pod[];\n matchingHpa?: V1HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\ntype DeploymentSummaryProps = {\n deployment: V1Deployment;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V1HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\nconst DeploymentSummary = ({\n deployment,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: DeploymentSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={4} item>\n <DeploymentDrawer deployment={deployment} />\n </Grid>\n {hpa && (\n <Grid item xs={4}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage:{' '}\n {hpa.status?.currentCPUUtilizationPercentage ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage:{' '}\n {hpa.spec?.targetCPUUtilizationPercentage ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={4}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst DeploymentAccordion = ({\n deployment,\n ownedPods,\n matchingHpa,\n}: DeploymentAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DeploymentSummary\n deployment={deployment}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DeploymentsAccordions = ({}: DeploymentsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.deployments.map((deployment, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DeploymentAccordion\n matchingHpa={getMatchingHpa(\n {\n name: deployment.metadata?.name,\n namespace: deployment.metadata?.namespace,\n kind: 'deployment',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n deployment,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n deployment={deployment}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,oBAAoB,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA,GAAA;AACF,CAA8B,KAAA;AAC5B,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,KAAA;AAAA,oBAETA,cAAA,CAAA,aAAA,CAAC,QAAK,EAAI,EAAA,CAAA,EAAG,MAAI,IACf,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,gBAAiB,EAAA,EAAA,UAAA,EAAwB,CAC5C,CAAA;AAAA,IACC,GAAA,iDACE,IAAK,EAAA,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;AAAA,UACjB,gBAAiB,CAAA,IAAA;AAAA,SACnB;AAAA,QACA,UAAA;AAAA,OAAA;AAAA,KAEJ,CACF,CACD,CAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"DeploymentsAccordions.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentsAccordions.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, { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport {\n V1Deployment,\n V1Pod,\n V2HorizontalPodAutoscaler,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DeploymentDrawer } from './DeploymentDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport {\n getOwnedPodsThroughReplicaSets,\n getMatchingHpa,\n} from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype DeploymentsAccordionsProps = {\n children?: React.ReactNode;\n};\n\ntype DeploymentAccordionProps = {\n deployment: V1Deployment;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\ntype DeploymentSummaryProps = {\n deployment: V1Deployment;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\nconst DeploymentSummary = ({\n deployment,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: DeploymentSummaryProps) => {\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={4} item>\n <DeploymentDrawer deployment={deployment} />\n </Grid>\n {hpa && (\n <Grid item xs={4}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={4}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst DeploymentAccordion = ({\n deployment,\n ownedPods,\n matchingHpa,\n}: DeploymentAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DeploymentSummary\n deployment={deployment}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DeploymentsAccordions = ({}: DeploymentsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.deployments.map((deployment, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DeploymentAccordion\n matchingHpa={getMatchingHpa(\n {\n name: deployment.metadata?.name,\n namespace: deployment.metadata?.namespace,\n kind: 'deployment',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n deployment,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n deployment={deployment}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,oBAAoB,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA,GAAA;AACF,CAA8B,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mB,WAAW,uBAAuB,CAAA,CAAA;AAE3D,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,QAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,KAAA;AAAA,IAEV,gBAAA,CAAiB,YAAY,GAAI,CAAA,CAAC,YAAY,CAC7C,qBAAAA,cAAA,CAAA,aAAA,CAAC,QAAK,SAAS,EAAA,IAAA,EAAC,MAAI,IAAC,EAAA,GAAA,EAAK,GAAG,EAAE,EAAA,IAAA,EAAA,+CAC5B,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAE,IACX,EAAA,kBAAAA,cAAA,CAAA,aAAA;AAAA,MAAC,mBAAA;AAAA,MAAA;AAAA,QACC,WAAa,EAAA,cAAA;AAAA,UACX;AAAA,YACE,IAAA,EAAM,WAAW,QAAU,EAAA,IAAA;AAAA,YAC3B,SAAA,EAAW,WAAW,QAAU,EAAA,SAAA;AAAA,YAChC,IAAM,EAAA,YAAA;AAAA,WACR;AAAA,UACA,gBAAiB,CAAA,wBAAA;AAAA,SACnB;AAAA,QACA,SAAW,EAAA,8BAAA;AAAA,UACT,UAAA;AAAA,UACA,gBAAiB,CAAA,WAAA;AAAA,UACjB,gBAAiB,CAAA,IAAA;AAAA,SACnB;AAAA,QACA,UAAA;AAAA,OAAA;AAAA,KAEJ,CACF,CACD,CAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
|
@@ -8,6 +8,12 @@ import 'js-yaml';
|
|
|
8
8
|
|
|
9
9
|
const HorizontalPodAutoscalerDrawer = (props) => {
|
|
10
10
|
const { hpa, expanded, children } = props;
|
|
11
|
+
const specCpuUtil = hpa?.spec?.metrics?.find(
|
|
12
|
+
(metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
|
|
13
|
+
)?.resource?.target.averageUtilization;
|
|
14
|
+
const cpuUtil = hpa?.status?.currentMetrics?.find(
|
|
15
|
+
(metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
|
|
16
|
+
)?.resource?.current.averageUtilization;
|
|
11
17
|
return /* @__PURE__ */ React__default.createElement(
|
|
12
18
|
KubernetesStructuredMetadataTableDrawer,
|
|
13
19
|
{
|
|
@@ -16,12 +22,13 @@ const HorizontalPodAutoscalerDrawer = (props) => {
|
|
|
16
22
|
expanded,
|
|
17
23
|
renderObject: (hpaObject) => {
|
|
18
24
|
return {
|
|
19
|
-
targetCPUUtilizationPercentage:
|
|
20
|
-
currentCPUUtilizationPercentage:
|
|
25
|
+
targetCPUUtilizationPercentage: specCpuUtil,
|
|
26
|
+
currentCPUUtilizationPercentage: cpuUtil,
|
|
21
27
|
minReplicas: hpaObject.spec?.minReplicas,
|
|
22
28
|
maxReplicas: hpaObject.spec?.maxReplicas,
|
|
23
29
|
currentReplicas: hpaObject.status?.currentReplicas,
|
|
24
|
-
desiredReplicas: hpaObject.status?.desiredReplicas
|
|
30
|
+
desiredReplicas: hpaObject.status?.desiredReplicas,
|
|
31
|
+
lastScaleTime: hpa?.status?.lastScaleTime
|
|
25
32
|
};
|
|
26
33
|
}
|
|
27
34
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalPodAutoscalerDrawer.esm.js","sources":["../../../src/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.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 {
|
|
1
|
+
{"version":3,"file":"HorizontalPodAutoscalerDrawer.esm.js","sources":["../../../src/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.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 { V2HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\n\n/** @public */\nexport const HorizontalPodAutoscalerDrawer = (props: {\n hpa: V2HorizontalPodAutoscaler;\n expanded?: boolean;\n children?: React.ReactNode;\n}) => {\n const { hpa, expanded, children } = props;\n\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <KubernetesStructuredMetadataTableDrawer\n kind=\"HorizontalPodAutoscaler\"\n object={hpa}\n expanded={expanded}\n renderObject={(hpaObject: V2HorizontalPodAutoscaler) => {\n return {\n targetCPUUtilizationPercentage: specCpuUtil,\n currentCPUUtilizationPercentage: cpuUtil,\n minReplicas: hpaObject.spec?.minReplicas,\n maxReplicas: hpaObject.spec?.maxReplicas,\n currentReplicas: hpaObject.status?.currentReplicas,\n desiredReplicas: hpaObject.status?.desiredReplicas,\n lastScaleTime: hpa?.status?.lastScaleTime,\n };\n }}\n >\n {children}\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;AAqBa,M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|
53
53
|
hpa
|
|
54
54
|
}) => {
|
|
55
|
+
const specCpuUtil = hpa?.spec?.metrics?.find(
|
|
56
|
+
(metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
|
|
57
|
+
)?.resource?.target.averageUtilization;
|
|
58
|
+
const cpuUtil = hpa?.status?.currentMetrics?.find(
|
|
59
|
+
(metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
|
|
60
|
+
)?.resource?.current.averageUtilization;
|
|
55
61
|
return /* @__PURE__ */ React__default.createElement(
|
|
56
62
|
Grid,
|
|
57
63
|
{
|
|
@@ -73,8 +79,8 @@ const StatefulSetSummary = ({
|
|
|
73
79
|
spacing: 0
|
|
74
80
|
},
|
|
75
81
|
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "min replicas ", hpa.spec?.minReplicas ?? "?", " / max replicas", " ", hpa.spec?.maxReplicas ?? "?")),
|
|
76
|
-
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "current CPU usage:
|
|
77
|
-
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "target CPU usage:
|
|
82
|
+
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "current CPU usage: ", cpuUtil ?? "?", "%")),
|
|
83
|
+
/* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "target CPU usage: ", specCpuUtil ?? "?", "%"))
|
|
78
84
|
))),
|
|
79
85
|
/* @__PURE__ */ React__default.createElement(
|
|
80
86
|
Grid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatefulSetsAccordions.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetsAccordions.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, { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport {\n V1Pod,\n V1HorizontalPodAutoscaler,\n V1StatefulSet,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { StatefulSetDrawer } from './StatefulSetDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport { getMatchingHpa, getOwnedResources } from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype StatefulSetsAccordionsProps = {\n children?: React.ReactNode;\n};\n\ntype StatefulSetAccordionProps = {\n statefulset: V1StatefulSet;\n ownedPods: V1Pod[];\n matchingHpa?: V1HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\ntype StatefulSetSummaryProps = {\n statefulset: V1StatefulSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V1HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\nconst StatefulSetSummary = ({\n statefulset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: StatefulSetSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <StatefulSetDrawer statefulset={statefulset} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage:{' '}\n {hpa.status?.currentCPUUtilizationPercentage ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage:{' '}\n {hpa.spec?.targetCPUUtilizationPercentage ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst StatefulSetAccordion = ({\n statefulset,\n ownedPods,\n matchingHpa,\n}: StatefulSetAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <StatefulSetSummary\n statefulset={statefulset}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const StatefulSetsAccordions = ({}: StatefulSetsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.statefulsets.map((statefulset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <StatefulSetAccordion\n matchingHpa={getMatchingHpa(\n {\n name: statefulset.metadata?.name,\n namespace: statefulset.metadata?.namespace,\n kind: 'statefulset',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedResources(statefulset, groupedResponses.pods)}\n statefulset={statefulset}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,qBAAqB,CAAC;AAAA,EAC1B,WAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA,GAAA;AACF,CAA+B,KAAA;AAC7B,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,KAAA;AAAA,oBAETA,cAAA,CAAA,aAAA,CAAC,QAAK,EAAI,EAAA,CAAA,EAAG,MAAI,IACf,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,iBAAkB,EAAA,EAAA,WAAA,EAA0B,CAC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AkB,WAAa,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,QAC/D,WAAA;AAAA,OAAA;AAAA,KAEJ,CACF,CACD,CAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"StatefulSetsAccordions.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetsAccordions.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, { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport {\n V1Pod,\n V2HorizontalPodAutoscaler,\n V1StatefulSet,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { StatefulSetDrawer } from './StatefulSetDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport { getMatchingHpa, getOwnedResources } from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype StatefulSetsAccordionsProps = {\n children?: React.ReactNode;\n};\n\ntype StatefulSetAccordionProps = {\n statefulset: V1StatefulSet;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\ntype StatefulSetSummaryProps = {\n statefulset: V1StatefulSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\nconst StatefulSetSummary = ({\n statefulset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: StatefulSetSummaryProps) => {\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <StatefulSetDrawer statefulset={statefulset} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst StatefulSetAccordion = ({\n statefulset,\n ownedPods,\n matchingHpa,\n}: StatefulSetAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <StatefulSetSummary\n statefulset={statefulset}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const StatefulSetsAccordions = ({}: StatefulSetsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.statefulsets.map((statefulset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <StatefulSetAccordion\n matchingHpa={getMatchingHpa(\n {\n name: statefulset.metadata?.name,\n namespace: statefulset.metadata?.namespace,\n kind: 'statefulset',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedResources(statefulset, groupedResponses.pods)}\n statefulset={statefulset}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,qBAAqB,CAAC;AAAA,EAC1B,WAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA,GAAA;AACF,CAA+B,KAAA;AAC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uBAAuB,CAAA,CAAA;AAE3D,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,QAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,KAAA;AAAA,IAEV,gBAAA,CAAiB,aAAa,GAAI,CAAA,CAAC,aAAa,CAC/C,qBAAAA,cAAA,CAAA,aAAA,CAAC,QAAK,SAAS,EAAA,IAAA,EAAC,MAAI,IAAC,EAAA,GAAA,EAAK,GAAG,EAAE,EAAA,IAAA,EAAA,+CAC5B,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAE,IACX,EAAA,kBAAAA,cAAA,CAAA,aAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QACC,WAAa,EAAA,cAAA;AAAA,UACX;AAAA,YACE,IAAA,EAAM,YAAY,QAAU,EAAA,IAAA;AAAA,YAC5B,SAAA,EAAW,YAAY,QAAU,EAAA,SAAA;AAAA,YACjC,IAAM,EAAA,aAAA;AAAA,WACR;AAAA,UACA,gBAAiB,CAAA,wBAAA;AAAA,SACnB;AAAA,QACA,SAAW,EAAA,iBAAA,CAAkB,WAAa,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,QAC/D,WAAA;AAAA,OAAA;AAAA,KAEJ,CACF,CACD,CAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ import React__default from 'react';
|
|
|
5
5
|
import { IObjectMeta, IIoK8sApimachineryPkgApisMetaV1ObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';
|
|
6
6
|
import { TypeMeta } from '@kubernetes-models/base';
|
|
7
7
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
8
|
-
import { OAuthApi, OpenIdConnectApi, DiscoveryApi,
|
|
8
|
+
import { OAuthApi, OpenIdConnectApi, DiscoveryApi, FetchApi, ProfileInfoApi } from '@backstage/core-plugin-api';
|
|
9
9
|
import * as kubernetes_models_v1 from 'kubernetes-models/v1';
|
|
10
10
|
import { Event, Pod, IContainer, IContainerStatus } from 'kubernetes-models/v1';
|
|
11
11
|
import { JsonObject } from '@backstage/types';
|
|
12
|
-
import {
|
|
12
|
+
import { V2HorizontalPodAutoscaler, V1Job, V1ObjectMeta, V1Pod } from '@kubernetes/client-node';
|
|
13
13
|
import * as react_use_esm_useAsyncFn from 'react-use/esm/useAsyncFn';
|
|
14
14
|
import { Pod as Pod$1 } from 'kubernetes-models/v1/Pod';
|
|
15
15
|
|
|
@@ -233,11 +233,11 @@ declare class AksKubernetesAuthProvider implements KubernetesAuthProvider {
|
|
|
233
233
|
/** @public */
|
|
234
234
|
declare class KubernetesBackendClient implements KubernetesApi {
|
|
235
235
|
private readonly discoveryApi;
|
|
236
|
-
private readonly
|
|
236
|
+
private readonly fetchApi;
|
|
237
237
|
private readonly kubernetesAuthProvidersApi;
|
|
238
238
|
constructor(options: {
|
|
239
239
|
discoveryApi: DiscoveryApi;
|
|
240
|
-
|
|
240
|
+
fetchApi: FetchApi;
|
|
241
241
|
kubernetesAuthProvidersApi: KubernetesAuthProvidersApi;
|
|
242
242
|
});
|
|
243
243
|
private handleResponse;
|
|
@@ -441,7 +441,7 @@ declare const ErrorReporting: ({ detectedErrors, clusters, }: ErrorReportingProp
|
|
|
441
441
|
|
|
442
442
|
/** @public */
|
|
443
443
|
declare const HorizontalPodAutoscalerDrawer: (props: {
|
|
444
|
-
hpa:
|
|
444
|
+
hpa: V2HorizontalPodAutoscaler;
|
|
445
445
|
expanded?: boolean;
|
|
446
446
|
children?: React__default.ReactNode;
|
|
447
447
|
}) => React__default.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owner.esm.js","sources":["../../src/utils/owner.ts"],"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 { V1ObjectMeta } from '@kubernetes/client-node/dist/gen/model/v1ObjectMeta';\nimport {\n
|
|
1
|
+
{"version":3,"file":"owner.esm.js","sources":["../../src/utils/owner.ts"],"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 { V1ObjectMeta } from '@kubernetes/client-node/dist/gen/model/v1ObjectMeta';\nimport {\n V2HorizontalPodAutoscaler,\n V1Pod,\n V1ReplicaSet,\n} from '@kubernetes/client-node';\n\ninterface CanOwn {\n metadata?: V1ObjectMeta;\n}\n\ninterface CanBeOwned {\n metadata?: V1ObjectMeta;\n}\n\nexport function getOwnedResources<R extends CanBeOwned>(\n potentialOwner: CanOwn,\n possiblyOwned: R[],\n): R[] {\n return possiblyOwned.filter(\n p =>\n p.metadata?.ownerReferences?.some(\n o => o.uid === potentialOwner.metadata?.uid,\n ) ?? false,\n );\n}\n\nexport const getOwnedPodsThroughReplicaSets = (\n potentialOwner: CanOwn,\n replicaSets: V1ReplicaSet[],\n pods: V1Pod[],\n) => {\n return getOwnedResources(\n potentialOwner,\n replicaSets.filter(rs => rs.status && rs.status.replicas > 0),\n ).reduce((accum, rs) => {\n return accum.concat(getOwnedResources(rs, pods));\n }, [] as V1Pod[]);\n};\n\ninterface ResourceRef {\n kind: string;\n namespace?: string;\n name?: string;\n}\n\nexport const getMatchingHpa = (\n owner: ResourceRef,\n hpas: V2HorizontalPodAutoscaler[],\n): V2HorizontalPodAutoscaler | undefined => {\n return hpas.find(hpa => {\n return (\n (hpa.spec?.scaleTargetRef?.kind ?? '').toLocaleLowerCase('en-US') ===\n owner.kind.toLocaleLowerCase('en-US') &&\n (hpa.metadata?.namespace ?? '') ===\n (owner.namespace ?? 'unknown-namespace') &&\n (hpa.spec?.scaleTargetRef?.name ?? '') ===\n (owner.name ?? 'unknown-deployment')\n );\n });\n};\n"],"names":[],"mappings":"AA+BgB,SAAA,iBAAA,CACd,gBACA,aACK,EAAA;AACL,EAAA,OAAO,aAAc,CAAA,MAAA;AAAA,IACnB,CAAA,CAAA,KACE,CAAE,CAAA,QAAA,EAAU,eAAiB,EAAA,IAAA;AAAA,MAC3B,CAAK,CAAA,KAAA,CAAA,CAAE,GAAQ,KAAA,cAAA,CAAe,QAAU,EAAA,GAAA;AAAA,KACrC,IAAA,KAAA;AAAA,GACT,CAAA;AACF,CAAA;AAEO,MAAM,8BAAiC,GAAA,CAC5C,cACA,EAAA,WAAA,EACA,IACG,KAAA;AACH,EAAO,OAAA,iBAAA;AAAA,IACL,cAAA;AAAA,IACA,WAAA,CAAY,OAAO,CAAM,EAAA,KAAA,EAAA,CAAG,UAAU,EAAG,CAAA,MAAA,CAAO,WAAW,CAAC,CAAA;AAAA,GAC5D,CAAA,MAAA,CAAO,CAAC,KAAA,EAAO,EAAO,KAAA;AACtB,IAAA,OAAO,KAAM,CAAA,MAAA,CAAO,iBAAkB,CAAA,EAAA,EAAI,IAAI,CAAC,CAAA,CAAA;AAAA,GACjD,EAAG,EAAa,CAAA,CAAA;AAClB,EAAA;AAQa,MAAA,cAAA,GAAiB,CAC5B,KAAA,EACA,IAC0C,KAAA;AAC1C,EAAO,OAAA,IAAA,CAAK,KAAK,CAAO,GAAA,KAAA;AACtB,IACG,OAAA,CAAA,GAAA,CAAI,IAAM,EAAA,cAAA,EAAgB,IAAQ,IAAA,EAAA,EAAI,iBAAkB,CAAA,OAAO,CAC9D,KAAA,KAAA,CAAM,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA,IAAA,CACrC,IAAI,QAAU,EAAA,SAAA,IAAa,EACzB,OAAA,KAAA,CAAM,SAAa,IAAA,mBAAA,CAAA,IAAA,CACrB,GAAI,CAAA,IAAA,EAAM,cAAgB,EAAA,IAAA,IAAQ,EAChC,OAAA,KAAA,CAAM,IAAQ,IAAA,oBAAA,CAAA,CAAA;AAAA,GAEpB,CAAA,CAAA;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-kubernetes-react",
|
|
3
3
|
"description": "Web library for the kubernetes-react plugin",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0-next.2",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@backstage/catalog-model": "^1.5.0",
|
|
34
|
-
"@backstage/core-components": "^0.14.8-next.
|
|
35
|
-
"@backstage/core-plugin-api": "^1.9.
|
|
34
|
+
"@backstage/core-components": "^0.14.8-next.1",
|
|
35
|
+
"@backstage/core-plugin-api": "^1.9.3-next.0",
|
|
36
36
|
"@backstage/errors": "^1.2.4",
|
|
37
|
-
"@backstage/plugin-kubernetes-common": "^0.
|
|
37
|
+
"@backstage/plugin-kubernetes-common": "^0.8.0-next.0",
|
|
38
38
|
"@backstage/types": "^1.1.1",
|
|
39
39
|
"@kubernetes-models/apimachinery": "^1.1.0",
|
|
40
40
|
"@kubernetes-models/base": "^4.0.1",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"react": "^16.13.1 || ^17.0.0 || ^18.0.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@backstage/cli": "^0.26.
|
|
61
|
-
"@backstage/core-app-api": "^1.12.
|
|
62
|
-
"@backstage/test-utils": "^1.5.6-next.
|
|
60
|
+
"@backstage/cli": "^0.26.7-next.2",
|
|
61
|
+
"@backstage/core-app-api": "^1.12.6-next.0",
|
|
62
|
+
"@backstage/test-utils": "^1.5.6-next.1",
|
|
63
63
|
"@testing-library/jest-dom": "^6.0.0",
|
|
64
64
|
"@testing-library/react": "^15.0.0",
|
|
65
65
|
"jest-websocket-mock": "^2.5.0",
|