@backstage/plugin-kubernetes 0.7.10-next.1 → 0.8.0-next.3

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,40 @@
1
1
  # @backstage/plugin-kubernetes
2
2
 
3
+ ## 0.8.0-next.3
4
+
5
+ ### Minor Changes
6
+
7
+ - 754be7c5106: refactor kubernetes error detection to make way for proposed solutions
8
+
9
+ **BREAKING**: `DetectedError` now appears once per Kubernetes resource per error instead of for all resources which have that error, `namespace` and `name` fields are now in `sourceRef` object `message` is now a `string` instead of a `string[]`. `ErrorDetectableKind` has been removed.
10
+
11
+ ### Patch Changes
12
+
13
+ - e7fb0117485: fixes a bug where an empty authorization header was provided to the proxy endpoint when a cluster had a server-side auth provider
14
+ - c159ab64a60: `KubernetesBackendClient` now requires a `kubernetesAuthProvidersApi` value to be provided. `KubernetesApi` interface now has a proxy method requirement.
15
+ - Updated dependencies
16
+ - @backstage/plugin-catalog-react@1.5.0-next.3
17
+ - @backstage/catalog-model@1.3.0-next.0
18
+ - @backstage/core-components@0.13.0-next.3
19
+ - @backstage/config@1.0.7
20
+ - @backstage/core-plugin-api@1.5.1-next.1
21
+ - @backstage/errors@1.1.5
22
+ - @backstage/theme@0.2.19-next.0
23
+ - @backstage/plugin-kubernetes-common@0.6.2-next.2
24
+
25
+ ## 0.7.10-next.2
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+ - @backstage/core-components@0.12.6-next.2
31
+ - @backstage/plugin-catalog-react@1.4.1-next.2
32
+ - @backstage/core-plugin-api@1.5.1-next.1
33
+ - @backstage/catalog-model@1.2.1
34
+ - @backstage/config@1.0.7
35
+ - @backstage/theme@0.2.19-next.0
36
+ - @backstage/plugin-kubernetes-common@0.6.2-next.1
37
+
3
38
  ## 0.7.10-next.1
4
39
 
5
40
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
- import { DiscoveryApi, IdentityApi, OAuthApi, OpenIdConnectApi } from '@backstage/core-plugin-api';
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, CustomResourceMatcher, ClientPodStatus, ClusterAttributes } from '@backstage/plugin-kubernetes-common';
6
6
  import { JsonObject } from '@backstage/types';
@@ -15,7 +15,7 @@ declare const kubernetesPlugin: _backstage_core_plugin_api.BackstagePlugin<{
15
15
  *
16
16
  * @public
17
17
  */
18
- declare type EntityKubernetesContentProps = {
18
+ type EntityKubernetesContentProps = {
19
19
  /**
20
20
  * Sets the refresh interval in milliseconds. The default value is 10000 (10 seconds)
21
21
  */
@@ -38,32 +38,25 @@ interface KubernetesApi {
38
38
  }[]>;
39
39
  getWorkloadsByEntity(request: WorkloadsByEntityRequest): Promise<ObjectsByEntityResponse>;
40
40
  getCustomObjectsByEntity(request: CustomObjectsByEntityRequest): Promise<ObjectsByEntityResponse>;
41
- }
42
-
43
- declare class KubernetesBackendClient implements KubernetesApi {
44
- private readonly discoveryApi;
45
- private readonly identityApi;
46
- constructor(options: {
47
- discoveryApi: DiscoveryApi;
48
- identityApi: IdentityApi;
49
- });
50
- private handleResponse;
51
- private postRequired;
52
- getObjectsByEntity(requestBody: KubernetesRequestBody): Promise<ObjectsByEntityResponse>;
53
- getWorkloadsByEntity(request: WorkloadsByEntityRequest): Promise<ObjectsByEntityResponse>;
54
- getCustomObjectsByEntity(request: CustomObjectsByEntityRequest): Promise<ObjectsByEntityResponse>;
55
- getClusters(): Promise<{
56
- name: string;
57
- authProvider: string;
58
- }[]>;
41
+ proxy(options: {
42
+ clusterName: string;
43
+ path: string;
44
+ init?: RequestInit;
45
+ }): Promise<Response>;
59
46
  }
60
47
 
61
48
  interface KubernetesAuthProvider {
62
49
  decorateRequestBodyForAuth(requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
50
+ getCredentials(): Promise<{
51
+ token?: string;
52
+ }>;
63
53
  }
64
54
  declare const kubernetesAuthProvidersApiRef: _backstage_core_plugin_api.ApiRef<KubernetesAuthProvidersApi>;
65
55
  interface KubernetesAuthProvidersApi {
66
56
  decorateRequestBodyForAuth(authProvider: string, requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
57
+ getCredentials(authProvider: string): Promise<{
58
+ token?: string;
59
+ }>;
67
60
  }
68
61
 
69
62
  declare class KubernetesAuthProviders implements KubernetesAuthProvidersApi {
@@ -75,12 +68,18 @@ declare class KubernetesAuthProviders implements KubernetesAuthProvidersApi {
75
68
  };
76
69
  });
77
70
  decorateRequestBodyForAuth(authProvider: string, requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
71
+ getCredentials(authProvider: string): Promise<{
72
+ token?: string;
73
+ }>;
78
74
  }
79
75
 
80
76
  declare class GoogleKubernetesAuthProvider implements KubernetesAuthProvider {
81
77
  authProvider: OAuthApi;
82
78
  constructor(authProvider: OAuthApi);
83
79
  decorateRequestBodyForAuth(requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
80
+ getCredentials(): Promise<{
81
+ token: string;
82
+ }>;
84
83
  }
85
84
 
86
85
  /**
@@ -90,9 +89,37 @@ declare class GoogleKubernetesAuthProvider implements KubernetesAuthProvider {
90
89
  */
91
90
  declare class ServerSideKubernetesAuthProvider implements KubernetesAuthProvider {
92
91
  decorateRequestBodyForAuth(requestBody: KubernetesRequestBody): Promise<KubernetesRequestBody>;
92
+ getCredentials(): Promise<{}>;
93
+ }
94
+
95
+ declare class KubernetesBackendClient implements KubernetesApi {
96
+ private readonly discoveryApi;
97
+ private readonly identityApi;
98
+ private readonly kubernetesAuthProvidersApi;
99
+ constructor(options: {
100
+ discoveryApi: DiscoveryApi;
101
+ identityApi: IdentityApi;
102
+ kubernetesAuthProvidersApi: KubernetesAuthProvidersApi;
103
+ });
104
+ private handleResponse;
105
+ private postRequired;
106
+ private getCluster;
107
+ private getCredentials;
108
+ getObjectsByEntity(requestBody: KubernetesRequestBody): Promise<ObjectsByEntityResponse>;
109
+ getWorkloadsByEntity(request: WorkloadsByEntityRequest): Promise<ObjectsByEntityResponse>;
110
+ getCustomObjectsByEntity(request: CustomObjectsByEntityRequest): Promise<ObjectsByEntityResponse>;
111
+ getClusters(): Promise<{
112
+ name: string;
113
+ authProvider: string;
114
+ }[]>;
115
+ proxy(options: {
116
+ clusterName: string;
117
+ path: string;
118
+ init?: RequestInit;
119
+ }): Promise<Response>;
93
120
  }
94
121
 
95
- declare type FormatClusterLinkOptions = {
122
+ type FormatClusterLinkOptions = {
96
123
  dashboardUrl?: string;
97
124
  dashboardApp?: string;
98
125
  dashboardParameters?: JsonObject;
@@ -122,18 +149,18 @@ interface ClusterLinksFormatterOptions {
122
149
  object: any;
123
150
  kind: string;
124
151
  }
125
- declare type ClusterLinksFormatter = (options: ClusterLinksFormatterOptions) => URL;
152
+ type ClusterLinksFormatter = (options: ClusterLinksFormatterOptions) => URL;
126
153
 
127
154
  declare const clusterLinksFormatters: Record<string, ClusterLinksFormatter>;
128
155
 
129
- declare type ClusterProps = {
156
+ type ClusterProps = {
130
157
  clusterObjects: ClusterObjects;
131
158
  podsWithErrors: Set<string>;
132
159
  children?: React.ReactNode;
133
160
  };
134
161
  declare const Cluster: ({ clusterObjects, podsWithErrors }: ClusterProps) => JSX.Element;
135
162
 
136
- declare type CronJobsAccordionsProps = {
163
+ type CronJobsAccordionsProps = {
137
164
  children?: React.ReactNode;
138
165
  };
139
166
  declare const CronJobsAccordions: ({}: CronJobsAccordionsProps) => JSX.Element;
@@ -143,7 +170,7 @@ interface CustomResourcesProps {
143
170
  }
144
171
  declare const CustomResources: ({}: CustomResourcesProps) => JSX.Element;
145
172
 
146
- declare type ErrorPanelProps = {
173
+ type ErrorPanelProps = {
147
174
  entityName: string;
148
175
  errorMessage?: string;
149
176
  clustersWithErrors?: ClusterObjects[];
@@ -156,31 +183,50 @@ declare const ErrorPanel: ({ entityName, errorMessage, clustersWithErrors, }: Er
156
183
  *
157
184
  * @public
158
185
  */
159
- declare type ErrorSeverity = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
160
- /**
161
- * Kubernetes kinds that errors might be reported by the plugin
162
- *
163
- * @public
164
- */
165
- declare type ErrorDetectableKind = 'Pod' | 'Deployment' | 'HorizontalPodAutoscaler';
186
+ type ErrorSeverity = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
166
187
  /**
167
188
  * A list of errors keyed by Cluster name
168
189
  *
169
190
  * @public
170
191
  */
171
- declare type DetectedErrorsByCluster = Map<string, DetectedError[]>;
192
+ type DetectedErrorsByCluster = Map<string, DetectedError[]>;
193
+ interface ResourceRef {
194
+ name: string;
195
+ namespace: string;
196
+ kind: string;
197
+ apiGroup: string;
198
+ }
172
199
  /**
173
200
  * Represents an error found on a Kubernetes object
174
201
  *
175
202
  * @public
176
203
  */
177
204
  interface DetectedError {
205
+ type: string;
178
206
  severity: ErrorSeverity;
179
- cluster: string;
180
- namespace: string;
181
- kind: ErrorDetectableKind;
182
- names: string[];
183
- message: string[];
207
+ message: string;
208
+ proposedFix: ProposedFix[];
209
+ sourceRef: ResourceRef;
210
+ occuranceCount: number;
211
+ }
212
+ type ProposedFix = LogSolution | DocsSolution | EventsSolution;
213
+ interface ProposedFixBase {
214
+ errorType: string;
215
+ rootCauseExplanation: string;
216
+ possibleFixes: string[];
217
+ }
218
+ interface LogSolution extends ProposedFixBase {
219
+ type: 'logs';
220
+ container: string;
221
+ }
222
+ interface DocsSolution extends ProposedFixBase {
223
+ type: 'docs';
224
+ docsLink: string;
225
+ }
226
+ interface EventsSolution extends ProposedFixBase {
227
+ type: 'events';
228
+ docsLink: string;
229
+ podName: string;
184
230
  }
185
231
 
186
232
  /**
@@ -191,7 +237,7 @@ interface DetectedError {
191
237
  */
192
238
  declare const detectErrors: (objects: ObjectsByEntityResponse) => DetectedErrorsByCluster;
193
239
 
194
- declare type ErrorReportingProps = {
240
+ type ErrorReportingProps = {
195
241
  detectedErrors: DetectedErrorsByCluster;
196
242
  };
197
243
  declare const ErrorReporting: ({ detectedErrors }: ErrorReportingProps) => JSX.Element;
@@ -203,10 +249,10 @@ declare const HorizontalPodAutoscalerDrawer: (props: {
203
249
  children?: React.ReactNode;
204
250
  }) => JSX.Element;
205
251
 
206
- declare type IngressesAccordionsProps = {};
252
+ type IngressesAccordionsProps = {};
207
253
  declare const IngressesAccordions: ({}: IngressesAccordionsProps) => JSX.Element;
208
254
 
209
- declare type JobsAccordionsProps = {
255
+ type JobsAccordionsProps = {
210
256
  jobs: V1Job[];
211
257
  children?: React.ReactNode;
212
258
  };
@@ -231,18 +277,18 @@ declare const PodDrawer: (props: {
231
277
  expanded?: boolean;
232
278
  }) => JSX.Element;
233
279
 
234
- declare type PodColumns = 'READY' | 'RESOURCE';
235
- declare type PodsTablesProps = {
280
+ type PodColumns = 'READY' | 'RESOURCE';
281
+ type PodsTablesProps = {
236
282
  pods: V1Pod[];
237
283
  extraColumns?: PodColumns[];
238
284
  children?: React.ReactNode;
239
285
  };
240
286
  declare const PodsTable: ({ pods, extraColumns }: PodsTablesProps) => JSX.Element;
241
287
 
242
- declare type ServicesAccordionsProps = {};
288
+ type ServicesAccordionsProps = {};
243
289
  declare const ServicesAccordions: ({}: ServicesAccordionsProps) => JSX.Element;
244
290
 
245
- declare type KubernetesContentProps = {
291
+ type KubernetesContentProps = {
246
292
  entity: Entity;
247
293
  refreshIntervalMs?: number;
248
294
  children?: React.ReactNode;
@@ -271,4 +317,4 @@ declare const GroupedResponsesContext: React.Context<GroupedResponses>;
271
317
 
272
318
  declare const ClusterContext: React.Context<ClusterAttributes>;
273
319
 
274
- export { Cluster, ClusterContext, ClusterLinksFormatter, ClusterLinksFormatterOptions, CronJobsAccordions, CustomResources, DeploymentResources, DetectedError, DetectedErrorsByCluster, EntityKubernetesContent, EntityKubernetesContentProps, ErrorDetectableKind, 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 };
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 };