diff --git a/plugins/kubernetes-cluster/package.json b/plugins/kubernetes-cluster/package.json
index 78ff79e43b..cd204eaf9c 100644
--- a/plugins/kubernetes-cluster/package.json
+++ b/plugins/kubernetes-cluster/package.json
@@ -10,9 +10,7 @@
]
},
"publishConfig": {
- "access": "public",
- "main": "dist/index.esm.js",
- "types": "dist/index.d.ts"
+ "access": "public"
},
"keywords": [
"backstage",
@@ -26,8 +24,23 @@
},
"license": "Apache-2.0",
"sideEffects": false,
+ "exports": {
+ ".": "./src/index.ts",
+ "./alpha": "./src/alpha.ts",
+ "./package.json": "./package.json"
+ },
"main": "src/index.ts",
"types": "src/index.ts",
+ "typesVersions": {
+ "*": {
+ "alpha": [
+ "src/alpha.ts"
+ ],
+ "package.json": [
+ "package.json"
+ ]
+ }
+ },
"files": [
"dist"
],
diff --git a/plugins/kubernetes-cluster/report-alpha.api.md b/plugins/kubernetes-cluster/report-alpha.api.md
new file mode 100644
index 0000000000..13314d6c83
--- /dev/null
+++ b/plugins/kubernetes-cluster/report-alpha.api.md
@@ -0,0 +1,18 @@
+## API Report File for "@backstage/plugin-kubernetes-cluster"
+
+> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
+
+```ts
+import { TranslationRef } from '@backstage/core-plugin-api/alpha';
+
+// @alpha (undocumented)
+export const kubernetesClusterTranslationRef: TranslationRef<
+ 'kubernetes-cluster',
+ {
+ readonly 'kubernetesClusterContentPage.permissionAlert.message': "To view Kubernetes objects, contact your portal administrator to give you the 'kubernetes.clusters.read' permission.";
+ readonly 'kubernetesClusterContentPage.permissionAlert.title': 'Permission required';
+ }
+>;
+
+// (No @packageDocumentation comment for this package)
+```
diff --git a/plugins/kubernetes-cluster/src/alpha.ts b/plugins/kubernetes-cluster/src/alpha.ts
new file mode 100644
index 0000000000..e49b7ac9c9
--- /dev/null
+++ b/plugins/kubernetes-cluster/src/alpha.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2025 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export { kubernetesClusterTranslationRef } from './translation';
diff --git a/plugins/kubernetes-cluster/src/components/KubernetesClusterContent/KubernetesClusterContent.tsx b/plugins/kubernetes-cluster/src/components/KubernetesClusterContent/KubernetesClusterContent.tsx
index 11293a41a7..2a824d329a 100644
--- a/plugins/kubernetes-cluster/src/components/KubernetesClusterContent/KubernetesClusterContent.tsx
+++ b/plugins/kubernetes-cluster/src/components/KubernetesClusterContent/KubernetesClusterContent.tsx
@@ -26,6 +26,8 @@ import {
import { WarningPanel } from '@backstage/core-components';
import { kubernetesClustersReadPermission } from '@backstage/plugin-kubernetes-common';
import { RequirePermission } from '@backstage/plugin-permission-react';
+import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
+import { kubernetesClusterTranslationRef } from '../../translation';
const ContentGrid = () => {
const { error } = useKubernetesClusterError();
@@ -59,14 +61,15 @@ const ContentGrid = () => {
* @public
*/
export const KubernetesClusterContent = () => {
+ const { t } = useTranslationRef(kubernetesClusterTranslationRef);
+
return (
}
>
diff --git a/plugins/kubernetes-cluster/src/translation.ts b/plugins/kubernetes-cluster/src/translation.ts
new file mode 100644
index 0000000000..ba99c6744e
--- /dev/null
+++ b/plugins/kubernetes-cluster/src/translation.ts
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2025 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { createTranslationRef } from '@backstage/core-plugin-api/alpha';
+
+/** @alpha */
+export const kubernetesClusterTranslationRef = createTranslationRef({
+ id: 'kubernetes-cluster',
+ messages: {
+ kubernetesClusterContentPage: {
+ permissionAlert: {
+ title: 'Permission required',
+ message:
+ "To view Kubernetes objects, contact your portal administrator to give you the 'kubernetes.clusters.read' permission.",
+ },
+ },
+ },
+});
diff --git a/plugins/kubernetes/report-alpha.api.md b/plugins/kubernetes/report-alpha.api.md
index 4f779df258..ea04986595 100644
--- a/plugins/kubernetes/report-alpha.api.md
+++ b/plugins/kubernetes/report-alpha.api.md
@@ -13,6 +13,7 @@ import { ExtensionDefinition } from '@backstage/frontend-plugin-api';
import { FrontendPlugin } from '@backstage/frontend-plugin-api';
import { JSX as JSX_2 } from 'react';
import { RouteRef } from '@backstage/frontend-plugin-api';
+import { TranslationRef } from '@backstage/core-plugin-api/alpha';
// @public (undocumented)
const _default: FrontendPlugin<
@@ -47,21 +48,6 @@ const _default: FrontendPlugin<
routeRef?: RouteRef | undefined;
};
}>;
- 'api:kubernetes': ExtensionDefinition<{
- kind: 'api';
- name: undefined;
- config: {};
- configInput: {};
- output: ConfigurableExtensionDataRef<
- AnyApiFactory,
- 'core.api.factory',
- {}
- >;
- inputs: {};
- params: {
- factory: AnyApiFactory;
- };
- }>;
'entity-content:kubernetes/kubernetes': ExtensionDefinition<{
kind: 'entity-content';
name: 'kubernetes';
@@ -113,6 +99,21 @@ const _default: FrontendPlugin<
filter?: string | ((entity: Entity) => boolean) | undefined;
};
}>;
+ 'api:kubernetes': ExtensionDefinition<{
+ kind: 'api';
+ name: undefined;
+ config: {};
+ configInput: {};
+ output: ConfigurableExtensionDataRef<
+ AnyApiFactory,
+ 'core.api.factory',
+ {}
+ >;
+ inputs: {};
+ params: {
+ factory: AnyApiFactory;
+ };
+ }>;
'api:kubernetes/proxy': ExtensionDefinition<{
kind: 'api';
name: 'proxy';
@@ -162,5 +163,14 @@ const _default: FrontendPlugin<
>;
export default _default;
+// @alpha (undocumented)
+export const kubernetesTranslationRef: TranslationRef<
+ 'kubernetes',
+ {
+ readonly 'kubernetesContentPage.permissionAlert.message': "To view Kubernetes objects, contact your portal administrator to give you the 'kubernetes.clusters.read' and 'kubernetes.resources.read' permission.";
+ readonly 'kubernetesContentPage.permissionAlert.title': 'Permission required';
+ }
+>;
+
// (No @packageDocumentation comment for this package)
```
diff --git a/plugins/kubernetes/src/RequireKubernetesPermissions.tsx b/plugins/kubernetes/src/RequireKubernetesPermissions.tsx
index 92a88e5b9c..efc83e8ef8 100644
--- a/plugins/kubernetes/src/RequireKubernetesPermissions.tsx
+++ b/plugins/kubernetes/src/RequireKubernetesPermissions.tsx
@@ -20,6 +20,8 @@ import {
} from '@backstage/plugin-kubernetes-common';
import { usePermission } from '@backstage/plugin-permission-react';
import { WarningPanel } from '@backstage/core-components';
+import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
+import { kubernetesTranslationRef } from './alpha/translation';
export type RequireKubernetesPermissionProps = {
children: ReactNode;
@@ -34,6 +36,7 @@ export function RequireKubernetesPermissions(
const kubernetesResourcesPermissionResult = usePermission({
permission: kubernetesResourcesReadPermission,
});
+ const { t } = useTranslationRef(kubernetesTranslationRef);
if (
kubernetesClustersPermissionResult.loading ||
@@ -51,9 +54,8 @@ export function RequireKubernetesPermissions(
return (
);
}
diff --git a/plugins/kubernetes/src/alpha/index.ts b/plugins/kubernetes/src/alpha/index.ts
index 2f137f09ee..23888f968f 100644
--- a/plugins/kubernetes/src/alpha/index.ts
+++ b/plugins/kubernetes/src/alpha/index.ts
@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+export { kubernetesTranslationRef } from './translation';
export { default } from './plugin';
diff --git a/plugins/kubernetes/src/alpha/translation.ts b/plugins/kubernetes/src/alpha/translation.ts
new file mode 100644
index 0000000000..7f9704af84
--- /dev/null
+++ b/plugins/kubernetes/src/alpha/translation.ts
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2025 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { createTranslationRef } from '@backstage/core-plugin-api/alpha';
+
+/** @alpha */
+export const kubernetesTranslationRef = createTranslationRef({
+ id: 'kubernetes',
+ messages: {
+ kubernetesContentPage: {
+ permissionAlert: {
+ title: 'Permission required',
+ message:
+ "To view Kubernetes objects, contact your portal administrator to give you the 'kubernetes.clusters.read' and 'kubernetes.resources.read' permission.",
+ },
+ },
+ },
+});