@backstage/plugin-kubernetes 0.8.0 → 0.9.0-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 CHANGED
@@ -1,5 +1,62 @@
1
1
  # @backstage/plugin-kubernetes
2
2
 
3
+ ## 0.9.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 280ec10c18e: Added Pod logs components for Kubernetes plugin
8
+
9
+ **BREAKING**: `kubernetesProxyApi` for custom plugins built with components from the Kubernetes plugin apis, `kubernetesProxyApi` should be added to the plugin's API list.
10
+
11
+ ```
12
+ ...
13
+ export const kubernetesPlugin = createPlugin({
14
+ id: 'kubernetes',
15
+ apis: [
16
+ ...
17
+ createApiFactory({
18
+ api: kubernetesProxyApiRef,
19
+ deps: {
20
+ kubernetesApi: kubernetesApiRef,
21
+ },
22
+ factory: ({ kubernetesApi }) =>
23
+ new KubernetesProxyClient({
24
+ kubernetesApi,
25
+ }),
26
+ }),
27
+ ```
28
+
29
+ **BREAKING**: `KubernetesDrawer` is now called `KubernetesStructuredMetadataTableDrawer` so that we can do more than just show `StructuredMetadataTable`
30
+
31
+ `import { KubernetesDrawer } from "@backstage/plugin-kubernetes"`
32
+
33
+ should now be:
34
+
35
+ `import { KubernetesStructuredMetadataTableDrawer } from "@backstage/plugin-kubernetes"`
36
+
37
+ ### Patch Changes
38
+
39
+ - a160e02c3d7: Omit managed fields in the Kubernetes resource YAML display.
40
+ - Updated dependencies
41
+ - @backstage/core-components@0.13.1-next.0
42
+ - @backstage/core-plugin-api@1.5.1
43
+ - @backstage/plugin-catalog-react@1.6.0-next.1
44
+ - @backstage/config@1.0.7
45
+
46
+ ## 0.8.1-next.0
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies
51
+ - @backstage/plugin-catalog-react@1.6.0-next.0
52
+ - @backstage/core-components@0.13.0
53
+ - @backstage/core-plugin-api@1.5.1
54
+ - @backstage/catalog-model@1.3.0
55
+ - @backstage/config@1.0.7
56
+ - @backstage/errors@1.1.5
57
+ - @backstage/theme@0.2.19
58
+ - @backstage/plugin-kubernetes-common@0.6.2
59
+
3
60
  ## 0.8.0
4
61
 
5
62
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -2,10 +2,12 @@
2
2
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
3
  import { OAuthApi, OpenIdConnectApi, DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
4
4
  import { Entity } from '@backstage/catalog-model';
5
- import { KubernetesRequestBody, ObjectsByEntityResponse, WorkloadsByEntityRequest, CustomObjectsByEntityRequest, ClusterObjects, CustomResourceMatcher, ClientPodStatus, ClusterAttributes } from '@backstage/plugin-kubernetes-common';
5
+ import { KubernetesRequestBody, ObjectsByEntityResponse, WorkloadsByEntityRequest, CustomObjectsByEntityRequest, ClusterObjects, ClusterAttributes, CustomResourceMatcher, ClientPodStatus } from '@backstage/plugin-kubernetes-common';
6
6
  import { JsonObject } from '@backstage/types';
7
7
  import { V1Pod, V1ReplicaSet, V1Deployment, V1HorizontalPodAutoscaler, V1Service, V1ConfigMap, V1Ingress, V1Job, V1CronJob, V1StatefulSet, V1ObjectMeta } from '@kubernetes/client-node';
8
8
  import React from 'react';
9
+ import { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';
10
+ import { Pod } from 'kubernetes-models/v1';
9
11
 
10
12
  declare const kubernetesPlugin: _backstage_core_plugin_api.BackstagePlugin<{
11
13
  entityContent: _backstage_core_plugin_api.RouteRef<undefined>;
@@ -29,6 +31,7 @@ declare const Router: (props: {
29
31
  }) => JSX.Element;
30
32
 
31
33
  declare const kubernetesApiRef: _backstage_core_plugin_api.ApiRef<KubernetesApi>;
34
+ declare const kubernetesProxyApiRef: _backstage_core_plugin_api.ApiRef<KubernetesProxyApi>;
32
35
  interface KubernetesApi {
33
36
  getObjectsByEntity(requestBody: KubernetesRequestBody): Promise<ObjectsByEntityResponse>;
34
37
  getClusters(): Promise<{
@@ -44,6 +47,16 @@ interface KubernetesApi {
44
47
  init?: RequestInit;
45
48
  }): Promise<Response>;
46
49
  }
50
+ interface KubernetesProxyApi {
51
+ getPodLogs(request: {
52
+ podName: string;
53
+ namespace: string;
54
+ clusterName: string;
55
+ containerName: string;
56
+ }): Promise<{
57
+ text: string;
58
+ }>;
59
+ }
47
60
 
48
61
  interface KubernetesAuthProvider {
49
62
  decorateRequestBodyForAuth(requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
@@ -119,6 +132,27 @@ declare class KubernetesBackendClient implements KubernetesApi {
119
132
  }): Promise<Response>;
120
133
  }
121
134
 
135
+ /**
136
+ * A client for common requests through the proxy endpoint of the kubernetes backend plugin.
137
+ *
138
+ * @public
139
+ */
140
+ declare class KubernetesProxyClient {
141
+ private readonly kubernetesApi;
142
+ constructor(options: {
143
+ kubernetesApi: KubernetesApi;
144
+ });
145
+ private handleText;
146
+ getPodLogs({ podName, namespace, clusterName, containerName, }: {
147
+ podName: string;
148
+ namespace: string;
149
+ clusterName: string;
150
+ containerName: string;
151
+ }): Promise<{
152
+ text: string;
153
+ }>;
154
+ }
155
+
122
156
  type FormatClusterLinkOptions = {
123
157
  dashboardUrl?: string;
124
158
  dashboardApp?: string;
@@ -170,13 +204,13 @@ interface CustomResourcesProps {
170
204
  }
171
205
  declare const CustomResources: ({}: CustomResourcesProps) => JSX.Element;
172
206
 
173
- type ErrorPanelProps = {
207
+ type ErrorPanelProps$1 = {
174
208
  entityName: string;
175
209
  errorMessage?: string;
176
210
  clustersWithErrors?: ClusterObjects[];
177
211
  children?: React.ReactNode;
178
212
  };
179
- declare const ErrorPanel: ({ entityName, errorMessage, clustersWithErrors, }: ErrorPanelProps) => JSX.Element;
213
+ declare const ErrorPanel: ({ entityName, errorMessage, clustersWithErrors, }: ErrorPanelProps$1) => JSX.Element;
180
214
 
181
215
  /**
182
216
  * Severity of the error, where 10 is critical and 0 is very low.
@@ -258,10 +292,16 @@ type JobsAccordionsProps = {
258
292
  };
259
293
  declare const JobsAccordions: ({ jobs }: JobsAccordionsProps) => JSX.Element;
260
294
 
295
+ type ErrorPanelProps = {
296
+ cluster: ClusterAttributes;
297
+ errorMessage?: string;
298
+ children?: React.ReactNode;
299
+ };
300
+ declare const LinkErrorPanel: ({ cluster, errorMessage }: ErrorPanelProps) => JSX.Element;
261
301
  interface KubernetesDrawerable {
262
302
  metadata?: V1ObjectMeta;
263
303
  }
264
- interface KubernetesDrawerProps<T extends KubernetesDrawerable> {
304
+ interface KubernetesStructuredMetadataTableDrawerProps<T extends KubernetesDrawerable> {
265
305
  object: T;
266
306
  renderObject: (obj: T) => object;
267
307
  buttonVariant?: 'h5' | 'subtitle2';
@@ -269,13 +309,39 @@ interface KubernetesDrawerProps<T extends KubernetesDrawerable> {
269
309
  expanded?: boolean;
270
310
  children?: React.ReactNode;
271
311
  }
272
- declare const KubernetesDrawer: <T extends KubernetesDrawerable>({ object, renderObject, kind, buttonVariant, expanded, children, }: KubernetesDrawerProps<T>) => JSX.Element;
312
+ declare const KubernetesStructuredMetadataTableDrawer: <T extends KubernetesDrawerable>({ object, renderObject, kind, buttonVariant, expanded, children, }: KubernetesStructuredMetadataTableDrawerProps<T>) => JSX.Element;
273
313
 
274
- /** @public */
275
- declare const PodDrawer: (props: {
276
- pod: V1Pod;
277
- expanded?: boolean;
278
- }) => JSX.Element;
314
+ interface KubernetesObject {
315
+ kind: string;
316
+ metadata?: IObjectMeta;
317
+ }
318
+ interface KubernetesDrawerContentProps {
319
+ close: () => void;
320
+ kubernetesObject: KubernetesObject;
321
+ header?: React.ReactNode;
322
+ children?: React.ReactNode;
323
+ }
324
+ declare const KubernetesDrawerContent: ({ children, header, kubernetesObject, close, }: KubernetesDrawerContentProps) => JSX.Element;
325
+ interface KubernetesDrawerProps {
326
+ open?: boolean;
327
+ kubernetesObject: KubernetesObject;
328
+ label: React.ReactNode;
329
+ drawerContentsHeader?: React.ReactNode;
330
+ children?: React.ReactNode;
331
+ }
332
+ declare const KubernetesDrawer: ({ open, label, drawerContentsHeader, kubernetesObject, children, }: KubernetesDrawerProps) => JSX.Element;
333
+
334
+ interface PodAndErrors {
335
+ clusterName: string;
336
+ pod: Pod;
337
+ errors: any[];
338
+ }
339
+
340
+ interface PodDrawerProps {
341
+ open?: boolean;
342
+ podAndErrors: PodAndErrors;
343
+ }
344
+ declare const PodDrawer: ({ podAndErrors, open }: PodDrawerProps) => JSX.Element;
279
345
 
280
346
  type PodColumns = 'READY' | 'RESOURCE';
281
347
  type PodsTablesProps = {
@@ -317,4 +383,4 @@ declare const GroupedResponsesContext: React.Context<GroupedResponses>;
317
383
 
318
384
  declare const ClusterContext: React.Context<ClusterAttributes>;
319
385
 
320
- export { Cluster, ClusterContext, ClusterLinksFormatter, ClusterLinksFormatterOptions, CronJobsAccordions, CustomResources, DeploymentResources, DetectedError, DetectedErrorsByCluster, EntityKubernetesContent, EntityKubernetesContentProps, ErrorPanel, ErrorReporting, ErrorSeverity, GoogleKubernetesAuthProvider, GroupedResponses, GroupedResponsesContext, HorizontalPodAutoscalerDrawer, IngressesAccordions, JobsAccordions, KubernetesApi, KubernetesAuthProviders, KubernetesAuthProvidersApi, KubernetesBackendClient, KubernetesContent, KubernetesDrawer, KubernetesObjects, PodDrawer, PodNamesWithErrorsContext, PodNamesWithMetricsContext, PodsTable, Router, ServerSideKubernetesAuthProvider, ServicesAccordions, clusterLinksFormatters, detectErrors, formatClusterLink, isKubernetesAvailable, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesPlugin, kubernetesPlugin as plugin, useCustomResources, useKubernetesObjects };
386
+ export { Cluster, ClusterContext, ClusterLinksFormatter, ClusterLinksFormatterOptions, CronJobsAccordions, CustomResources, DeploymentResources, DetectedError, DetectedErrorsByCluster, EntityKubernetesContent, EntityKubernetesContentProps, ErrorPanel, ErrorReporting, ErrorSeverity, GoogleKubernetesAuthProvider, GroupedResponses, GroupedResponsesContext, HorizontalPodAutoscalerDrawer, IngressesAccordions, JobsAccordions, KubernetesApi, KubernetesAuthProviders, KubernetesAuthProvidersApi, KubernetesBackendClient, KubernetesContent, KubernetesDrawer, KubernetesDrawerContent, KubernetesObjects, KubernetesProxyApi, KubernetesProxyClient, KubernetesStructuredMetadataTableDrawer, LinkErrorPanel, PodDrawer, PodNamesWithErrorsContext, PodNamesWithMetricsContext, PodsTable, Router, ServerSideKubernetesAuthProvider, ServicesAccordions, clusterLinksFormatters, detectErrors, formatClusterLink, isKubernetesAvailable, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesPlugin, kubernetesProxyApiRef, kubernetesPlugin as plugin, useCustomResources, useKubernetesObjects };