@backstage/plugin-kubernetes 0.9.2-next.1 → 0.9.2-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,17 @@
1
1
  # @backstage/plugin-kubernetes
2
2
 
3
+ ## 0.9.2-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 73cc0deee48a: Add proposed fix dialog for pod errors
8
+ - Updated dependencies
9
+ - @backstage/theme@0.4.0-next.1
10
+ - @backstage/plugin-catalog-react@1.7.0-next.2
11
+ - @backstage/core-components@0.13.2-next.2
12
+ - @backstage/config@1.0.7
13
+ - @backstage/core-plugin-api@1.5.2-next.0
14
+
3
15
  ## 0.9.2-next.1
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -3,11 +3,13 @@ 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
5
  import { KubernetesRequestBody, ObjectsByEntityResponse, WorkloadsByEntityRequest, CustomObjectsByEntityRequest, ClusterObjects, ClusterAttributes, CustomResourceMatcher, ClientPodStatus } from '@backstage/plugin-kubernetes-common';
6
+ import * as kubernetes_models_v1 from 'kubernetes-models/v1';
7
+ import { Event, Pod, IContainer, IContainerStatus } from 'kubernetes-models/v1';
6
8
  import { JsonObject } from '@backstage/types';
7
9
  import { V1Pod, V1ReplicaSet, V1Deployment, V1HorizontalPodAutoscaler, V1Service, V1ConfigMap, V1Ingress, V1Job, V1CronJob, V1StatefulSet, V1ObjectMeta } from '@kubernetes/client-node';
8
10
  import React from 'react';
9
11
  import { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';
10
- import { Pod } from 'kubernetes-models/v1';
12
+ import * as react_use_lib_useAsyncFn from 'react-use/lib/useAsyncFn';
11
13
  import { Pod as Pod$1 } from 'kubernetes-models/v1/Pod';
12
14
 
13
15
  declare const kubernetesPlugin: _backstage_core_plugin_api.BackstagePlugin<{
@@ -54,9 +56,15 @@ interface KubernetesProxyApi {
54
56
  namespace: string;
55
57
  clusterName: string;
56
58
  containerName: string;
59
+ previous?: boolean;
57
60
  }): Promise<{
58
61
  text: string;
59
62
  }>;
63
+ getEventsByInvolvedObjectName(request: {
64
+ clusterName: string;
65
+ involvedObjectName: string;
66
+ namespace: string;
67
+ }): Promise<Event[]>;
60
68
  }
61
69
 
62
70
  interface KubernetesAuthProvider {
@@ -145,11 +153,18 @@ declare class KubernetesProxyClient {
145
153
  kubernetesApi: KubernetesApi;
146
154
  });
147
155
  private handleText;
148
- getPodLogs({ podName, namespace, clusterName, containerName, }: {
156
+ private handleJson;
157
+ getEventsByInvolvedObjectName({ clusterName, involvedObjectName, namespace, }: {
158
+ clusterName: string;
159
+ involvedObjectName: string;
160
+ namespace: string;
161
+ }): Promise<Event[]>;
162
+ getPodLogs({ podName, namespace, clusterName, containerName, previous, }: {
149
163
  podName: string;
150
164
  namespace: string;
151
165
  clusterName: string;
152
166
  containerName: string;
167
+ previous?: boolean;
153
168
  }): Promise<{
154
169
  text: string;
155
170
  }>;
@@ -241,7 +256,7 @@ interface DetectedError {
241
256
  type: string;
242
257
  severity: ErrorSeverity;
243
258
  message: string;
244
- proposedFix: ProposedFix[];
259
+ proposedFix?: ProposedFix;
245
260
  sourceRef: ResourceRef;
246
261
  occuranceCount: number;
247
262
  }
@@ -249,7 +264,7 @@ type ProposedFix = LogSolution | DocsSolution | EventsSolution;
249
264
  interface ProposedFixBase {
250
265
  errorType: string;
251
266
  rootCauseExplanation: string;
252
- possibleFixes: string[];
267
+ actions: string[];
253
268
  }
254
269
  interface LogSolution extends ProposedFixBase {
255
270
  type: 'logs';
@@ -261,7 +276,6 @@ interface DocsSolution extends ProposedFixBase {
261
276
  }
262
277
  interface EventsSolution extends ProposedFixBase {
263
278
  type: 'events';
264
- docsLink: string;
265
279
  podName: string;
266
280
  }
267
281
 
@@ -333,18 +347,216 @@ interface KubernetesDrawerProps {
333
347
  }
334
348
  declare const KubernetesDrawer: ({ open, label, drawerContentsHeader, kubernetesObject, children, }: KubernetesDrawerProps) => JSX.Element;
335
349
 
350
+ /**
351
+ * Wraps a pod with the associated detected errors and cluster name
352
+ *
353
+ * @public
354
+ */
336
355
  interface PodAndErrors {
337
356
  clusterName: string;
338
357
  pod: Pod;
339
358
  errors: DetectedError[];
340
359
  }
341
360
 
361
+ /**
362
+ * Props for PodDrawer
363
+ *
364
+ * @public
365
+ */
342
366
  interface PodDrawerProps {
343
367
  open?: boolean;
344
368
  podAndErrors: PodAndErrors;
345
369
  }
370
+ /**
371
+ * A Drawer for Kubernetes Pods
372
+ *
373
+ * @public
374
+ */
346
375
  declare const PodDrawer: ({ podAndErrors, open }: PodDrawerProps) => JSX.Element;
347
376
 
377
+ /**
378
+ * Contains the details needed to make a log request to Kubernetes, except the container name
379
+ *
380
+ * @public
381
+ */
382
+ interface PodScope {
383
+ podName: string;
384
+ podNamespace: string;
385
+ clusterName: string;
386
+ }
387
+ /**
388
+ * Contains the details needed to make a log request to Kubernetes
389
+ *
390
+ * @public
391
+ */
392
+ interface ContainerScope extends PodScope {
393
+ containerName: string;
394
+ }
395
+
396
+ /**
397
+ * Props for PodLogs
398
+ *
399
+ * @public
400
+ */
401
+ interface PodLogsProps {
402
+ containerScope: ContainerScope;
403
+ previous?: boolean;
404
+ }
405
+ /**
406
+ * Shows the logs for the given pod
407
+ *
408
+ * @public
409
+ */
410
+ declare const PodLogs: React.FC<PodLogsProps>;
411
+
412
+ /**
413
+ * Props for PodLogsDialog
414
+ *
415
+ * @public
416
+ */
417
+ interface PodLogsDialogProps {
418
+ containerScope: ContainerScope;
419
+ }
420
+ /**
421
+ * Shows the logs for the given pod in a Dialog
422
+ *
423
+ * @public
424
+ */
425
+ declare const PodLogsDialog: ({ containerScope }: PodLogsDialogProps) => JSX.Element;
426
+
427
+ /**
428
+ * Arguments for usePodLogs
429
+ *
430
+ * @public
431
+ */
432
+ interface PodLogsOptions {
433
+ containerScope: ContainerScope;
434
+ previous?: boolean;
435
+ }
436
+ /**
437
+ * Retrieves the logs for the given pod
438
+ *
439
+ * @public
440
+ */
441
+ declare const usePodLogs: ({ containerScope, previous }: PodLogsOptions) => react_use_lib_useAsyncFn.AsyncState<{
442
+ text: string;
443
+ }>;
444
+
445
+ /**
446
+ * Props for ContainerCard
447
+ *
448
+ * @public
449
+ */
450
+ interface ContainerCardProps {
451
+ podScope: PodScope;
452
+ containerSpec?: IContainer;
453
+ containerStatus: IContainerStatus;
454
+ }
455
+ /**
456
+ * Shows details about a container within a pod
457
+ *
458
+ * @public
459
+ */
460
+ declare const ContainerCard: React.FC<ContainerCardProps>;
461
+
462
+ /**
463
+ * Props for PendingPodContent
464
+ *
465
+ * @public
466
+ */
467
+ interface PendingPodContentProps {
468
+ pod: Pod;
469
+ }
470
+ /**
471
+ * Shows details about pod's conditions as it starts
472
+ *
473
+ * @public
474
+ */
475
+ declare const PendingPodContent: ({ pod }: PendingPodContentProps) => JSX.Element;
476
+
477
+ /**
478
+ * Props for FixDialog
479
+ *
480
+ * @public
481
+ */
482
+ interface FixDialogProps {
483
+ open?: boolean;
484
+ clusterName: string;
485
+ pod: Pod$1;
486
+ error: DetectedError;
487
+ }
488
+ /**
489
+ * A dialog for fixing detected Kubernetes errors
490
+ *
491
+ * @public
492
+ */
493
+ declare const FixDialog: React.FC<FixDialogProps>;
494
+
495
+ /**
496
+ * Props for Events
497
+ *
498
+ * @public
499
+ */
500
+ interface EventsContentProps {
501
+ warningEventsOnly?: boolean;
502
+ events: Event[];
503
+ }
504
+ /**
505
+ * Shows given Kubernetes events
506
+ *
507
+ * @public
508
+ */
509
+ declare const EventsContent: ({ events, warningEventsOnly, }: EventsContentProps) => JSX.Element;
510
+ /**
511
+ * Props for Events
512
+ *
513
+ * @public
514
+ */
515
+ interface EventsProps {
516
+ involvedObjectName: string;
517
+ namespace: string;
518
+ clusterName: string;
519
+ warningEventsOnly?: boolean;
520
+ }
521
+ /**
522
+ * Retrieves and shows Kubernetes events for the given object
523
+ *
524
+ * @public
525
+ */
526
+ declare const Events: ({ involvedObjectName, namespace, clusterName, warningEventsOnly, }: EventsProps) => JSX.Element;
527
+
528
+ /**
529
+ * Arguments for useEvents
530
+ *
531
+ * @public
532
+ */
533
+ interface EventsOptions {
534
+ involvedObjectName: string;
535
+ namespace: string;
536
+ clusterName: string;
537
+ }
538
+ /**
539
+ * Retrieves the events for the given object
540
+ *
541
+ * @public
542
+ */
543
+ declare const useEvents: ({ involvedObjectName, namespace, clusterName, }: EventsOptions) => react_use_lib_useAsyncFn.AsyncState<kubernetes_models_v1.Event[]>;
544
+
545
+ /**
546
+ * Props for ErrorList
547
+ *
548
+ * @public
549
+ */
550
+ interface ErrorListProps {
551
+ podAndErrors: PodAndErrors[];
552
+ }
553
+ /**
554
+ * Shows a list of errors found on a Pod
555
+ *
556
+ * @public
557
+ */
558
+ declare const ErrorList: ({ podAndErrors }: ErrorListProps) => JSX.Element;
559
+
348
560
  type PodColumns = 'READY' | 'RESOURCE';
349
561
  type PodsTablesProps = {
350
562
  pods: Pod$1 | V1Pod[];
@@ -385,4 +597,4 @@ declare const GroupedResponsesContext: React.Context<GroupedResponses>;
385
597
 
386
598
  declare const ClusterContext: React.Context<ClusterAttributes>;
387
599
 
388
- 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 };
600
+ export { Cluster, ClusterContext, ClusterLinksFormatter, ClusterLinksFormatterOptions, ContainerCard, ContainerCardProps, ContainerScope, CronJobsAccordions, CustomResources, DeploymentResources, DetectedError, DetectedErrorsByCluster, EntityKubernetesContent, EntityKubernetesContentProps, ErrorList, ErrorListProps, ErrorPanel, ErrorReporting, ErrorSeverity, Events, EventsContent, EventsContentProps, EventsOptions, EventsProps, FixDialog, FixDialogProps, GoogleKubernetesAuthProvider, GroupedResponses, GroupedResponsesContext, HorizontalPodAutoscalerDrawer, IngressesAccordions, JobsAccordions, KubernetesApi, KubernetesAuthProviders, KubernetesAuthProvidersApi, KubernetesBackendClient, KubernetesContent, KubernetesDrawer, KubernetesDrawerContent, KubernetesObjects, KubernetesProxyApi, KubernetesProxyClient, KubernetesStructuredMetadataTableDrawer, LinkErrorPanel, PendingPodContent, PendingPodContentProps, PodAndErrors, PodDrawer, PodLogs, PodLogsDialog, PodLogsDialogProps, PodLogsOptions, PodLogsProps, PodNamesWithErrorsContext, PodNamesWithMetricsContext, PodScope, PodsTable, Router, ServerSideKubernetesAuthProvider, ServicesAccordions, clusterLinksFormatters, detectErrors, formatClusterLink, isKubernetesAvailable, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesPlugin, kubernetesProxyApiRef, kubernetesPlugin as plugin, useCustomResources, useEvents, useKubernetesObjects, usePodLogs };