@backstage/plugin-kubernetes-backend 0.14.0-next.3 → 0.14.1-next.0

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/dist/index.d.ts CHANGED
@@ -1,202 +1,102 @@
1
- import { Entity } from '@backstage/catalog-model';
2
1
  import { Logger } from 'winston';
3
- import { JsonObject } from '@backstage/types';
4
- import { KubernetesRequestAuth, KubernetesFetchError, FetchResponse, CustomResourceMatcher, KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';
2
+ import { KubernetesRequestBody, KubernetesRequestAuth } from '@backstage/plugin-kubernetes-common';
5
3
  import { Config } from '@backstage/config';
4
+ import * as k8sTypes from '@backstage/plugin-kubernetes-node';
5
+ import { KubernetesClustersSupplier as KubernetesClustersSupplier$1, KubernetesObjectsProvider as KubernetesObjectsProvider$1 } from '@backstage/plugin-kubernetes-node';
6
6
  import { TokenCredential } from '@azure/identity';
7
7
  import { CatalogApi } from '@backstage/catalog-client';
8
8
  import { PermissionEvaluator } from '@backstage/plugin-permission-common';
9
9
  import express from 'express';
10
10
  import { Duration } from 'luxon';
11
- import { KubernetesObjectsProvider } from '@backstage/plugin-kubernetes-node';
12
- export { CustomResourcesByEntity, KubernetesObjectsByEntity, KubernetesObjectsProvider } from '@backstage/plugin-kubernetes-node';
13
11
  import { RequestHandler } from 'http-proxy-middleware';
14
12
  import { PluginEndpointDiscovery } from '@backstage/backend-common';
15
13
 
16
14
  /**
17
- * Authentication data used to make a request to Kubernetes
15
+ *
18
16
  * @public
19
17
  */
20
- type KubernetesCredential = {
21
- type: 'bearer token';
22
- token: string;
23
- } | {
24
- type: 'anonymous';
25
- };
18
+ type ServiceLocatorMethod = 'multiTenant' | 'singleTenant' | 'http';
26
19
  /**
27
20
  *
28
21
  * @public
29
22
  */
30
- interface AuthenticationStrategy {
31
- getCredential(clusterDetails: ClusterDetails, authConfig: KubernetesRequestAuth): Promise<KubernetesCredential>;
32
- validateCluster(authMetadata: AuthMetadata): Error[];
23
+ interface KubernetesObjectsProviderOptions {
24
+ logger: Logger;
25
+ config: Config;
26
+ fetcher: k8sTypes.KubernetesFetcher;
27
+ serviceLocator: k8sTypes.KubernetesServiceLocator;
28
+ customResources: k8sTypes.CustomResource[];
29
+ objectTypesToFetch?: k8sTypes.ObjectToFetch[];
33
30
  }
34
-
35
31
  /**
36
32
  *
37
33
  * @public
38
34
  */
39
- interface ObjectFetchParams {
40
- serviceId: string;
41
- clusterDetails: ClusterDetails;
42
- credential: KubernetesCredential;
43
- objectTypesToFetch: Set<ObjectToFetch>;
44
- labelSelector?: string;
45
- customResources: CustomResource[];
46
- namespace?: string;
47
- }
35
+ type ObjectsByEntityRequest = KubernetesRequestBody;
48
36
  /**
49
- * Fetches information from a kubernetes cluster using the cluster details object to target a specific cluster
50
- *
51
- * @public
37
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
52
38
  */
53
- interface KubernetesFetcher {
54
- fetchObjectsForService(params: ObjectFetchParams): Promise<FetchResponseWrapper>;
55
- fetchPodMetricsByNamespaces(clusterDetails: ClusterDetails, credential: KubernetesCredential, namespaces: Set<string>, labelSelector?: string): Promise<FetchResponseWrapper>;
56
- }
39
+ type KubernetesObjectsProvider = k8sTypes.KubernetesObjectsProvider;
57
40
  /**
58
- *
59
- * @public
41
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
60
42
  */
61
- interface FetchResponseWrapper {
62
- errors: KubernetesFetchError[];
63
- responses: FetchResponse[];
64
- }
43
+ type CustomResourcesByEntity = k8sTypes.CustomResourcesByEntity;
65
44
  /**
66
- *
67
45
  * @public
46
+ * @deprecated Import it from \@backstage/plugin-kubernetes-node instead
68
47
  */
69
- interface ObjectToFetch {
70
- objectType: KubernetesObjectTypes;
71
- group: string;
72
- apiVersion: string;
73
- plural: string;
74
- }
48
+ type AuthMetadata = k8sTypes.AuthMetadata;
75
49
  /**
76
- *
77
50
  * @public
51
+ * @deprecated Import it from \@backstage/plugin-kubernetes-node instead
78
52
  */
79
- interface CustomResource extends ObjectToFetch {
80
- objectType: 'customresources';
81
- }
53
+ type ClusterDetails = k8sTypes.ClusterDetails;
82
54
  /**
83
- *
84
55
  * @public
56
+ * @deprecated Import it from \@backstage/plugin-kubernetes-node instead
85
57
  */
86
- type KubernetesObjectTypes = 'pods' | 'services' | 'configmaps' | 'deployments' | 'limitranges' | 'resourcequotas' | 'replicasets' | 'horizontalpodautoscalers' | 'jobs' | 'cronjobs' | 'ingresses' | 'customresources' | 'statefulsets' | 'daemonsets';
58
+ type KubernetesClustersSupplier = k8sTypes.KubernetesClustersSupplier;
87
59
  /**
88
- * Used to load cluster details from different sources
89
- * @public
60
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
90
61
  */
91
- interface KubernetesClustersSupplier {
92
- /**
93
- * Returns the cached list of clusters.
94
- *
95
- * Implementations _should_ cache the clusters and refresh them periodically,
96
- * as getClusters is called whenever the list of clusters is needed.
97
- */
98
- getClusters(): Promise<ClusterDetails[]>;
99
- }
62
+ type KubernetesObjectTypes = k8sTypes.KubernetesObjectTypes;
100
63
  /**
101
- * @public
64
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
102
65
  */
103
- interface ServiceLocatorRequestContext {
104
- objectTypesToFetch: Set<ObjectToFetch>;
105
- customResources: CustomResourceMatcher[];
106
- }
66
+ type ObjectToFetch = k8sTypes.ObjectToFetch;
107
67
  /**
108
- * Used to locate which cluster(s) a service is running on
109
- * @public
68
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
110
69
  */
111
- interface KubernetesServiceLocator {
112
- getClustersByEntity(entity: Entity, requestContext: ServiceLocatorRequestContext): Promise<{
113
- clusters: ClusterDetails[];
114
- }>;
115
- }
70
+ type CustomResource = k8sTypes.CustomResource;
116
71
  /**
117
- *
118
- * @public
72
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
119
73
  */
120
- type ServiceLocatorMethod = 'multiTenant' | 'singleTenant' | 'http';
74
+ type ObjectFetchParams = k8sTypes.ObjectFetchParams;
121
75
  /**
122
- * Provider-specific authentication configuration
123
- * @public
76
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
124
77
  */
125
- type AuthMetadata = Record<string, string>;
78
+ type FetchResponseWrapper = k8sTypes.FetchResponseWrapper;
126
79
  /**
127
- *
128
- * @public
80
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
129
81
  */
130
- interface ClusterDetails {
131
- /**
132
- * Specifies the name of the Kubernetes cluster.
133
- */
134
- name: string;
135
- url: string;
136
- authMetadata: AuthMetadata;
137
- skipTLSVerify?: boolean;
138
- /**
139
- * Whether to skip the lookup to the metrics server to retrieve pod resource usage.
140
- * It is not guaranteed that the Kubernetes distro has the metrics server installed.
141
- */
142
- skipMetricsLookup?: boolean;
143
- caData?: string | undefined;
144
- caFile?: string | undefined;
145
- /**
146
- * Specifies the link to the Kubernetes dashboard managing this cluster.
147
- * @remarks
148
- * Note that you should specify the app used for the dashboard
149
- * using the dashboardApp property, in order to properly format
150
- * links to kubernetes resources, otherwise it will assume that you're running the standard one.
151
- * @see dashboardApp
152
- * @see dashboardParameters
153
- */
154
- dashboardUrl?: string;
155
- /**
156
- * Specifies the app that provides the Kubernetes dashboard.
157
- * This will be used for formatting links to kubernetes objects inside the dashboard.
158
- * @remarks
159
- * The existing apps are: standard, rancher, openshift, gke, aks, eks
160
- * Note that it will default to the regular dashboard provided by the Kubernetes project (standard).
161
- * Note that you can add your own formatter by registering it to the clusterLinksFormatters dictionary.
162
- * @defaultValue standard
163
- * @see dashboardUrl
164
- * @example
165
- * ```ts
166
- * import { clusterLinksFormatters } from '@backstage/plugin-kubernetes';
167
- * clusterLinksFormatters.myDashboard = (options) => ...;
168
- * ```
169
- */
170
- dashboardApp?: string;
171
- /**
172
- * Specifies specific parameters used by some dashboard URL formatters.
173
- * This is used by the GKE formatter which requires the project, region and cluster name.
174
- * @see dashboardApp
175
- */
176
- dashboardParameters?: JsonObject;
177
- /**
178
- * Specifies which custom resources to look for when returning an entity's
179
- * Kubernetes resources.
180
- */
181
- customResources?: CustomResourceMatcher[];
182
- }
82
+ type KubernetesFetcher = k8sTypes.KubernetesFetcher;
183
83
  /**
184
- *
185
- * @public
84
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
186
85
  */
187
- interface KubernetesObjectsProviderOptions {
188
- logger: Logger;
189
- config: Config;
190
- fetcher: KubernetesFetcher;
191
- serviceLocator: KubernetesServiceLocator;
192
- customResources: CustomResource[];
193
- objectTypesToFetch?: ObjectToFetch[];
194
- }
86
+ type ServiceLocatorRequestContext = k8sTypes.ServiceLocatorRequestContext;
195
87
  /**
196
- *
197
- * @public
88
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
198
89
  */
199
- type ObjectsByEntityRequest = KubernetesRequestBody;
90
+ type KubernetesServiceLocator = k8sTypes.KubernetesServiceLocator;
91
+
92
+ /**
93
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
94
+ */
95
+ type AuthenticationStrategy = k8sTypes.AuthenticationStrategy;
96
+ /**
97
+ * @public @deprecated Import it from \@backstage/plugin-kubernetes-node instead
98
+ */
99
+ type KubernetesCredential = k8sTypes.KubernetesCredential;
200
100
 
201
101
  /**
202
102
  *
@@ -378,11 +278,11 @@ interface KubernetesEnvironment {
378
278
  */
379
279
  type KubernetesBuilderReturn = Promise<{
380
280
  router: express.Router;
381
- clusterSupplier: KubernetesClustersSupplier;
281
+ clusterSupplier: KubernetesClustersSupplier$1;
382
282
  customResources: CustomResource[];
383
283
  fetcher: KubernetesFetcher;
384
284
  proxy: KubernetesProxy;
385
- objectsProvider: KubernetesObjectsProvider;
285
+ objectsProvider: KubernetesObjectsProvider$1;
386
286
  serviceLocator: KubernetesServiceLocator;
387
287
  authStrategyMap: {
388
288
  [key: string]: AuthenticationStrategy;
@@ -404,9 +304,9 @@ declare class KubernetesBuilder {
404
304
  static createBuilder(env: KubernetesEnvironment): KubernetesBuilder;
405
305
  constructor(env: KubernetesEnvironment);
406
306
  build(): KubernetesBuilderReturn;
407
- setClusterSupplier(clusterSupplier?: KubernetesClustersSupplier): this;
307
+ setClusterSupplier(clusterSupplier?: KubernetesClustersSupplier$1): this;
408
308
  setDefaultClusterRefreshInterval(refreshInterval: Duration): this;
409
- setObjectsProvider(objectsProvider?: KubernetesObjectsProvider): this;
309
+ setObjectsProvider(objectsProvider?: KubernetesObjectsProvider$1): this;
410
310
  setFetcher(fetcher?: KubernetesFetcher): this;
411
311
  setServiceLocator(serviceLocator?: KubernetesServiceLocator): this;
412
312
  setProxy(proxy?: KubernetesProxy): this;
@@ -414,29 +314,29 @@ declare class KubernetesBuilder {
414
314
  [key: string]: AuthenticationStrategy;
415
315
  }): void;
416
316
  addAuthStrategy(key: string, strategy: AuthenticationStrategy): this;
417
- protected buildCustomResources(): CustomResource[];
418
- protected buildClusterSupplier(refreshInterval: Duration): KubernetesClustersSupplier;
419
- protected buildObjectsProvider(options: KubernetesObjectsProviderOptions): KubernetesObjectsProvider;
317
+ protected buildCustomResources(): k8sTypes.CustomResource[];
318
+ protected buildClusterSupplier(refreshInterval: Duration): KubernetesClustersSupplier$1;
319
+ protected buildObjectsProvider(options: KubernetesObjectsProviderOptions): KubernetesObjectsProvider$1;
420
320
  protected buildFetcher(): KubernetesFetcher;
421
- protected buildServiceLocator(method: ServiceLocatorMethod, clusterSupplier: KubernetesClustersSupplier): KubernetesServiceLocator;
422
- protected buildMultiTenantServiceLocator(clusterSupplier: KubernetesClustersSupplier): KubernetesServiceLocator;
423
- protected buildSingleTenantServiceLocator(clusterSupplier: KubernetesClustersSupplier): KubernetesServiceLocator;
424
- protected buildHttpServiceLocator(_clusterSupplier: KubernetesClustersSupplier): KubernetesServiceLocator;
425
- protected buildProxy(logger: Logger, clusterSupplier: KubernetesClustersSupplier): KubernetesProxy;
426
- protected buildRouter(objectsProvider: KubernetesObjectsProvider, clusterSupplier: KubernetesClustersSupplier, catalogApi: CatalogApi, proxy: KubernetesProxy, permissionApi: PermissionEvaluator): express.Router;
321
+ protected buildServiceLocator(method: ServiceLocatorMethod, clusterSupplier: KubernetesClustersSupplier$1): KubernetesServiceLocator;
322
+ protected buildMultiTenantServiceLocator(clusterSupplier: KubernetesClustersSupplier$1): KubernetesServiceLocator;
323
+ protected buildSingleTenantServiceLocator(clusterSupplier: KubernetesClustersSupplier$1): KubernetesServiceLocator;
324
+ protected buildHttpServiceLocator(_clusterSupplier: KubernetesClustersSupplier$1): KubernetesServiceLocator;
325
+ protected buildProxy(logger: Logger, clusterSupplier: KubernetesClustersSupplier$1): KubernetesProxy;
326
+ protected buildRouter(objectsProvider: KubernetesObjectsProvider$1, clusterSupplier: KubernetesClustersSupplier$1, catalogApi: CatalogApi, proxy: KubernetesProxy, permissionApi: PermissionEvaluator): express.Router;
427
327
  protected buildAuthStrategyMap(): {
428
- [key: string]: AuthenticationStrategy;
328
+ [key: string]: k8sTypes.AuthenticationStrategy;
429
329
  };
430
- protected fetchClusterDetails(clusterSupplier: KubernetesClustersSupplier): Promise<ClusterDetails[]>;
330
+ protected fetchClusterDetails(clusterSupplier: KubernetesClustersSupplier$1): Promise<k8sTypes.ClusterDetails[]>;
431
331
  protected getServiceLocatorMethod(): ServiceLocatorMethod;
432
332
  protected getFetcher(): KubernetesFetcher;
433
- protected getClusterSupplier(): KubernetesClustersSupplier;
333
+ protected getClusterSupplier(): KubernetesClustersSupplier$1;
434
334
  protected getServiceLocator(): KubernetesServiceLocator;
435
- protected getObjectsProvider(options: KubernetesObjectsProviderOptions): KubernetesObjectsProvider;
436
- protected getObjectTypesToFetch(): ObjectToFetch[] | undefined;
437
- protected getProxy(logger: Logger, clusterSupplier: KubernetesClustersSupplier): KubernetesProxy;
335
+ protected getObjectsProvider(options: KubernetesObjectsProviderOptions): KubernetesObjectsProvider$1;
336
+ protected getObjectTypesToFetch(): k8sTypes.ObjectToFetch[] | undefined;
337
+ protected getProxy(logger: Logger, clusterSupplier: KubernetesClustersSupplier$1): KubernetesProxy;
438
338
  protected getAuthStrategyMap(): {
439
- [key: string]: AuthenticationStrategy;
339
+ [key: string]: k8sTypes.AuthenticationStrategy;
440
340
  };
441
341
  }
442
342
 
@@ -475,4 +375,4 @@ interface RouterOptions {
475
375
  */
476
376
  declare function createRouter(options: RouterOptions): Promise<express.Router>;
477
377
 
478
- export { AksStrategy, AnonymousStrategy, AuthMetadata, AuthenticationStrategy, AwsIamStrategy, AzureIdentityStrategy, ClusterDetails, CustomResource, DEFAULT_OBJECTS, DispatchStrategy, DispatchStrategyOptions, FetchResponseWrapper, GoogleServiceAccountStrategy, GoogleStrategy, HEADER_KUBERNETES_AUTH, HEADER_KUBERNETES_CLUSTER, KubernetesBuilder, KubernetesBuilderReturn, KubernetesClustersSupplier, KubernetesCredential, KubernetesEnvironment, KubernetesFetcher, KubernetesObjectTypes, KubernetesObjectsProviderOptions, KubernetesProxy, KubernetesProxyCreateRequestHandlerOptions, KubernetesProxyOptions, KubernetesServiceLocator, ObjectFetchParams, ObjectToFetch, ObjectsByEntityRequest, OidcStrategy, RouterOptions, ServiceAccountStrategy, ServiceLocatorMethod, ServiceLocatorRequestContext, SigningCreds, createRouter };
378
+ export { AksStrategy, AnonymousStrategy, AuthMetadata, AuthenticationStrategy, AwsIamStrategy, AzureIdentityStrategy, ClusterDetails, CustomResource, CustomResourcesByEntity, DEFAULT_OBJECTS, DispatchStrategy, DispatchStrategyOptions, FetchResponseWrapper, GoogleServiceAccountStrategy, GoogleStrategy, HEADER_KUBERNETES_AUTH, HEADER_KUBERNETES_CLUSTER, KubernetesBuilder, KubernetesBuilderReturn, KubernetesClustersSupplier, KubernetesCredential, KubernetesEnvironment, KubernetesFetcher, KubernetesObjectTypes, KubernetesObjectsProvider, KubernetesObjectsProviderOptions, KubernetesProxy, KubernetesProxyCreateRequestHandlerOptions, KubernetesProxyOptions, KubernetesServiceLocator, ObjectFetchParams, ObjectToFetch, ObjectsByEntityRequest, OidcStrategy, RouterOptions, ServiceAccountStrategy, ServiceLocatorMethod, ServiceLocatorRequestContext, SigningCreds, createRouter };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-kubernetes-backend",
3
3
  "description": "A Backstage backend plugin that integrates towards Kubernetes",
4
- "version": "0.14.0-next.3",
4
+ "version": "0.14.1-next.0",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -49,19 +49,19 @@
49
49
  "@aws-sdk/credential-providers": "^3.350.0",
50
50
  "@aws-sdk/signature-v4": "^3.347.0",
51
51
  "@azure/identity": "^4.0.0",
52
- "@backstage/backend-common": "^0.20.0-next.3",
53
- "@backstage/backend-plugin-api": "^0.6.8-next.3",
54
- "@backstage/catalog-client": "^1.5.0-next.1",
52
+ "@backstage/backend-common": "^0.20.1-next.0",
53
+ "@backstage/backend-plugin-api": "^0.6.9-next.0",
54
+ "@backstage/catalog-client": "^1.5.2-next.0",
55
55
  "@backstage/catalog-model": "^1.4.3",
56
56
  "@backstage/config": "^1.1.1",
57
57
  "@backstage/errors": "^1.2.3",
58
58
  "@backstage/integration-aws-node": "^0.1.8",
59
- "@backstage/plugin-auth-node": "^0.4.2-next.3",
60
- "@backstage/plugin-catalog-node": "^1.6.0-next.3",
61
- "@backstage/plugin-kubernetes-common": "^0.7.2-next.1",
62
- "@backstage/plugin-kubernetes-node": "^0.1.2-next.3",
63
- "@backstage/plugin-permission-common": "^0.7.10",
64
- "@backstage/plugin-permission-node": "^0.7.19-next.3",
59
+ "@backstage/plugin-auth-node": "^0.4.3-next.0",
60
+ "@backstage/plugin-catalog-node": "^1.6.1-next.0",
61
+ "@backstage/plugin-kubernetes-common": "^0.7.3-next.0",
62
+ "@backstage/plugin-kubernetes-node": "^0.1.3-next.0",
63
+ "@backstage/plugin-permission-common": "^0.7.11",
64
+ "@backstage/plugin-permission-node": "^0.7.20-next.0",
65
65
  "@backstage/types": "^1.1.1",
66
66
  "@google-cloud/container": "^5.0.0",
67
67
  "@jest-mock/express": "^2.0.1",
@@ -85,9 +85,11 @@
85
85
  "yn": "^4.0.0"
86
86
  },
87
87
  "devDependencies": {
88
- "@backstage/backend-app-api": "^0.5.9-next.3",
89
- "@backstage/backend-test-utils": "^0.2.9-next.3",
90
- "@backstage/cli": "^0.25.0-next.3",
88
+ "@backstage/backend-app-api": "^0.5.10-next.0",
89
+ "@backstage/backend-test-utils": "^0.2.10-next.0",
90
+ "@backstage/cli": "^0.25.1-next.0",
91
+ "@backstage/plugin-permission-backend": "^0.5.32-next.0",
92
+ "@backstage/plugin-permission-backend-module-allow-all-policy": "^0.1.6-next.0",
91
93
  "@types/aws4": "^1.5.1",
92
94
  "msw": "^1.0.0",
93
95
  "supertest": "^6.1.3",