@backstage/plugin-kubernetes 0.6.3 → 0.6.4-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 CHANGED
@@ -1,5 +1,36 @@
1
1
  # @backstage/plugin-kubernetes
2
2
 
3
+ ## 0.6.4-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 82e2ae6ff6: build(deps): bump `cronstrue` from 1.125.0 to 2.2.0
8
+ - 24254fd433: build(deps): bump `@testing-library/user-event` from 13.5.0 to 14.0.0
9
+ - 230ad0826f: Bump to using `@types/node` v16
10
+ - Updated dependencies
11
+ - @backstage/core-components@0.9.3-next.2
12
+ - @backstage/core-plugin-api@1.0.1-next.0
13
+ - @backstage/plugin-catalog-react@1.0.1-next.3
14
+
15
+ ## 0.6.4-next.1
16
+
17
+ ### Patch Changes
18
+
19
+ - 1023ee6353: export kubernetes components
20
+ - Updated dependencies
21
+ - @backstage/plugin-catalog-react@1.0.1-next.1
22
+
23
+ ## 0.6.4-next.0
24
+
25
+ ### Patch Changes
26
+
27
+ - f616d99f6f: Fix division by zero in currentToDeclaredResourceToPerc when pod resources weren't set
28
+ - Updated dependencies
29
+ - @backstage/catalog-model@1.0.1-next.0
30
+ - @backstage/plugin-catalog-react@1.0.1-next.0
31
+ - @backstage/core-components@0.9.3-next.0
32
+ - @backstage/plugin-kubernetes-common@0.2.9-next.0
33
+
3
34
  ## 0.6.3
4
35
 
5
36
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -2,8 +2,10 @@
2
2
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
3
  import { DiscoveryApi, IdentityApi, OAuthApi } from '@backstage/core-plugin-api';
4
4
  import { Entity } from '@backstage/catalog-model';
5
- import { KubernetesRequestBody, ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common';
5
+ import { KubernetesRequestBody, ObjectsByEntityResponse, ClusterObjects, ClientPodStatus, ClusterAttributes } from '@backstage/plugin-kubernetes-common';
6
6
  import { JsonObject } from '@backstage/types';
7
+ import { V1Pod, V1ReplicaSet, V1Deployment, V1HorizontalPodAutoscaler, V1Service, V1ConfigMap, V1Ingress, V1Job, V1CronJob, V1ObjectMeta } from '@kubernetes/client-node';
8
+ import React from 'react';
7
9
 
8
10
  declare const kubernetesPlugin: _backstage_core_plugin_api.BackstagePlugin<{
9
11
  entityContent: _backstage_core_plugin_api.RouteRef<undefined>;
@@ -39,6 +41,9 @@ declare class KubernetesBackendClient implements KubernetesApi {
39
41
  }[]>;
40
42
  }
41
43
 
44
+ interface KubernetesAuthProvider {
45
+ decorateRequestBodyForAuth(requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
46
+ }
42
47
  declare const kubernetesAuthProvidersApiRef: _backstage_core_plugin_api.ApiRef<KubernetesAuthProvidersApi>;
43
48
  interface KubernetesAuthProvidersApi {
44
49
  decorateRequestBodyForAuth(authProvider: string, requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
@@ -52,6 +57,24 @@ declare class KubernetesAuthProviders implements KubernetesAuthProvidersApi {
52
57
  decorateRequestBodyForAuth(authProvider: string, requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
53
58
  }
54
59
 
60
+ declare class AwsKubernetesAuthProvider implements KubernetesAuthProvider {
61
+ decorateRequestBodyForAuth(requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
62
+ }
63
+
64
+ declare class GoogleKubernetesAuthProvider implements KubernetesAuthProvider {
65
+ authProvider: OAuthApi;
66
+ constructor(authProvider: OAuthApi);
67
+ decorateRequestBodyForAuth(requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
68
+ }
69
+
70
+ declare class GoogleServiceAccountAuthProvider implements KubernetesAuthProvider {
71
+ decorateRequestBodyForAuth(requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
72
+ }
73
+
74
+ declare class ServiceAccountKubernetesAuthProvider implements KubernetesAuthProvider {
75
+ decorateRequestBodyForAuth(requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
76
+ }
77
+
55
78
  declare type FormatClusterLinkOptions = {
56
79
  dashboardUrl?: string;
57
80
  dashboardApp?: string;
@@ -61,6 +84,20 @@ declare type FormatClusterLinkOptions = {
61
84
  };
62
85
  declare function formatClusterLink(options: FormatClusterLinkOptions): string | undefined;
63
86
 
87
+ interface DeploymentResources {
88
+ pods: V1Pod[];
89
+ replicaSets: V1ReplicaSet[];
90
+ deployments: V1Deployment[];
91
+ horizontalPodAutoscalers: V1HorizontalPodAutoscaler[];
92
+ }
93
+ interface GroupedResponses extends DeploymentResources {
94
+ services: V1Service[];
95
+ configMaps: V1ConfigMap[];
96
+ ingresses: V1Ingress[];
97
+ jobs: V1Job[];
98
+ cronJobs: V1CronJob[];
99
+ customResources: any[];
100
+ }
64
101
  interface ClusterLinksFormatterOptions {
65
102
  dashboardUrl?: URL;
66
103
  dashboardParameters?: JsonObject;
@@ -71,4 +108,109 @@ declare type ClusterLinksFormatter = (options: ClusterLinksFormatterOptions) =>
71
108
 
72
109
  declare const clusterLinksFormatters: Record<string, ClusterLinksFormatter>;
73
110
 
74
- export { EntityKubernetesContent, KubernetesApi, KubernetesAuthProviders, KubernetesAuthProvidersApi, KubernetesBackendClient, Router, clusterLinksFormatters, formatClusterLink, isKubernetesAvailable, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesPlugin, kubernetesPlugin as plugin };
111
+ declare type ClusterProps = {
112
+ clusterObjects: ClusterObjects;
113
+ podsWithErrors: Set<string>;
114
+ children?: React.ReactNode;
115
+ };
116
+ declare const Cluster: ({ clusterObjects, podsWithErrors }: ClusterProps) => JSX.Element;
117
+
118
+ declare type CronJobsAccordionsProps = {
119
+ children?: React.ReactNode;
120
+ };
121
+ declare const CronJobsAccordions: ({}: CronJobsAccordionsProps) => JSX.Element;
122
+
123
+ interface CustomResourcesProps {
124
+ children?: React.ReactNode;
125
+ }
126
+ declare const CustomResources: ({}: CustomResourcesProps) => JSX.Element;
127
+
128
+ declare type ErrorPanelProps = {
129
+ entityName: string;
130
+ errorMessage?: string;
131
+ clustersWithErrors?: ClusterObjects[];
132
+ children?: React.ReactNode;
133
+ };
134
+ declare const ErrorPanel: ({ entityName, errorMessage, clustersWithErrors, }: ErrorPanelProps) => JSX.Element;
135
+
136
+ declare type ErrorSeverity = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
137
+ declare type ErrorDetectableKind = 'Pod' | 'Deployment' | 'HorizontalPodAutoscaler';
138
+ declare type DetectedErrorsByCluster = Map<string, DetectedError[]>;
139
+ interface DetectedError {
140
+ severity: ErrorSeverity;
141
+ cluster: string;
142
+ kind: ErrorDetectableKind;
143
+ names: string[];
144
+ message: string[];
145
+ }
146
+
147
+ declare type ErrorReportingProps = {
148
+ detectedErrors: DetectedErrorsByCluster;
149
+ };
150
+ declare const ErrorReporting: ({ detectedErrors }: ErrorReportingProps) => JSX.Element;
151
+
152
+ declare const HorizontalPodAutoscalerDrawer: ({ hpa, expanded, children, }: {
153
+ hpa: V1HorizontalPodAutoscaler;
154
+ expanded?: boolean | undefined;
155
+ children?: React.ReactNode;
156
+ }) => JSX.Element;
157
+
158
+ declare type IngressesAccordionsProps = {};
159
+ declare const IngressesAccordions: ({}: IngressesAccordionsProps) => JSX.Element;
160
+
161
+ declare type JobsAccordionsProps = {
162
+ jobs: V1Job[];
163
+ children?: React.ReactNode;
164
+ };
165
+ declare const JobsAccordions: ({ jobs }: JobsAccordionsProps) => JSX.Element;
166
+
167
+ interface KubernetesDrawerable {
168
+ metadata?: V1ObjectMeta;
169
+ }
170
+ interface KubernetesDrawerProps<T extends KubernetesDrawerable> {
171
+ object: T;
172
+ renderObject: (obj: T) => object;
173
+ buttonVariant?: 'h5' | 'subtitle2';
174
+ kind: string;
175
+ expanded?: boolean;
176
+ children?: React.ReactNode;
177
+ }
178
+ declare const KubernetesDrawer: <T extends KubernetesDrawerable>({ object, renderObject, kind, buttonVariant, expanded, children, }: KubernetesDrawerProps<T>) => JSX.Element;
179
+
180
+ declare const PodDrawer: ({ pod, expanded, }: {
181
+ pod: V1Pod;
182
+ expanded?: boolean | undefined;
183
+ }) => JSX.Element;
184
+
185
+ declare type PodColumns = 'READY' | 'RESOURCE';
186
+ declare type PodsTablesProps = {
187
+ pods: V1Pod[];
188
+ extraColumns?: PodColumns[];
189
+ children?: React.ReactNode;
190
+ };
191
+ declare const PodsTable: ({ pods, extraColumns }: PodsTablesProps) => JSX.Element;
192
+
193
+ declare type ServicesAccordionsProps = {};
194
+ declare const ServicesAccordions: ({}: ServicesAccordionsProps) => JSX.Element;
195
+
196
+ declare type KubernetesContentProps = {
197
+ entity: Entity;
198
+ children?: React.ReactNode;
199
+ };
200
+ declare const KubernetesContent: ({ entity }: KubernetesContentProps) => JSX.Element;
201
+
202
+ interface KubernetesObjects {
203
+ kubernetesObjects: ObjectsByEntityResponse | undefined;
204
+ error: string | undefined;
205
+ }
206
+ declare const useKubernetesObjects: (entity: Entity, intervalMs?: number) => KubernetesObjects;
207
+
208
+ declare const PodNamesWithErrorsContext: React.Context<Set<string>>;
209
+
210
+ declare const PodNamesWithMetricsContext: React.Context<Map<string, ClientPodStatus>>;
211
+
212
+ declare const GroupedResponsesContext: React.Context<GroupedResponses>;
213
+
214
+ declare const ClusterContext: React.Context<ClusterAttributes>;
215
+
216
+ export { AwsKubernetesAuthProvider, Cluster, ClusterContext, ClusterLinksFormatter, ClusterLinksFormatterOptions, CronJobsAccordions, CustomResources, DeploymentResources, EntityKubernetesContent, ErrorPanel, ErrorReporting, GoogleKubernetesAuthProvider, GoogleServiceAccountAuthProvider, GroupedResponses, GroupedResponsesContext, HorizontalPodAutoscalerDrawer, IngressesAccordions, JobsAccordions, KubernetesApi, KubernetesAuthProviders, KubernetesAuthProvidersApi, KubernetesBackendClient, KubernetesContent, KubernetesDrawer, KubernetesObjects, PodDrawer, PodNamesWithErrorsContext, PodNamesWithMetricsContext, PodsTable, Router, ServiceAccountKubernetesAuthProvider, ServicesAccordions, clusterLinksFormatters, formatClusterLink, isKubernetesAvailable, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesPlugin, kubernetesPlugin as plugin, useKubernetesObjects };
package/dist/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import React__default, { Fragment, useState, useEffect, useContext } from 'react
4
4
  import { useEntity } from '@backstage/plugin-catalog-react';
5
5
  import { Routes, Route } from 'react-router-dom';
6
6
  import { Typography, Chip, Grid, makeStyles, createStyles, Button, Drawer, IconButton, FormControlLabel, Switch, Accordion, AccordionSummary, AccordionDetails, Divider, Stepper, Step, StepLabel } from '@material-ui/core';
7
- import { WarningPanel, InfoCard, Table, StatusOK, SubvalueCell, StatusError, StatusAborted, Button as Button$1, CodeSnippet, StructuredMetadataTable, StatusPending, Page, Content, Progress, MissingAnnotationEmptyState } from '@backstage/core-components';
7
+ import { WarningPanel, InfoCard, Table, SubvalueCell, StatusOK, StatusError, StatusAborted, Button as Button$1, CodeSnippet, StructuredMetadataTable, StatusPending, Page, Content, Progress, MissingAnnotationEmptyState } from '@backstage/core-components';
8
8
  import EmptyStateImage from './assets/emptystate.svg';
9
9
  import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
10
10
  import Close from '@material-ui/icons/Close';
@@ -378,6 +378,8 @@ const renderCondition = (condition) => {
378
378
  return [condition.type, /* @__PURE__ */ React__default.createElement(StatusAborted, null)];
379
379
  };
380
380
  const currentToDeclaredResourceToPerc = (current, resource) => {
381
+ if (Number(resource) === 0)
382
+ return `0%`;
381
383
  if (typeof current === "number" && typeof resource === "number") {
382
384
  return `${Math.round(current / resource * 100)}%`;
383
385
  }
@@ -614,6 +616,8 @@ const useKubernetesObjects = (entity, intervalMs = 1e4) => {
614
616
 
615
617
  const PodNamesWithErrorsContext = React__default.createContext(/* @__PURE__ */ new Set());
616
618
 
619
+ const PodNamesWithMetricsContext = React__default.createContext(/* @__PURE__ */ new Map());
620
+
617
621
  const GroupedResponsesContext = React__default.createContext({
618
622
  pods: [],
619
623
  replicaSets: [],
@@ -1003,8 +1007,6 @@ const PodDrawer = ({
1003
1007
  });
1004
1008
  };
1005
1009
 
1006
- const PodNamesWithMetricsContext = React__default.createContext(/* @__PURE__ */ new Map());
1007
-
1008
1010
  const READY_COLUMNS = "READY";
1009
1011
  const RESOURCE_COLUMNS = "RESOURCE";
1010
1012
  const DEFAULT_COLUMNS = [
@@ -2215,5 +2217,5 @@ var Router$1 = /*#__PURE__*/Object.freeze({
2215
2217
  Router: Router
2216
2218
  });
2217
2219
 
2218
- export { EntityKubernetesContent, KubernetesAuthProviders, KubernetesBackendClient, Router, clusterLinksFormatters, formatClusterLink, isKubernetesAvailable, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesPlugin, kubernetesPlugin as plugin };
2220
+ export { AwsKubernetesAuthProvider, Cluster, ClusterContext, CronJobsAccordions, CustomResources, EntityKubernetesContent, ErrorPanel$1 as ErrorPanel, ErrorReporting, GoogleKubernetesAuthProvider, GoogleServiceAccountAuthProvider, GroupedResponsesContext, HorizontalPodAutoscalerDrawer, IngressesAccordions, JobsAccordions, KubernetesAuthProviders, KubernetesBackendClient, KubernetesContent, KubernetesDrawer, PodDrawer, PodNamesWithErrorsContext, PodNamesWithMetricsContext, PodsTable, Router, ServiceAccountKubernetesAuthProvider, ServicesAccordions, clusterLinksFormatters, formatClusterLink, isKubernetesAvailable, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesPlugin, kubernetesPlugin as plugin, useKubernetesObjects };
2219
2221
  //# sourceMappingURL=index.esm.js.map