@backstage/plugin-kubernetes-react 0.5.10-next.0 → 0.5.10

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/api/KubernetesBackendClient.esm.js.map +1 -1
  3. package/dist/api/KubernetesClusterLinkFormatter.esm.js.map +1 -1
  4. package/dist/api/KubernetesProxyClient.esm.js.map +1 -1
  5. package/dist/api/formatters/AksClusterLinksFormatter.esm.js.map +1 -1
  6. package/dist/api/formatters/EksClusterLinksFormatter.esm.js.map +1 -1
  7. package/dist/api/formatters/GkeClusterLinksFormatter.esm.js.map +1 -1
  8. package/dist/api/formatters/HeadlampClusterLinksFormatter.esm.js.map +1 -1
  9. package/dist/api/formatters/OpenshiftClusterLinksFormatter.esm.js.map +1 -1
  10. package/dist/api/formatters/RancherClusterLinksFormatter.esm.js.map +1 -1
  11. package/dist/api/formatters/StandardClusterLinksFormatter.esm.js.map +1 -1
  12. package/dist/api/formatters/index.esm.js.map +1 -1
  13. package/dist/api/types.esm.js.map +1 -1
  14. package/dist/components/Cluster/Cluster.esm.js.map +1 -1
  15. package/dist/components/CronJobsAccordions/CronJobsAccordions.esm.js.map +1 -1
  16. package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js.map +1 -1
  17. package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js +1 -1
  18. package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js.map +1 -1
  19. package/dist/components/CustomResources/ArgoRollouts/RolloutDrawer.esm.js.map +1 -1
  20. package/dist/components/CustomResources/ArgoRollouts/StepsProgress.esm.js.map +1 -1
  21. package/dist/components/CustomResources/CustomResources.esm.js.map +1 -1
  22. package/dist/components/CustomResources/DefaultCustomResource.esm.js.map +1 -1
  23. package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js.map +1 -1
  24. package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js.map +1 -1
  25. package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js.map +1 -1
  26. package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js.map +1 -1
  27. package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js +1 -1
  28. package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js.map +1 -1
  29. package/dist/components/ErrorPanel/ErrorPanel.esm.js.map +1 -1
  30. package/dist/components/ErrorReporting/ErrorReporting.esm.js.map +1 -1
  31. package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js.map +1 -1
  32. package/dist/components/IngressesAccordions/IngressDrawer.esm.js.map +1 -1
  33. package/dist/components/IngressesAccordions/IngressesAccordions.esm.js.map +1 -1
  34. package/dist/components/JobsAccordions/JobsAccordions.esm.js.map +1 -1
  35. package/dist/components/JobsAccordions/JobsDrawer.esm.js.map +1 -1
  36. package/dist/components/KubernetesDialog/KubernetesDialog.esm.js.map +1 -1
  37. package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js.map +1 -1
  38. package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js.map +1 -1
  39. package/dist/components/KubernetesDrawer/ManifestYaml.esm.js.map +1 -1
  40. package/dist/components/PodExecTerminal/PodExecTerminal.esm.js.map +1 -1
  41. package/dist/components/PodExecTerminal/PodExecTerminalAttachAddon.esm.js.map +1 -1
  42. package/dist/components/PodExecTerminal/PodExecTerminalDialog.esm.js.map +1 -1
  43. package/dist/components/Pods/ErrorList/ErrorList.esm.js.map +1 -1
  44. package/dist/components/Pods/Events/Events.esm.js.map +1 -1
  45. package/dist/components/Pods/Events/useEvents.esm.js.map +1 -1
  46. package/dist/components/Pods/FixDialog/FixDialog.esm.js.map +1 -1
  47. package/dist/components/Pods/PodDelete/PodDeleteButton.esm.js.map +1 -1
  48. package/dist/components/Pods/PodDelete/usePodDelete.esm.js.map +1 -1
  49. package/dist/components/Pods/PodDrawer/ContainerCard.esm.js.map +1 -1
  50. package/dist/components/Pods/PodDrawer/PendingPodContent.esm.js.map +1 -1
  51. package/dist/components/Pods/PodDrawer/PodDrawer.esm.js.map +1 -1
  52. package/dist/components/Pods/PodLogs/PodLogs.esm.js.map +1 -1
  53. package/dist/components/Pods/PodLogs/PodLogsDialog.esm.js.map +1 -1
  54. package/dist/components/Pods/PodLogs/usePodLogs.esm.js.map +1 -1
  55. package/dist/components/Pods/PodsTable.esm.js +1 -1
  56. package/dist/components/Pods/PodsTable.esm.js.map +1 -1
  57. package/dist/components/ResourceUtilization/ResourceUtilization.esm.js.map +1 -1
  58. package/dist/components/ServicesAccordions/ServiceDrawer.esm.js.map +1 -1
  59. package/dist/components/ServicesAccordions/ServicesAccordions.esm.js.map +1 -1
  60. package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js.map +1 -1
  61. package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js +1 -1
  62. package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js.map +1 -1
  63. package/dist/hooks/Cluster.esm.js.map +1 -1
  64. package/dist/hooks/GroupedResponses.esm.js.map +1 -1
  65. package/dist/hooks/PodNamesWithErrors.esm.js.map +1 -1
  66. package/dist/hooks/PodNamesWithMetrics.esm.js.map +1 -1
  67. package/dist/hooks/auth.esm.js.map +1 -1
  68. package/dist/hooks/useCustomResources.esm.js.map +1 -1
  69. package/dist/hooks/useIsPodDeleteEnabled.esm.js.map +1 -1
  70. package/dist/hooks/useIsPodExecTerminalEnabled.esm.js.map +1 -1
  71. package/dist/hooks/useIsPodExecTerminalSupported.esm.js.map +1 -1
  72. package/dist/hooks/useKubernetesObjects.esm.js.map +1 -1
  73. package/dist/hooks/useMatchingErrors.esm.js.map +1 -1
  74. package/dist/hooks/usePodMetrics.esm.js.map +1 -1
  75. package/dist/kubernetes-auth-provider/AksKubernetesAuthProvider.esm.js.map +1 -1
  76. package/dist/kubernetes-auth-provider/GoogleKubernetesAuthProvider.esm.js.map +1 -1
  77. package/dist/kubernetes-auth-provider/KubernetesAuthProviders.esm.js.map +1 -1
  78. package/dist/kubernetes-auth-provider/OidcKubernetesAuthProvider.esm.js.map +1 -1
  79. package/dist/kubernetes-auth-provider/ServerSideAuthProvider.esm.js.map +1 -1
  80. package/dist/kubernetes-auth-provider/types.esm.js.map +1 -1
  81. package/dist/translation.esm.js.map +1 -1
  82. package/dist/utils/crons.esm.js.map +1 -1
  83. package/dist/utils/owner.esm.js.map +1 -1
  84. package/dist/utils/pod.esm.js +1 -1
  85. package/dist/utils/pod.esm.js.map +1 -1
  86. package/dist/utils/resources.esm.js.map +1 -1
  87. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"usePodMetrics.esm.js","sources":["../../src/hooks/usePodMetrics.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createContext, useContext } from 'react';\nimport type { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport const PodMetricsContext = createContext<Map<string, ClientPodStatus[]>>(\n new Map(),\n);\n\n/**\n * @public\n */\nexport type PodMetricsMatcher = {\n metadata?: IObjectMeta;\n};\n\n/**\n * Find metrics matching the provided pod\n *\n * @public\n */\nexport const usePodMetrics = (\n clusterName: string,\n matcher: PodMetricsMatcher,\n): ClientPodStatus | undefined => {\n const targetRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n };\n\n const metricsMap = useContext(PodMetricsContext);\n\n const metrics = metricsMap.get(clusterName);\n\n return metrics?.find(m => {\n const pod = m.pod;\n return (\n targetRef.name === (pod.metadata?.name ?? '') &&\n targetRef.namespace === (pod.metadata?.namespace ?? '')\n );\n });\n};\n"],"names":[],"mappings":";;AAwBO,MAAM,iBAAoB,GAAA,aAAA;AAAA,sBAC3B,GAAI;AACV;AAca,MAAA,aAAA,GAAgB,CAC3B,WAAA,EACA,OACgC,KAAA;AAChC,EAAA,MAAM,SAAY,GAAA;AAAA,IAChB,IAAA,EAAM,OAAQ,CAAA,QAAA,EAAU,IAAQ,IAAA,EAAA;AAAA,IAChC,SAAA,EAAW,OAAQ,CAAA,QAAA,EAAU,SAAa,IAAA;AAAA,GAC5C;AAEA,EAAM,MAAA,UAAA,GAAa,WAAW,iBAAiB,CAAA;AAE/C,EAAM,MAAA,OAAA,GAAU,UAAW,CAAA,GAAA,CAAI,WAAW,CAAA;AAE1C,EAAO,OAAA,OAAA,EAAS,KAAK,CAAK,CAAA,KAAA;AACxB,IAAA,MAAM,MAAM,CAAE,CAAA,GAAA;AACd,IACE,OAAA,SAAA,CAAU,IAAU,MAAA,GAAA,CAAI,QAAU,EAAA,IAAA,IAAQ,OAC1C,SAAU,CAAA,SAAA,MAAe,GAAI,CAAA,QAAA,EAAU,SAAa,IAAA,EAAA,CAAA;AAAA,GAEvD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"usePodMetrics.esm.js","sources":["../../src/hooks/usePodMetrics.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createContext, useContext } from 'react';\nimport type { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport const PodMetricsContext = createContext<Map<string, ClientPodStatus[]>>(\n new Map(),\n);\n\n/**\n * @public\n */\nexport type PodMetricsMatcher = {\n metadata?: IObjectMeta;\n};\n\n/**\n * Find metrics matching the provided pod\n *\n * @public\n */\nexport const usePodMetrics = (\n clusterName: string,\n matcher: PodMetricsMatcher,\n): ClientPodStatus | undefined => {\n const targetRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n };\n\n const metricsMap = useContext(PodMetricsContext);\n\n const metrics = metricsMap.get(clusterName);\n\n return metrics?.find(m => {\n const pod = m.pod;\n return (\n targetRef.name === (pod.metadata?.name ?? '') &&\n targetRef.namespace === (pod.metadata?.namespace ?? '')\n );\n });\n};\n"],"names":[],"mappings":";;AAwBO,MAAM,iBAAA,GAAoB,aAAA;AAAA,sBAC3B,GAAA;AACN;AAcO,MAAM,aAAA,GAAgB,CAC3B,WAAA,EACA,OAAA,KACgC;AAChC,EAAA,MAAM,SAAA,GAAY;AAAA,IAChB,IAAA,EAAM,OAAA,CAAQ,QAAA,EAAU,IAAA,IAAQ,EAAA;AAAA,IAChC,SAAA,EAAW,OAAA,CAAQ,QAAA,EAAU,SAAA,IAAa;AAAA,GAC5C;AAEA,EAAA,MAAM,UAAA,GAAa,WAAW,iBAAiB,CAAA;AAE/C,EAAA,MAAM,OAAA,GAAU,UAAA,CAAW,GAAA,CAAI,WAAW,CAAA;AAE1C,EAAA,OAAO,OAAA,EAAS,KAAK,CAAA,CAAA,KAAK;AACxB,IAAA,MAAM,MAAM,CAAA,CAAE,GAAA;AACd,IAAA,OACE,SAAA,CAAU,IAAA,MAAU,GAAA,CAAI,QAAA,EAAU,IAAA,IAAQ,OAC1C,SAAA,CAAU,SAAA,MAAe,GAAA,CAAI,QAAA,EAAU,SAAA,IAAa,EAAA,CAAA;AAAA,EAExD,CAAC,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AksKubernetesAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/AksKubernetesAuthProvider.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { OAuthApi } from '@backstage/core-plugin-api';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { KubernetesAuthProvider } from './types';\n\n/** @public */\nexport class AksKubernetesAuthProvider implements KubernetesAuthProvider {\n constructor(private readonly microsoftAuthApi: OAuthApi) {}\n\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n return {\n ...requestBody,\n auth: { ...requestBody.auth, aks: (await this.getCredentials()).token },\n };\n }\n\n async getCredentials(): Promise<{ token?: string }> {\n return {\n token: await this.microsoftAuthApi.getAccessToken(\n '6dae42f8-4368-4678-94ff-3960e28e3630/user.read',\n ),\n };\n }\n}\n"],"names":[],"mappings":"AAoBO,MAAM,yBAA4D,CAAA;AAAA,EACvE,YAA6B,gBAA4B,EAAA;AAA5B,IAAA,IAAA,CAAA,gBAAA,GAAA,gBAAA;AAAA;AAA6B,EAE1D,MAAM,2BACJ,WACgC,EAAA;AAChC,IAAO,OAAA;AAAA,MACL,GAAG,WAAA;AAAA,MACH,IAAA,EAAM,EAAE,GAAG,WAAY,CAAA,IAAA,EAAM,MAAM,MAAM,IAAA,CAAK,cAAe,EAAA,EAAG,KAAM;AAAA,KACxE;AAAA;AACF,EAEA,MAAM,cAA8C,GAAA;AAClD,IAAO,OAAA;AAAA,MACL,KAAA,EAAO,MAAM,IAAA,CAAK,gBAAiB,CAAA,cAAA;AAAA,QACjC;AAAA;AACF,KACF;AAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"AksKubernetesAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/AksKubernetesAuthProvider.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { OAuthApi } from '@backstage/core-plugin-api';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { KubernetesAuthProvider } from './types';\n\n/** @public */\nexport class AksKubernetesAuthProvider implements KubernetesAuthProvider {\n constructor(private readonly microsoftAuthApi: OAuthApi) {}\n\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n return {\n ...requestBody,\n auth: { ...requestBody.auth, aks: (await this.getCredentials()).token },\n };\n }\n\n async getCredentials(): Promise<{ token?: string }> {\n return {\n token: await this.microsoftAuthApi.getAccessToken(\n '6dae42f8-4368-4678-94ff-3960e28e3630/user.read',\n ),\n };\n }\n}\n"],"names":[],"mappings":"AAoBO,MAAM,yBAAA,CAA4D;AAAA,EACvE,YAA6B,gBAAA,EAA4B;AAA5B,IAAA,IAAA,CAAA,gBAAA,GAAA,gBAAA;AAAA,EAA6B;AAAA,EAE1D,MAAM,2BACJ,WAAA,EACgC;AAChC,IAAA,OAAO;AAAA,MACL,GAAG,WAAA;AAAA,MACH,IAAA,EAAM,EAAE,GAAG,WAAA,CAAY,IAAA,EAAM,MAAM,MAAM,IAAA,CAAK,cAAA,EAAe,EAAG,KAAA;AAAM,KACxE;AAAA,EACF;AAAA,EAEA,MAAM,cAAA,GAA8C;AAClD,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,MAAM,IAAA,CAAK,gBAAA,CAAiB,cAAA;AAAA,QACjC;AAAA;AACF,KACF;AAAA,EACF;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"GoogleKubernetesAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { KubernetesAuthProvider } from './types';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { OAuthApi } from '@backstage/core-plugin-api';\n\n/** @public */\nexport class GoogleKubernetesAuthProvider implements KubernetesAuthProvider {\n authProvider: OAuthApi;\n\n constructor(authProvider: OAuthApi) {\n this.authProvider = authProvider;\n }\n\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n const googleAuthToken: string = (await this.getCredentials()).token;\n if ('auth' in requestBody) {\n requestBody.auth!.google = googleAuthToken;\n } else {\n requestBody.auth = { google: googleAuthToken };\n }\n return requestBody;\n }\n async getCredentials(): Promise<{ token: string }> {\n return {\n token: await this.authProvider.getAccessToken(\n 'https://www.googleapis.com/auth/cloud-platform.read-only',\n ),\n };\n }\n}\n"],"names":[],"mappings":"AAqBO,MAAM,4BAA+D,CAAA;AAAA,EAC1E,YAAA;AAAA,EAEA,YAAY,YAAwB,EAAA;AAClC,IAAA,IAAA,CAAK,YAAe,GAAA,YAAA;AAAA;AACtB,EAEA,MAAM,2BACJ,WACgC,EAAA;AAChC,IAAA,MAAM,eAA2B,GAAA,CAAA,MAAM,IAAK,CAAA,cAAA,EAAkB,EAAA,KAAA;AAC9D,IAAA,IAAI,UAAU,WAAa,EAAA;AACzB,MAAA,WAAA,CAAY,KAAM,MAAS,GAAA,eAAA;AAAA,KACtB,MAAA;AACL,MAAY,WAAA,CAAA,IAAA,GAAO,EAAE,MAAA,EAAQ,eAAgB,EAAA;AAAA;AAE/C,IAAO,OAAA,WAAA;AAAA;AACT,EACA,MAAM,cAA6C,GAAA;AACjD,IAAO,OAAA;AAAA,MACL,KAAA,EAAO,MAAM,IAAA,CAAK,YAAa,CAAA,cAAA;AAAA,QAC7B;AAAA;AACF,KACF;AAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"GoogleKubernetesAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { KubernetesAuthProvider } from './types';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { OAuthApi } from '@backstage/core-plugin-api';\n\n/** @public */\nexport class GoogleKubernetesAuthProvider implements KubernetesAuthProvider {\n authProvider: OAuthApi;\n\n constructor(authProvider: OAuthApi) {\n this.authProvider = authProvider;\n }\n\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n const googleAuthToken: string = (await this.getCredentials()).token;\n if ('auth' in requestBody) {\n requestBody.auth!.google = googleAuthToken;\n } else {\n requestBody.auth = { google: googleAuthToken };\n }\n return requestBody;\n }\n async getCredentials(): Promise<{ token: string }> {\n return {\n token: await this.authProvider.getAccessToken(\n 'https://www.googleapis.com/auth/cloud-platform.read-only',\n ),\n };\n }\n}\n"],"names":[],"mappings":"AAqBO,MAAM,4BAAA,CAA+D;AAAA,EAC1E,YAAA;AAAA,EAEA,YAAY,YAAA,EAAwB;AAClC,IAAA,IAAA,CAAK,YAAA,GAAe,YAAA;AAAA,EACtB;AAAA,EAEA,MAAM,2BACJ,WAAA,EACgC;AAChC,IAAA,MAAM,eAAA,GAAA,CAA2B,MAAM,IAAA,CAAK,cAAA,EAAe,EAAG,KAAA;AAC9D,IAAA,IAAI,UAAU,WAAA,EAAa;AACzB,MAAA,WAAA,CAAY,KAAM,MAAA,GAAS,eAAA;AAAA,IAC7B,CAAA,MAAO;AACL,MAAA,WAAA,CAAY,IAAA,GAAO,EAAE,MAAA,EAAQ,eAAA,EAAgB;AAAA,IAC/C;AACA,IAAA,OAAO,WAAA;AAAA,EACT;AAAA,EACA,MAAM,cAAA,GAA6C;AACjD,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,MAAM,IAAA,CAAK,YAAA,CAAa,cAAA;AAAA,QAC7B;AAAA;AACF,KACF;AAAA,EACF;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"KubernetesAuthProviders.esm.js","sources":["../../src/kubernetes-auth-provider/KubernetesAuthProviders.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { KubernetesAuthProvider, KubernetesAuthProvidersApi } from './types';\nimport { GoogleKubernetesAuthProvider } from './GoogleKubernetesAuthProvider';\nimport { ServerSideKubernetesAuthProvider } from './ServerSideAuthProvider';\nimport { OAuthApi, OpenIdConnectApi } from '@backstage/core-plugin-api';\nimport { OidcKubernetesAuthProvider } from './OidcKubernetesAuthProvider';\nimport { AksKubernetesAuthProvider } from './AksKubernetesAuthProvider';\n\n/** @public */\nexport class KubernetesAuthProviders implements KubernetesAuthProvidersApi {\n private readonly kubernetesAuthProviderMap: Map<\n string,\n KubernetesAuthProvider\n >;\n\n constructor(options: {\n microsoftAuthApi: OAuthApi;\n googleAuthApi: OAuthApi;\n oidcProviders?: { [key: string]: OpenIdConnectApi };\n }) {\n this.kubernetesAuthProviderMap = new Map<string, KubernetesAuthProvider>();\n this.kubernetesAuthProviderMap.set(\n 'google',\n new GoogleKubernetesAuthProvider(options.googleAuthApi),\n );\n this.kubernetesAuthProviderMap.set(\n 'serviceAccount',\n new ServerSideKubernetesAuthProvider(),\n );\n this.kubernetesAuthProviderMap.set(\n 'googleServiceAccount',\n new ServerSideKubernetesAuthProvider(),\n );\n this.kubernetesAuthProviderMap.set(\n 'aws',\n new ServerSideKubernetesAuthProvider(),\n );\n this.kubernetesAuthProviderMap.set(\n 'azure',\n new ServerSideKubernetesAuthProvider(),\n );\n this.kubernetesAuthProviderMap.set(\n 'localKubectlProxy',\n new ServerSideKubernetesAuthProvider(),\n );\n this.kubernetesAuthProviderMap.set(\n 'aks',\n new AksKubernetesAuthProvider(options.microsoftAuthApi),\n );\n\n if (options.oidcProviders) {\n Object.keys(options.oidcProviders).forEach(provider => {\n this.kubernetesAuthProviderMap.set(\n `oidc.${provider}`,\n new OidcKubernetesAuthProvider(\n provider,\n options.oidcProviders![provider],\n ),\n );\n });\n }\n }\n\n async decorateRequestBodyForAuth(\n authProvider: string,\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n const kubernetesAuthProvider: KubernetesAuthProvider | undefined =\n this.kubernetesAuthProviderMap.get(authProvider);\n if (kubernetesAuthProvider) {\n return await kubernetesAuthProvider.decorateRequestBodyForAuth(\n requestBody,\n );\n }\n\n if (authProvider.startsWith('oidc.')) {\n throw new Error(\n `KubernetesAuthProviders has no oidcProvider configured for ${authProvider}`,\n );\n }\n throw new Error(\n `authProvider \"${authProvider}\" has no KubernetesAuthProvider defined for it`,\n );\n }\n\n async getCredentials(authProvider: string): Promise<{ token?: string }> {\n const kubernetesAuthProvider: KubernetesAuthProvider | undefined =\n this.kubernetesAuthProviderMap.get(authProvider);\n\n if (kubernetesAuthProvider) {\n return await kubernetesAuthProvider.getCredentials();\n }\n\n if (authProvider.startsWith('oidc.')) {\n throw new Error(\n `KubernetesAuthProviders has no oidcProvider configured for ${authProvider}`,\n );\n }\n throw new Error(\n `authProvider \"${authProvider}\" has no KubernetesAuthProvider defined for it`,\n );\n }\n}\n"],"names":[],"mappings":";;;;;AAyBO,MAAM,uBAA8D,CAAA;AAAA,EACxD,yBAAA;AAAA,EAKjB,YAAY,OAIT,EAAA;AACD,IAAK,IAAA,CAAA,yBAAA,uBAAgC,GAAoC,EAAA;AACzE,IAAA,IAAA,CAAK,yBAA0B,CAAA,GAAA;AAAA,MAC7B,QAAA;AAAA,MACA,IAAI,4BAA6B,CAAA,OAAA,CAAQ,aAAa;AAAA,KACxD;AACA,IAAA,IAAA,CAAK,yBAA0B,CAAA,GAAA;AAAA,MAC7B,gBAAA;AAAA,MACA,IAAI,gCAAiC;AAAA,KACvC;AACA,IAAA,IAAA,CAAK,yBAA0B,CAAA,GAAA;AAAA,MAC7B,sBAAA;AAAA,MACA,IAAI,gCAAiC;AAAA,KACvC;AACA,IAAA,IAAA,CAAK,yBAA0B,CAAA,GAAA;AAAA,MAC7B,KAAA;AAAA,MACA,IAAI,gCAAiC;AAAA,KACvC;AACA,IAAA,IAAA,CAA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AA;AAEjD,IAAA,IAAI,sBAAwB,EAAA;AAC1B,MAAO,OAAA,MAAM,uBAAuB,cAAe,EAAA;AAAA;AAGrD,IAAI,IAAA,YAAA,CAAa,UAAW,CAAA,OAAO,CAAG,EAAA;AACpC,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,8DAA8D,YAAY,CAAA;AAAA,OAC5E;AAAA;AAEF,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,iBAAiB,YAAY,CAAA,8CAAA;AAAA,KAC/B;AAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"KubernetesAuthProviders.esm.js","sources":["../../src/kubernetes-auth-provider/KubernetesAuthProviders.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { KubernetesAuthProvider, KubernetesAuthProvidersApi } from './types';\nimport { GoogleKubernetesAuthProvider } from './GoogleKubernetesAuthProvider';\nimport { ServerSideKubernetesAuthProvider } from './ServerSideAuthProvider';\nimport { OAuthApi, OpenIdConnectApi } from '@backstage/core-plugin-api';\nimport { OidcKubernetesAuthProvider } from './OidcKubernetesAuthProvider';\nimport { AksKubernetesAuthProvider } from './AksKubernetesAuthProvider';\n\n/** @public */\nexport class KubernetesAuthProviders implements KubernetesAuthProvidersApi {\n private readonly kubernetesAuthProviderMap: Map<\n string,\n KubernetesAuthProvider\n >;\n\n constructor(options: {\n microsoftAuthApi: OAuthApi;\n googleAuthApi: OAuthApi;\n oidcProviders?: { [key: string]: OpenIdConnectApi };\n }) {\n this.kubernetesAuthProviderMap = new Map<string, KubernetesAuthProvider>();\n this.kubernetesAuthProviderMap.set(\n 'google',\n new GoogleKubernetesAuthProvider(options.googleAuthApi),\n );\n this.kubernetesAuthProviderMap.set(\n 'serviceAccount',\n new ServerSideKubernetesAuthProvider(),\n );\n this.kubernetesAuthProviderMap.set(\n 'googleServiceAccount',\n new ServerSideKubernetesAuthProvider(),\n );\n this.kubernetesAuthProviderMap.set(\n 'aws',\n new ServerSideKubernetesAuthProvider(),\n );\n this.kubernetesAuthProviderMap.set(\n 'azure',\n new ServerSideKubernetesAuthProvider(),\n );\n this.kubernetesAuthProviderMap.set(\n 'localKubectlProxy',\n new ServerSideKubernetesAuthProvider(),\n );\n this.kubernetesAuthProviderMap.set(\n 'aks',\n new AksKubernetesAuthProvider(options.microsoftAuthApi),\n );\n\n if (options.oidcProviders) {\n Object.keys(options.oidcProviders).forEach(provider => {\n this.kubernetesAuthProviderMap.set(\n `oidc.${provider}`,\n new OidcKubernetesAuthProvider(\n provider,\n options.oidcProviders![provider],\n ),\n );\n });\n }\n }\n\n async decorateRequestBodyForAuth(\n authProvider: string,\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n const kubernetesAuthProvider: KubernetesAuthProvider | undefined =\n this.kubernetesAuthProviderMap.get(authProvider);\n if (kubernetesAuthProvider) {\n return await kubernetesAuthProvider.decorateRequestBodyForAuth(\n requestBody,\n );\n }\n\n if (authProvider.startsWith('oidc.')) {\n throw new Error(\n `KubernetesAuthProviders has no oidcProvider configured for ${authProvider}`,\n );\n }\n throw new Error(\n `authProvider \"${authProvider}\" has no KubernetesAuthProvider defined for it`,\n );\n }\n\n async getCredentials(authProvider: string): Promise<{ token?: string }> {\n const kubernetesAuthProvider: KubernetesAuthProvider | undefined =\n this.kubernetesAuthProviderMap.get(authProvider);\n\n if (kubernetesAuthProvider) {\n return await kubernetesAuthProvider.getCredentials();\n }\n\n if (authProvider.startsWith('oidc.')) {\n throw new Error(\n `KubernetesAuthProviders has no oidcProvider configured for ${authProvider}`,\n );\n }\n throw new Error(\n `authProvider \"${authProvider}\" has no KubernetesAuthProvider defined for it`,\n );\n }\n}\n"],"names":[],"mappings":";;;;;AAyBO,MAAM,uBAAA,CAA8D;AAAA,EACxD,yBAAA;AAAA,EAKjB,YAAY,OAAA,EAIT;AACD,IAAA,IAAA,CAAK,yBAAA,uBAAgC,GAAA,EAAoC;AACzE,IAAA,IAAA,CAAK,yBAAA,CAA0B,GAAA;AAAA,MAC7B,QAAA;AAAA,MACA,IAAI,4BAAA,CAA6B,OAAA,CAAQ,aAAa;AAAA,KACxD;AACA,IAAA,IAAA,CAAK,yBAAA,CAA0B,GAAA;AAAA,MAC7B,gBAAA;AAAA,MACA,IAAI,gCAAA;AAAiC,KACvC;AACA,IAAA,IAAA,CAAK,yBAAA,CAA0B,GAAA;AAAA,MAC7B,sBAAA;AAAA,MACA,IAAI,gCAAA;AAAiC,KACvC;AACA,IAAA,IAAA,CAAK,yBAAA,CAA0B,GAAA;AAAA,MAC7B,KAAA;AAAA,MACA,IAAI,gCAAA;AAAiC,KACvC;AACA,IAAA,IAAA,CAAK,yBAAA,CAA0B,GAAA;AAAA,MAC7B,OAAA;AAAA,MACA,IAAI,gCAAA;AAAiC,KACvC;AACA,IAAA,IAAA,CAAK,yBAAA,CAA0B,GAAA;AAAA,MAC7B,mBAAA;AAAA,MACA,IAAI,gCAAA;AAAiC,KACvC;AACA,IAAA,IAAA,CAAK,yBAAA,CAA0B,GAAA;AAAA,MAC7B,KAAA;AAAA,MACA,IAAI,yBAAA,CAA0B,OAAA,CAAQ,gBAAgB;AAAA,KACxD;AAEA,IAAA,IAAI,QAAQ,aAAA,EAAe;AACzB,MAAA,MAAA,CAAO,IAAA,CAAK,OAAA,CAAQ,aAAa,CAAA,CAAE,QAAQ,CAAA,QAAA,KAAY;AACrD,QAAA,IAAA,CAAK,yBAAA,CAA0B,GAAA;AAAA,UAC7B,QAAQ,QAAQ,CAAA,CAAA;AAAA,UAChB,IAAI,0BAAA;AAAA,YACF,QAAA;AAAA,YACA,OAAA,CAAQ,cAAe,QAAQ;AAAA;AACjC,SACF;AAAA,MACF,CAAC,CAAA;AAAA,IACH;AAAA,EACF;AAAA,EAEA,MAAM,0BAAA,CACJ,YAAA,EACA,WAAA,EACgC;AAChC,IAAA,MAAM,sBAAA,GACJ,IAAA,CAAK,yBAAA,CAA0B,GAAA,CAAI,YAAY,CAAA;AACjD,IAAA,IAAI,sBAAA,EAAwB;AAC1B,MAAA,OAAO,MAAM,sBAAA,CAAuB,0BAAA;AAAA,QAClC;AAAA,OACF;AAAA,IACF;AAEA,IAAA,IAAI,YAAA,CAAa,UAAA,CAAW,OAAO,CAAA,EAAG;AACpC,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,8DAA8D,YAAY,CAAA;AAAA,OAC5E;AAAA,IACF;AACA,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,iBAAiB,YAAY,CAAA,8CAAA;AAAA,KAC/B;AAAA,EACF;AAAA,EAEA,MAAM,eAAe,YAAA,EAAmD;AACtE,IAAA,MAAM,sBAAA,GACJ,IAAA,CAAK,yBAAA,CAA0B,GAAA,CAAI,YAAY,CAAA;AAEjD,IAAA,IAAI,sBAAA,EAAwB;AAC1B,MAAA,OAAO,MAAM,uBAAuB,cAAA,EAAe;AAAA,IACrD;AAEA,IAAA,IAAI,YAAA,CAAa,UAAA,CAAW,OAAO,CAAA,EAAG;AACpC,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,8DAA8D,YAAY,CAAA;AAAA,OAC5E;AAAA,IACF;AACA,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,iBAAiB,YAAY,CAAA,8CAAA;AAAA,KAC/B;AAAA,EACF;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"OidcKubernetesAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/OidcKubernetesAuthProvider.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject } from '@backstage/types';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { OpenIdConnectApi } from '@backstage/core-plugin-api';\nimport { KubernetesAuthProvider } from './types';\n\n/** @public */\nexport class OidcKubernetesAuthProvider implements KubernetesAuthProvider {\n providerName: string;\n authProvider: OpenIdConnectApi;\n\n constructor(providerName: string, authProvider: OpenIdConnectApi) {\n this.providerName = providerName;\n this.authProvider = authProvider;\n }\n\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n const authToken: string = (await this.getCredentials()).token;\n const auth = { ...(requestBody.auth as JsonObject) };\n if (auth.oidc) {\n (auth.oidc as JsonObject)[this.providerName] = authToken;\n } else {\n auth.oidc = { [this.providerName]: authToken };\n }\n requestBody.auth = auth;\n return requestBody;\n }\n\n async getCredentials(): Promise<{ token: string }> {\n return {\n token: await this.authProvider.getIdToken(),\n };\n }\n}\n"],"names":[],"mappings":"AAsBO,MAAM,0BAA6D,CAAA;AAAA,EACxE,YAAA;AAAA,EACA,YAAA;AAAA,EAEA,WAAA,CAAY,cAAsB,YAAgC,EAAA;AAChE,IAAA,IAAA,CAAK,YAAe,GAAA,YAAA;AACpB,IAAA,IAAA,CAAK,YAAe,GAAA,YAAA;AAAA;AACtB,EAEA,MAAM,2BACJ,WACgC,EAAA;AAChC,IAAA,MAAM,SAAqB,GAAA,CAAA,MAAM,IAAK,CAAA,cAAA,EAAkB,EAAA,KAAA;AACxD,IAAA,MAAM,IAAO,GAAA,EAAE,GAAI,WAAA,CAAY,IAAoB,EAAA;AACnD,IAAA,IAAI,KAAK,IAAM,EAAA;AACb,MAAC,IAAK,CAAA,IAAA,CAAoB,IAAK,CAAA,YAAY,CAAI,GAAA,SAAA;AAAA,KAC1C,MAAA;AACL,MAAA,IAAA,CAAK,OAAO,EAAE,CAAC,IAAK,CAAA,YAAY,GAAG,SAAU,EAAA;AAAA;AAE/C,IAAA,WAAA,CAAY,IAAO,GAAA,IAAA;AACnB,IAAO,OAAA,WAAA;AAAA;AACT,EAEA,MAAM,cAA6C,GAAA;AACjD,IAAO,OAAA;AAAA,MACL,KAAO,EAAA,MAAM,IAAK,CAAA,YAAA,CAAa,UAAW;AAAA,KAC5C;AAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"OidcKubernetesAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/OidcKubernetesAuthProvider.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject } from '@backstage/types';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { OpenIdConnectApi } from '@backstage/core-plugin-api';\nimport { KubernetesAuthProvider } from './types';\n\n/** @public */\nexport class OidcKubernetesAuthProvider implements KubernetesAuthProvider {\n providerName: string;\n authProvider: OpenIdConnectApi;\n\n constructor(providerName: string, authProvider: OpenIdConnectApi) {\n this.providerName = providerName;\n this.authProvider = authProvider;\n }\n\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n const authToken: string = (await this.getCredentials()).token;\n const auth = { ...(requestBody.auth as JsonObject) };\n if (auth.oidc) {\n (auth.oidc as JsonObject)[this.providerName] = authToken;\n } else {\n auth.oidc = { [this.providerName]: authToken };\n }\n requestBody.auth = auth;\n return requestBody;\n }\n\n async getCredentials(): Promise<{ token: string }> {\n return {\n token: await this.authProvider.getIdToken(),\n };\n }\n}\n"],"names":[],"mappings":"AAsBO,MAAM,0BAAA,CAA6D;AAAA,EACxE,YAAA;AAAA,EACA,YAAA;AAAA,EAEA,WAAA,CAAY,cAAsB,YAAA,EAAgC;AAChE,IAAA,IAAA,CAAK,YAAA,GAAe,YAAA;AACpB,IAAA,IAAA,CAAK,YAAA,GAAe,YAAA;AAAA,EACtB;AAAA,EAEA,MAAM,2BACJ,WAAA,EACgC;AAChC,IAAA,MAAM,SAAA,GAAA,CAAqB,MAAM,IAAA,CAAK,cAAA,EAAe,EAAG,KAAA;AACxD,IAAA,MAAM,IAAA,GAAO,EAAE,GAAI,WAAA,CAAY,IAAA,EAAoB;AACnD,IAAA,IAAI,KAAK,IAAA,EAAM;AACb,MAAC,IAAA,CAAK,IAAA,CAAoB,IAAA,CAAK,YAAY,CAAA,GAAI,SAAA;AAAA,IACjD,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,OAAO,EAAE,CAAC,IAAA,CAAK,YAAY,GAAG,SAAA,EAAU;AAAA,IAC/C;AACA,IAAA,WAAA,CAAY,IAAA,GAAO,IAAA;AACnB,IAAA,OAAO,WAAA;AAAA,EACT;AAAA,EAEA,MAAM,cAAA,GAA6C;AACjD,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,MAAM,IAAA,CAAK,YAAA,CAAa,UAAA;AAAW,KAC5C;AAAA,EACF;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ServerSideAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/ServerSideAuthProvider.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { KubernetesAuthProvider } from './types';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\n\n/**\n * No-op KubernetesAuthProvider, authorization will be handled in the kubernetes-backend plugin\n *\n * @public\n */\nexport class ServerSideKubernetesAuthProvider\n implements KubernetesAuthProvider\n{\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n // No-op, auth will be taken care of on the server-side\n return requestBody;\n }\n\n async getCredentials(): Promise<{}> {\n return {};\n }\n}\n"],"names":[],"mappings":"AAwBO,MAAM,gCAEb,CAAA;AAAA,EACE,MAAM,2BACJ,WACgC,EAAA;AAEhC,IAAO,OAAA,WAAA;AAAA;AACT,EAEA,MAAM,cAA8B,GAAA;AAClC,IAAA,OAAO,EAAC;AAAA;AAEZ;;;;"}
1
+ {"version":3,"file":"ServerSideAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/ServerSideAuthProvider.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { KubernetesAuthProvider } from './types';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\n\n/**\n * No-op KubernetesAuthProvider, authorization will be handled in the kubernetes-backend plugin\n *\n * @public\n */\nexport class ServerSideKubernetesAuthProvider\n implements KubernetesAuthProvider\n{\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n // No-op, auth will be taken care of on the server-side\n return requestBody;\n }\n\n async getCredentials(): Promise<{}> {\n return {};\n }\n}\n"],"names":[],"mappings":"AAwBO,MAAM,gCAAA,CAEb;AAAA,EACE,MAAM,2BACJ,WAAA,EACgC;AAEhC,IAAA,OAAO,WAAA;AAAA,EACT;AAAA,EAEA,MAAM,cAAA,GAA8B;AAClC,IAAA,OAAO,EAAC;AAAA,EACV;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.esm.js","sources":["../../src/kubernetes-auth-provider/types.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { createApiRef } from '@backstage/core-plugin-api';\n\n/** @public */\nexport interface KubernetesAuthProvider {\n decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody>;\n getCredentials(): Promise<{ token?: string }>;\n}\n\n/** @public */\nexport const kubernetesAuthProvidersApiRef =\n createApiRef<KubernetesAuthProvidersApi>({\n id: 'plugin.kubernetes-auth-providers.service',\n });\n\n/** @public */\nexport interface KubernetesAuthProvidersApi {\n decorateRequestBodyForAuth(\n authProvider: string,\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody>;\n getCredentials(authProvider: string): Promise<{ token?: string }>;\n}\n"],"names":[],"mappings":";;AA4BO,MAAM,gCACX,YAAyC,CAAA;AAAA,EACvC,EAAI,EAAA;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"types.esm.js","sources":["../../src/kubernetes-auth-provider/types.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { createApiRef } from '@backstage/core-plugin-api';\n\n/** @public */\nexport interface KubernetesAuthProvider {\n decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody>;\n getCredentials(): Promise<{ token?: string }>;\n}\n\n/** @public */\nexport const kubernetesAuthProvidersApiRef =\n createApiRef<KubernetesAuthProvidersApi>({\n id: 'plugin.kubernetes-auth-providers.service',\n });\n\n/** @public */\nexport interface KubernetesAuthProvidersApi {\n decorateRequestBodyForAuth(\n authProvider: string,\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody>;\n getCredentials(authProvider: string): Promise<{ token?: string }>;\n}\n"],"names":[],"mappings":";;AA4BO,MAAM,gCACX,YAAA,CAAyC;AAAA,EACvC,EAAA,EAAI;AACN,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @alpha */\nexport const kubernetesReactTranslationRef = createTranslationRef({\n id: 'kubernetes-react',\n messages: {\n podDrawer: {\n buttons: {\n delete: 'Delete Pod',\n },\n },\n },\n});\n"],"names":[],"mappings":";;AAmBO,MAAM,gCAAgC,oBAAqB,CAAA;AAAA,EAChE,EAAI,EAAA,kBAAA;AAAA,EACJ,QAAU,EAAA;AAAA,IACR,SAAW,EAAA;AAAA,MACT,OAAS,EAAA;AAAA,QACP,MAAQ,EAAA;AAAA;AACV;AACF;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @alpha */\nexport const kubernetesReactTranslationRef = createTranslationRef({\n id: 'kubernetes-react',\n messages: {\n podDrawer: {\n buttons: {\n delete: 'Delete Pod',\n },\n },\n },\n});\n"],"names":[],"mappings":";;AAmBO,MAAM,gCAAgC,oBAAA,CAAqB;AAAA,EAChE,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,SAAA,EAAW;AAAA,MACT,OAAA,EAAS;AAAA,QACP,MAAA,EAAQ;AAAA;AACV;AACF;AAEJ,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"crons.esm.js","sources":["../../src/utils/crons.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport cronstrue from 'cronstrue';\n\n// Defined at https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/\nconst k8sCronAliases = new Map([\n ['@yearly', '0 0 1 1 *'],\n ['@annually', '0 0 1 1 *'],\n ['@monthly', '0 0 1 * *'],\n ['@weekly', '0 0 * * 0'],\n ['@daily', '0 0 * * *'],\n ['@midnight', '0 0 * * *'],\n ['@hourly', '0 * * * *'],\n]);\n\n// humanizeCron takes into account the aliases provided by kubernetes before\n// calling cronstrue. In an effort to not throw an error, it will return the\n// original cron formatted schedule if the cronstrue call fails.\nexport const humanizeCron = (schedule: string): string => {\n const deAliasedSchedule = k8sCronAliases.get(schedule) || schedule;\n try {\n return cronstrue.toString(deAliasedSchedule);\n } catch (e) {\n return deAliasedSchedule;\n }\n};\n"],"names":[],"mappings":";;AAmBA,MAAM,cAAA,uBAAqB,GAAI,CAAA;AAAA,EAC7B,CAAC,WAAW,WAAW,CAAA;AAAA,EACvB,CAAC,aAAa,WAAW,CAAA;AAAA,EACzB,CAAC,YAAY,WAAW,CAAA;AAAA,EACxB,CAAC,WAAW,WAAW,CAAA;AAAA,EACvB,CAAC,UAAU,WAAW,CAAA;AAAA,EACtB,CAAC,aAAa,WAAW,CAAA;AAAA,EACzB,CAAC,WAAW,WAAW;AACzB,CAAC,CAAA;AAKY,MAAA,YAAA,GAAe,CAAC,QAA6B,KAAA;AACxD,EAAA,MAAM,iBAAoB,GAAA,cAAA,CAAe,GAAI,CAAA,QAAQ,CAAK,IAAA,QAAA;AAC1D,EAAI,IAAA;AACF,IAAO,OAAA,SAAA,CAAU,SAAS,iBAAiB,CAAA;AAAA,WACpC,CAAG,EAAA;AACV,IAAO,OAAA,iBAAA;AAAA;AAEX;;;;"}
1
+ {"version":3,"file":"crons.esm.js","sources":["../../src/utils/crons.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport cronstrue from 'cronstrue';\n\n// Defined at https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/\nconst k8sCronAliases = new Map([\n ['@yearly', '0 0 1 1 *'],\n ['@annually', '0 0 1 1 *'],\n ['@monthly', '0 0 1 * *'],\n ['@weekly', '0 0 * * 0'],\n ['@daily', '0 0 * * *'],\n ['@midnight', '0 0 * * *'],\n ['@hourly', '0 * * * *'],\n]);\n\n// humanizeCron takes into account the aliases provided by kubernetes before\n// calling cronstrue. In an effort to not throw an error, it will return the\n// original cron formatted schedule if the cronstrue call fails.\nexport const humanizeCron = (schedule: string): string => {\n const deAliasedSchedule = k8sCronAliases.get(schedule) || schedule;\n try {\n return cronstrue.toString(deAliasedSchedule);\n } catch (e) {\n return deAliasedSchedule;\n }\n};\n"],"names":[],"mappings":";;AAmBA,MAAM,cAAA,uBAAqB,GAAA,CAAI;AAAA,EAC7B,CAAC,WAAW,WAAW,CAAA;AAAA,EACvB,CAAC,aAAa,WAAW,CAAA;AAAA,EACzB,CAAC,YAAY,WAAW,CAAA;AAAA,EACxB,CAAC,WAAW,WAAW,CAAA;AAAA,EACvB,CAAC,UAAU,WAAW,CAAA;AAAA,EACtB,CAAC,aAAa,WAAW,CAAA;AAAA,EACzB,CAAC,WAAW,WAAW;AACzB,CAAC,CAAA;AAKM,MAAM,YAAA,GAAe,CAAC,QAAA,KAA6B;AACxD,EAAA,MAAM,iBAAA,GAAoB,cAAA,CAAe,GAAA,CAAI,QAAQ,CAAA,IAAK,QAAA;AAC1D,EAAA,IAAI;AACF,IAAA,OAAO,SAAA,CAAU,SAAS,iBAAiB,CAAA;AAAA,EAC7C,SAAS,CAAA,EAAG;AACV,IAAA,OAAO,iBAAA;AAAA,EACT;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"owner.esm.js","sources":["../../src/utils/owner.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n V1ObjectMeta,\n V2HorizontalPodAutoscaler,\n V1Pod,\n V1ReplicaSet,\n} from '@kubernetes/client-node';\n\ninterface CanOwn {\n metadata?: V1ObjectMeta;\n}\n\ninterface CanBeOwned {\n metadata?: V1ObjectMeta;\n}\n\nexport function getOwnedResources<R extends CanBeOwned>(\n potentialOwner: CanOwn,\n possiblyOwned: R[],\n): R[] {\n return possiblyOwned.filter(\n p =>\n p.metadata?.ownerReferences?.some(\n o => o.uid === potentialOwner.metadata?.uid,\n ) ?? false,\n );\n}\n\nexport const getOwnedPodsThroughReplicaSets = (\n potentialOwner: CanOwn,\n replicaSets: V1ReplicaSet[],\n pods: V1Pod[],\n) => {\n return getOwnedResources(\n potentialOwner,\n replicaSets.filter(rs => rs.status && rs.status.replicas > 0),\n ).reduce((accum, rs) => {\n return accum.concat(getOwnedResources(rs, pods));\n }, [] as V1Pod[]);\n};\n\ninterface ResourceRef {\n kind: string;\n namespace?: string;\n name?: string;\n}\n\nexport const getMatchingHpa = (\n owner: ResourceRef,\n hpas: V2HorizontalPodAutoscaler[],\n): V2HorizontalPodAutoscaler | undefined => {\n return hpas.find(hpa => {\n return (\n (hpa.spec?.scaleTargetRef?.kind ?? '').toLocaleLowerCase('en-US') ===\n owner.kind.toLocaleLowerCase('en-US') &&\n (hpa.metadata?.namespace ?? '') ===\n (owner.namespace ?? 'unknown-namespace') &&\n (hpa.spec?.scaleTargetRef?.name ?? '') ===\n (owner.name ?? 'unknown-deployment')\n );\n });\n};\n"],"names":[],"mappings":"AA+BgB,SAAA,iBAAA,CACd,gBACA,aACK,EAAA;AACL,EAAA,OAAO,aAAc,CAAA,MAAA;AAAA,IACnB,CAAA,CAAA,KACE,CAAE,CAAA,QAAA,EAAU,eAAiB,EAAA,IAAA;AAAA,MAC3B,CAAK,CAAA,KAAA,CAAA,CAAE,GAAQ,KAAA,cAAA,CAAe,QAAU,EAAA;AAAA,KACrC,IAAA;AAAA,GACT;AACF;AAEO,MAAM,8BAAiC,GAAA,CAC5C,cACA,EAAA,WAAA,EACA,IACG,KAAA;AACH,EAAO,OAAA,iBAAA;AAAA,IACL,cAAA;AAAA,IACA,WAAA,CAAY,OAAO,CAAM,EAAA,KAAA,EAAA,CAAG,UAAU,EAAG,CAAA,MAAA,CAAO,WAAW,CAAC;AAAA,GAC5D,CAAA,MAAA,CAAO,CAAC,KAAA,EAAO,EAAO,KAAA;AACtB,IAAA,OAAO,KAAM,CAAA,MAAA,CAAO,iBAAkB,CAAA,EAAA,EAAI,IAAI,CAAC,CAAA;AAAA,GACjD,EAAG,EAAa,CAAA;AAClB;AAQa,MAAA,cAAA,GAAiB,CAC5B,KAAA,EACA,IAC0C,KAAA;AAC1C,EAAO,OAAA,IAAA,CAAK,KAAK,CAAO,GAAA,KAAA;AACtB,IACG,OAAA,CAAA,GAAA,CAAI,IAAM,EAAA,cAAA,EAAgB,IAAQ,IAAA,EAAA,EAAI,iBAAkB,CAAA,OAAO,CAC9D,KAAA,KAAA,CAAM,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA,IAAA,CACrC,IAAI,QAAU,EAAA,SAAA,IAAa,EACzB,OAAA,KAAA,CAAM,SAAa,IAAA,mBAAA,CAAA,IAAA,CACrB,GAAI,CAAA,IAAA,EAAM,cAAgB,EAAA,IAAA,IAAQ,EAChC,OAAA,KAAA,CAAM,IAAQ,IAAA,oBAAA,CAAA;AAAA,GAEpB,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"owner.esm.js","sources":["../../src/utils/owner.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n V1ObjectMeta,\n V2HorizontalPodAutoscaler,\n V1Pod,\n V1ReplicaSet,\n} from '@kubernetes/client-node';\n\ninterface CanOwn {\n metadata?: V1ObjectMeta;\n}\n\ninterface CanBeOwned {\n metadata?: V1ObjectMeta;\n}\n\nexport function getOwnedResources<R extends CanBeOwned>(\n potentialOwner: CanOwn,\n possiblyOwned: R[],\n): R[] {\n return possiblyOwned.filter(\n p =>\n p.metadata?.ownerReferences?.some(\n o => o.uid === potentialOwner.metadata?.uid,\n ) ?? false,\n );\n}\n\nexport const getOwnedPodsThroughReplicaSets = (\n potentialOwner: CanOwn,\n replicaSets: V1ReplicaSet[],\n pods: V1Pod[],\n) => {\n return getOwnedResources(\n potentialOwner,\n replicaSets.filter(rs => rs.status && rs.status.replicas > 0),\n ).reduce((accum, rs) => {\n return accum.concat(getOwnedResources(rs, pods));\n }, [] as V1Pod[]);\n};\n\ninterface ResourceRef {\n kind: string;\n namespace?: string;\n name?: string;\n}\n\nexport const getMatchingHpa = (\n owner: ResourceRef,\n hpas: V2HorizontalPodAutoscaler[],\n): V2HorizontalPodAutoscaler | undefined => {\n return hpas.find(hpa => {\n return (\n (hpa.spec?.scaleTargetRef?.kind ?? '').toLocaleLowerCase('en-US') ===\n owner.kind.toLocaleLowerCase('en-US') &&\n (hpa.metadata?.namespace ?? '') ===\n (owner.namespace ?? 'unknown-namespace') &&\n (hpa.spec?.scaleTargetRef?.name ?? '') ===\n (owner.name ?? 'unknown-deployment')\n );\n });\n};\n"],"names":[],"mappings":"AA+BO,SAAS,iBAAA,CACd,gBACA,aAAA,EACK;AACL,EAAA,OAAO,aAAA,CAAc,MAAA;AAAA,IACnB,CAAA,CAAA,KACE,CAAA,CAAE,QAAA,EAAU,eAAA,EAAiB,IAAA;AAAA,MAC3B,CAAA,CAAA,KAAK,CAAA,CAAE,GAAA,KAAQ,cAAA,CAAe,QAAA,EAAU;AAAA,KAC1C,IAAK;AAAA,GACT;AACF;AAEO,MAAM,8BAAA,GAAiC,CAC5C,cAAA,EACA,WAAA,EACA,IAAA,KACG;AACH,EAAA,OAAO,iBAAA;AAAA,IACL,cAAA;AAAA,IACA,WAAA,CAAY,OAAO,CAAA,EAAA,KAAM,EAAA,CAAG,UAAU,EAAA,CAAG,MAAA,CAAO,WAAW,CAAC;AAAA,GAC9D,CAAE,MAAA,CAAO,CAAC,KAAA,EAAO,EAAA,KAAO;AACtB,IAAA,OAAO,KAAA,CAAM,MAAA,CAAO,iBAAA,CAAkB,EAAA,EAAI,IAAI,CAAC,CAAA;AAAA,EACjD,CAAA,EAAG,EAAa,CAAA;AAClB;AAQO,MAAM,cAAA,GAAiB,CAC5B,KAAA,EACA,IAAA,KAC0C;AAC1C,EAAA,OAAO,IAAA,CAAK,KAAK,CAAA,GAAA,KAAO;AACtB,IAAA,OAAA,CACG,GAAA,CAAI,IAAA,EAAM,cAAA,EAAgB,IAAA,IAAQ,EAAA,EAAI,iBAAA,CAAkB,OAAO,CAAA,KAC9D,KAAA,CAAM,IAAA,CAAK,iBAAA,CAAkB,OAAO,CAAA,IAAA,CACrC,IAAI,QAAA,EAAU,SAAA,IAAa,EAAA,OACzB,KAAA,CAAM,SAAA,IAAa,mBAAA,CAAA,IAAA,CACrB,GAAA,CAAI,IAAA,EAAM,cAAA,EAAgB,IAAA,IAAQ,EAAA,OAChC,KAAA,CAAM,IAAA,IAAQ,oBAAA,CAAA;AAAA,EAErB,CAAC,CAAA;AACH;;;;"}
@@ -1,4 +1,4 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { Fragment } from 'react';
3
3
  import '@material-ui/core/Chip';
4
4
  import { StatusOK, SubvalueCell, StatusError, StatusAborted } from '@backstage/core-components';
@@ -1 +1 @@
1
- {"version":3,"file":"pod.esm.js","sources":["../../src/utils/pod.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n V1Pod,\n V1PodCondition,\n V1DeploymentCondition,\n} from '@kubernetes/client-node';\nimport { Fragment, ReactNode } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport {\n StatusAborted,\n StatusError,\n StatusOK,\n SubvalueCell,\n} from '@backstage/core-components';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { bytesToMiB, formatMillicores } from './resources';\n\nexport const imageChips = (pod: V1Pod): ReactNode => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const images = containerStatuses.map((cs, i) => {\n return <Chip key={i} label={`${cs.name}=${cs.image}`} size=\"small\" />;\n });\n\n return <div>{images}</div>;\n};\n\nexport const containersReady = (pod: Pod): string => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const containersReadyItem = containerStatuses.filter(cs => cs.ready).length;\n\n return `${containersReadyItem}/${containerStatuses.length}`;\n};\n\nexport const totalRestarts = (pod: Pod): number => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n return containerStatuses?.reduce((a, b) => a + b.restartCount, 0);\n};\n\nexport const containerStatuses = (pod: Pod): ReactNode => {\n const containerStatusesItem = pod.status?.containerStatuses ?? [];\n const errors = containerStatusesItem.reduce((accum, next) => {\n if (next.state === undefined) {\n return accum;\n }\n\n const waiting = next.state.waiting;\n const terminated = next.state.terminated;\n\n const renderCell = (reason: string | undefined) => (\n <Fragment key={`${pod.metadata?.name}-${next.name}`}>\n <SubvalueCell\n value={\n reason === 'Completed' ? (\n <StatusOK>Container: {next.name}</StatusOK>\n ) : (\n <StatusError>Container: {next.name}</StatusError>\n )\n }\n subvalue={reason}\n />\n <br />\n </Fragment>\n );\n\n if (waiting) {\n accum.push(renderCell(waiting.reason));\n }\n\n if (terminated) {\n accum.push(renderCell(terminated.reason));\n }\n\n return accum;\n }, [] as ReactNode[]);\n\n if (errors.length === 0) {\n return <StatusOK>OK</StatusOK>;\n }\n\n return errors;\n};\n\nexport const renderCondition = (\n condition: V1PodCondition | V1DeploymentCondition,\n): [string, ReactNode] => {\n const status = condition.status;\n\n if (status === 'True') {\n return [condition.type, <StatusOK>True</StatusOK>];\n } else if (status === 'False') {\n return [\n condition.type,\n <SubvalueCell\n value={<StatusError>False</StatusError>}\n subvalue={condition.message ?? ''}\n />,\n ];\n }\n return [condition.type, <StatusAborted />];\n};\n\n// visible for testing\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): string => {\n if (Number(resource) === 0) return `0%`;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return `${Math.round((current / resource) * 100)}%`;\n }\n\n const numerator: bigint = BigInt(\n typeof current === 'number' ? Math.round(current) : Number(current),\n );\n const denominator: bigint = BigInt(\n typeof resource === 'number' ? Math.round(resource) : Number(resource),\n );\n\n return `${(numerator * BigInt(100)) / denominator}%`;\n};\n\nexport const podStatusToCpuUtil = (podStatus: ClientPodStatus): ReactNode => {\n const cpuUtil = podStatus.cpu;\n\n let currentUsage: number | string = cpuUtil.currentUsage;\n\n // current usage number for CPU is a different unit than request/limit total\n // this might be a bug in the k8s library\n if (typeof cpuUtil.currentUsage === 'number') {\n currentUsage = cpuUtil.currentUsage / 10;\n }\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.requestTotal,\n )} of ${formatMillicores(cpuUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.limitTotal,\n )} of ${formatMillicores(cpuUtil.limitTotal)}`}\n />\n );\n};\n\nexport const podStatusToMemoryUtil = (\n podStatus: ClientPodStatus,\n): ReactNode => {\n const memUtil = podStatus.memory;\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.requestTotal,\n )} of ${bytesToMiB(memUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.limitTotal,\n )} of ${bytesToMiB(memUtil.limitTotal)}`}\n />\n );\n};\n"],"names":["containerStatuses"],"mappings":";;;;;;AA0Ca,MAAA,eAAA,GAAkB,CAAC,GAAqB,KAAA;AACnD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAC5D,EAAA,MAAM,sBAAsBA,kBAAkB,CAAA,MAAA,CAAO,CAAM,EAAA,KAAA,EAAA,CAAG,KAAK,CAAE,CAAA,MAAA;AAErE,EAAA,OAAO,CAAG,EAAA,mBAAmB,CAAIA,CAAAA,EAAAA,kBA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c,KAAA;AACd,EAAA,MAAM,UAAU,SAAU,CAAA,MAAA;AAE1B,EACE,uBAAA,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,OAAO,CAAa,UAAA,EAAA,+BAAA;AAAA,QAClB,OAAQ,CAAA,YAAA;AAAA,QACR,OAAQ,CAAA;AAAA,OACT,CAAA,IAAA,EAAO,UAAW,CAAA,OAAA,CAAQ,YAAY,CAAC,CAAA,CAAA;AAAA,MACxC,UAAU,CAAW,QAAA,EAAA,+BAAA;AAAA,QACnB,OAAQ,CAAA,YAAA;AAAA,QACR,OAAQ,CAAA;AAAA,OACT,CAAA,IAAA,EAAO,UAAW,CAAA,OAAA,CAAQ,UAAU,CAAC,CAAA;AAAA;AAAA,GACxC;AAEJ;;;;"}
1
+ {"version":3,"file":"pod.esm.js","sources":["../../src/utils/pod.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n V1Pod,\n V1PodCondition,\n V1DeploymentCondition,\n} from '@kubernetes/client-node';\nimport { Fragment, ReactNode } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport {\n StatusAborted,\n StatusError,\n StatusOK,\n SubvalueCell,\n} from '@backstage/core-components';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { bytesToMiB, formatMillicores } from './resources';\n\nexport const imageChips = (pod: V1Pod): ReactNode => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const images = containerStatuses.map((cs, i) => {\n return <Chip key={i} label={`${cs.name}=${cs.image}`} size=\"small\" />;\n });\n\n return <div>{images}</div>;\n};\n\nexport const containersReady = (pod: Pod): string => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const containersReadyItem = containerStatuses.filter(cs => cs.ready).length;\n\n return `${containersReadyItem}/${containerStatuses.length}`;\n};\n\nexport const totalRestarts = (pod: Pod): number => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n return containerStatuses?.reduce((a, b) => a + b.restartCount, 0);\n};\n\nexport const containerStatuses = (pod: Pod): ReactNode => {\n const containerStatusesItem = pod.status?.containerStatuses ?? [];\n const errors = containerStatusesItem.reduce((accum, next) => {\n if (next.state === undefined) {\n return accum;\n }\n\n const waiting = next.state.waiting;\n const terminated = next.state.terminated;\n\n const renderCell = (reason: string | undefined) => (\n <Fragment key={`${pod.metadata?.name}-${next.name}`}>\n <SubvalueCell\n value={\n reason === 'Completed' ? (\n <StatusOK>Container: {next.name}</StatusOK>\n ) : (\n <StatusError>Container: {next.name}</StatusError>\n )\n }\n subvalue={reason}\n />\n <br />\n </Fragment>\n );\n\n if (waiting) {\n accum.push(renderCell(waiting.reason));\n }\n\n if (terminated) {\n accum.push(renderCell(terminated.reason));\n }\n\n return accum;\n }, [] as ReactNode[]);\n\n if (errors.length === 0) {\n return <StatusOK>OK</StatusOK>;\n }\n\n return errors;\n};\n\nexport const renderCondition = (\n condition: V1PodCondition | V1DeploymentCondition,\n): [string, ReactNode] => {\n const status = condition.status;\n\n if (status === 'True') {\n return [condition.type, <StatusOK>True</StatusOK>];\n } else if (status === 'False') {\n return [\n condition.type,\n <SubvalueCell\n value={<StatusError>False</StatusError>}\n subvalue={condition.message ?? ''}\n />,\n ];\n }\n return [condition.type, <StatusAborted />];\n};\n\n// visible for testing\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): string => {\n if (Number(resource) === 0) return `0%`;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return `${Math.round((current / resource) * 100)}%`;\n }\n\n const numerator: bigint = BigInt(\n typeof current === 'number' ? Math.round(current) : Number(current),\n );\n const denominator: bigint = BigInt(\n typeof resource === 'number' ? Math.round(resource) : Number(resource),\n );\n\n return `${(numerator * BigInt(100)) / denominator}%`;\n};\n\nexport const podStatusToCpuUtil = (podStatus: ClientPodStatus): ReactNode => {\n const cpuUtil = podStatus.cpu;\n\n let currentUsage: number | string = cpuUtil.currentUsage;\n\n // current usage number for CPU is a different unit than request/limit total\n // this might be a bug in the k8s library\n if (typeof cpuUtil.currentUsage === 'number') {\n currentUsage = cpuUtil.currentUsage / 10;\n }\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.requestTotal,\n )} of ${formatMillicores(cpuUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.limitTotal,\n )} of ${formatMillicores(cpuUtil.limitTotal)}`}\n />\n );\n};\n\nexport const podStatusToMemoryUtil = (\n podStatus: ClientPodStatus,\n): ReactNode => {\n const memUtil = podStatus.memory;\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.requestTotal,\n )} of ${bytesToMiB(memUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.limitTotal,\n )} of ${bytesToMiB(memUtil.limitTotal)}`}\n />\n );\n};\n"],"names":["containerStatuses"],"mappings":";;;;;;AA0CO,MAAM,eAAA,GAAkB,CAAC,GAAA,KAAqB;AACnD,EAAA,MAAMA,kBAAAA,GAAoB,GAAA,CAAI,MAAA,EAAQ,iBAAA,IAAqB,EAAC;AAC5D,EAAA,MAAM,sBAAsBA,kBAAAA,CAAkB,MAAA,CAAO,CAAA,EAAA,KAAM,EAAA,CAAG,KAAK,CAAA,CAAE,MAAA;AAErE,EAAA,OAAO,CAAA,EAAG,mBAAmB,CAAA,CAAA,EAAIA,kBAAAA,CAAkB,MAAM,CAAA,CA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wB,CACnC,SAAA,KACc;AACd,EAAA,MAAM,UAAU,SAAA,CAAU,MAAA;AAE1B,EAAA,uBACE,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,OAAO,CAAA,UAAA,EAAa,+BAAA;AAAA,QAClB,OAAA,CAAQ,YAAA;AAAA,QACR,OAAA,CAAQ;AAAA,OACT,CAAA,IAAA,EAAO,UAAA,CAAW,OAAA,CAAQ,YAAY,CAAC,CAAA,CAAA;AAAA,MACxC,UAAU,CAAA,QAAA,EAAW,+BAAA;AAAA,QACnB,OAAA,CAAQ,YAAA;AAAA,QACR,OAAA,CAAQ;AAAA,OACT,CAAA,IAAA,EAAO,UAAA,CAAW,OAAA,CAAQ,UAAU,CAAC,CAAA;AAAA;AAAA,GACxC;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"resources.esm.js","sources":["../../src/utils/resources.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): number => {\n if (Number(resource) === 0) return 0;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return Math.round((current / resource) * 100);\n }\n\n const numerator: bigint = BigInt(\n typeof current === 'number' ? Math.round(current) : Number(current),\n );\n const denominator: bigint = BigInt(\n typeof resource === 'number' ? Math.round(resource) : Number(resource),\n );\n\n return Number((numerator * BigInt(100)) / denominator);\n};\n\nexport const bytesToMiB = (value: string | number): string => {\n return `${(parseFloat(value.toString()) / 1024 / 1024).toFixed(0)}MiB`;\n};\n\nexport const formatMillicores = (value: string | number): string => {\n return `${(parseFloat(value.toString()) * 1000).toFixed(0)}m`;\n};\n"],"names":[],"mappings":"AAea,MAAA,+BAAA,GAAkC,CAC7C,OAAA,EACA,QACW,KAAA;AACX,EAAA,IAAI,MAAO,CAAA,QAAQ,CAAM,KAAA,CAAA,EAAU,OAAA,CAAA;AAEnC,EAAA,IAAI,OAAO,OAAA,KAAY,QAAY,IAAA,OAAO,aAAa,QAAU,EAAA;AAC/D,IAAA,OAAO,IAAK,CAAA,KAAA,CAAO,OAAU,GAAA,QAAA,GAAY,GAAG,CAAA;AAAA;AAG9C,EAAA,MAAM,SAAoB,GAAA,MAAA;AAAA,IACxB,OAAO,YAAY,QAAW,GAAA,IAAA,CAAK,MAAM,OAAO,CAAA,GAAI,OAAO,OAAO;AAAA,GACpE;AACA,EAAA,MAAM,WAAsB,GAAA,MAAA;AAAA,IAC1B,OAAO,aAAa,QAAW,GAAA,IAAA,CAAK,MAAM,QAAQ,CAAA,GAAI,OAAO,QAAQ;AAAA,GACvE;AAEA,EAAA,OAAO,MAAQ,CAAA,SAAA,GAAY,MAAO,CAAA,GAAG,IAAK,WAAW,CAAA;AACvD;AAEa,MAAA,UAAA,GAAa,CAAC,KAAmC,KAAA;AAC5D,EAAO,OAAA,CAAA,EAAA,CAAI,UAAW,CAAA,KAAA,CAAM,QAAS,EAAC,IAAI,IAAO,GAAA,IAAA,EAAM,OAAQ,CAAA,CAAC,CAAC,CAAA,GAAA,CAAA;AACnE;AAEa,MAAA,gBAAA,GAAmB,CAAC,KAAmC,KAAA;AAClE,EAAO,OAAA,CAAA,EAAA,CAAI,WAAW,KAAM,CAAA,QAAA,EAAU,CAAI,GAAA,GAAA,EAAM,OAAQ,CAAA,CAAC,CAAC,CAAA,CAAA,CAAA;AAC5D;;;;"}
1
+ {"version":3,"file":"resources.esm.js","sources":["../../src/utils/resources.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): number => {\n if (Number(resource) === 0) return 0;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return Math.round((current / resource) * 100);\n }\n\n const numerator: bigint = BigInt(\n typeof current === 'number' ? Math.round(current) : Number(current),\n );\n const denominator: bigint = BigInt(\n typeof resource === 'number' ? Math.round(resource) : Number(resource),\n );\n\n return Number((numerator * BigInt(100)) / denominator);\n};\n\nexport const bytesToMiB = (value: string | number): string => {\n return `${(parseFloat(value.toString()) / 1024 / 1024).toFixed(0)}MiB`;\n};\n\nexport const formatMillicores = (value: string | number): string => {\n return `${(parseFloat(value.toString()) * 1000).toFixed(0)}m`;\n};\n"],"names":[],"mappings":"AAeO,MAAM,+BAAA,GAAkC,CAC7C,OAAA,EACA,QAAA,KACW;AACX,EAAA,IAAI,MAAA,CAAO,QAAQ,CAAA,KAAM,CAAA,EAAG,OAAO,CAAA;AAEnC,EAAA,IAAI,OAAO,OAAA,KAAY,QAAA,IAAY,OAAO,aAAa,QAAA,EAAU;AAC/D,IAAA,OAAO,IAAA,CAAK,KAAA,CAAO,OAAA,GAAU,QAAA,GAAY,GAAG,CAAA;AAAA,EAC9C;AAEA,EAAA,MAAM,SAAA,GAAoB,MAAA;AAAA,IACxB,OAAO,YAAY,QAAA,GAAW,IAAA,CAAK,MAAM,OAAO,CAAA,GAAI,OAAO,OAAO;AAAA,GACpE;AACA,EAAA,MAAM,WAAA,GAAsB,MAAA;AAAA,IAC1B,OAAO,aAAa,QAAA,GAAW,IAAA,CAAK,MAAM,QAAQ,CAAA,GAAI,OAAO,QAAQ;AAAA,GACvE;AAEA,EAAA,OAAO,MAAA,CAAQ,SAAA,GAAY,MAAA,CAAO,GAAG,IAAK,WAAW,CAAA;AACvD;AAEO,MAAM,UAAA,GAAa,CAAC,KAAA,KAAmC;AAC5D,EAAA,OAAO,CAAA,EAAA,CAAI,UAAA,CAAW,KAAA,CAAM,QAAA,EAAU,IAAI,IAAA,GAAO,IAAA,EAAM,OAAA,CAAQ,CAAC,CAAC,CAAA,GAAA,CAAA;AACnE;AAEO,MAAM,gBAAA,GAAmB,CAAC,KAAA,KAAmC;AAClE,EAAA,OAAO,CAAA,EAAA,CAAI,WAAW,KAAA,CAAM,QAAA,EAAU,CAAA,GAAI,GAAA,EAAM,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA,CAAA;AAC5D;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-kubernetes-react",
3
- "version": "0.5.10-next.0",
3
+ "version": "0.5.10",
4
4
  "description": "Web library for the kubernetes-react plugin",
5
5
  "backstage": {
6
6
  "role": "web-library",
@@ -62,12 +62,12 @@
62
62
  "test": "backstage-cli package test"
63
63
  },
64
64
  "dependencies": {
65
- "@backstage/catalog-model": "1.7.5",
66
- "@backstage/core-components": "0.17.5-next.0",
67
- "@backstage/core-plugin-api": "1.10.9",
68
- "@backstage/errors": "1.2.7",
69
- "@backstage/plugin-kubernetes-common": "0.9.6",
70
- "@backstage/types": "1.2.1",
65
+ "@backstage/catalog-model": "^1.7.5",
66
+ "@backstage/core-components": "^0.17.5",
67
+ "@backstage/core-plugin-api": "^1.10.9",
68
+ "@backstage/errors": "^1.2.7",
69
+ "@backstage/plugin-kubernetes-common": "^0.9.6",
70
+ "@backstage/types": "^1.2.1",
71
71
  "@kubernetes-models/apimachinery": "^2.0.0",
72
72
  "@kubernetes-models/base": "^5.0.0",
73
73
  "@kubernetes/client-node": "1.1.2",
@@ -85,9 +85,9 @@
85
85
  "react-use": "^17.4.0"
86
86
  },
87
87
  "devDependencies": {
88
- "@backstage/cli": "0.33.2-next.0",
89
- "@backstage/core-app-api": "1.18.0",
90
- "@backstage/test-utils": "1.7.11-next.0",
88
+ "@backstage/cli": "^0.34.0",
89
+ "@backstage/core-app-api": "^1.18.0",
90
+ "@backstage/test-utils": "^1.7.11",
91
91
  "@testing-library/jest-dom": "^6.0.0",
92
92
  "@testing-library/react": "^16.0.0",
93
93
  "@types/react": "^18.0.0",