@backstage/plugin-kubernetes 0.9.0-next.1 → 0.9.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/CHANGELOG.md CHANGED
@@ -1,5 +1,70 @@
1
1
  # @backstage/plugin-kubernetes
2
2
 
3
+ ## 0.9.0
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
+ - c7bad1005ba: The Kubernetes plugin now requests AKS access tokens from Azure when retrieving
40
+ objects from clusters configured with `authProvider: aks` and sets `auth.aks` in
41
+ its request bodies appropriately.
42
+ - a160e02c3d7: Omit managed fields in the Kubernetes resource YAML display.
43
+ - Updated dependencies
44
+ - @backstage/theme@0.3.0
45
+ - @backstage/plugin-catalog-react@1.6.0
46
+ - @backstage/core-components@0.13.1
47
+ - @backstage/plugin-kubernetes-common@0.6.3
48
+ - @backstage/catalog-model@1.3.0
49
+ - @backstage/config@1.0.7
50
+ - @backstage/core-plugin-api@1.5.1
51
+ - @backstage/errors@1.1.5
52
+
53
+ ## 0.9.0-next.2
54
+
55
+ ### Patch Changes
56
+
57
+ - c7bad1005ba: The Kubernetes plugin now requests AKS access tokens from Azure when retrieving
58
+ objects from clusters configured with `authProvider: aks` and sets `auth.aks` in
59
+ its request bodies appropriately.
60
+ - Updated dependencies
61
+ - @backstage/theme@0.3.0-next.0
62
+ - @backstage/core-components@0.13.1-next.1
63
+ - @backstage/plugin-kubernetes-common@0.6.3-next.0
64
+ - @backstage/plugin-catalog-react@1.6.0-next.2
65
+ - @backstage/config@1.0.7
66
+ - @backstage/core-plugin-api@1.5.1
67
+
3
68
  ## 0.9.0-next.1
4
69
 
5
70
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -75,6 +75,7 @@ interface KubernetesAuthProvidersApi {
75
75
  declare class KubernetesAuthProviders implements KubernetesAuthProvidersApi {
76
76
  private readonly kubernetesAuthProviderMap;
77
77
  constructor(options: {
78
+ microsoftAuthApi: OAuthApi;
78
79
  googleAuthApi: OAuthApi;
79
80
  oidcProviders?: {
80
81
  [key: string]: OpenIdConnectApi;
package/dist/index.esm.js CHANGED
@@ -187,6 +187,25 @@ class OidcKubernetesAuthProvider {
187
187
  }
188
188
  }
189
189
 
190
+ class AksKubernetesAuthProvider {
191
+ constructor(microsoftAuthApi) {
192
+ this.microsoftAuthApi = microsoftAuthApi;
193
+ }
194
+ async decorateRequestBodyForAuth(requestBody) {
195
+ return {
196
+ ...requestBody,
197
+ auth: { ...requestBody.auth, aks: (await this.getCredentials()).token }
198
+ };
199
+ }
200
+ async getCredentials() {
201
+ return {
202
+ token: await this.microsoftAuthApi.getAccessToken(
203
+ "6dae42f8-4368-4678-94ff-3960e28e3630/user.read"
204
+ )
205
+ };
206
+ }
207
+ }
208
+
190
209
  class KubernetesAuthProviders {
191
210
  constructor(options) {
192
211
  this.kubernetesAuthProviderMap = /* @__PURE__ */ new Map();
@@ -214,6 +233,10 @@ class KubernetesAuthProviders {
214
233
  "localKubectlProxy",
215
234
  new ServerSideKubernetesAuthProvider()
216
235
  );
236
+ this.kubernetesAuthProviderMap.set(
237
+ "aks",
238
+ new AksKubernetesAuthProvider(options.microsoftAuthApi)
239
+ );
217
240
  if (options.oidcProviders) {
218
241
  Object.keys(options.oidcProviders).forEach((provider) => {
219
242
  this.kubernetesAuthProviderMap.set(
@@ -344,7 +367,11 @@ const kubernetesPlugin = createPlugin({
344
367
  okta: oktaAuthApi,
345
368
  onelogin: oneloginAuthApi
346
369
  };
347
- return new KubernetesAuthProviders({ googleAuthApi, oidcProviders });
370
+ return new KubernetesAuthProviders({
371
+ microsoftAuthApi,
372
+ googleAuthApi,
373
+ oidcProviders
374
+ });
348
375
  }
349
376
  })
350
377
  ],