kubernetes plugin adds support for the new plugin system (#16719)

* kubernetes plugin adds support for the new plugin system

Signed-off-by: Oleg S <97077423+RobotSail@users.noreply.github.com>

* expose experimental plugin support as an alpha feature in kubernetes-backend

Signed-off-by: Oleg S <97077423+RobotSail@users.noreply.github.com>

* remove duplicate changeset

Signed-off-by: Oleg S <97077423+RobotSail@users.noreply.github.com>

* update permissions

Signed-off-by: Oleg S <97077423+RobotSail@users.noreply.github.com>

---------

Signed-off-by: Oleg S <97077423+RobotSail@users.noreply.github.com>
This commit is contained in:
Oleg
2023-03-28 11:19:00 -04:00
committed by GitHub
parent f27862ed25
commit 88fbb3d075
8 changed files with 111 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-kubernetes-backend': minor
---
Add support for the new plugin system to the Kubernetes plugin
+1
View File
@@ -28,6 +28,7 @@
"@backstage/backend-defaults": "workspace:^",
"@backstage/plugin-app-backend": "workspace:^",
"@backstage/plugin-catalog-backend": "workspace:^",
"@backstage/plugin-kubernetes-backend": "workspace:^",
"@backstage/plugin-scaffolder-backend": "workspace:^",
"@backstage/plugin-search-backend": "workspace:^",
"@backstage/plugin-search-backend-module-catalog": "workspace:^",
+3
View File
@@ -24,6 +24,7 @@ import { searchPlugin } from '@backstage/plugin-search-backend/alpha';
import { searchModuleCatalogCollator } from '@backstage/plugin-search-backend-module-catalog/alpha';
import { searchModuleTechDocsCollator } from '@backstage/plugin-search-backend-module-techdocs/alpha';
import { searchModuleExploreCollator } from '@backstage/plugin-search-backend-module-explore/alpha';
import { kubernetesPlugin } from '@backstage/plugin-kubernetes-backend/alpha';
const backend = createBackend();
@@ -45,4 +46,6 @@ backend.add(searchModuleCatalogCollator());
backend.add(searchModuleTechDocsCollator());
backend.add(searchModuleExploreCollator());
// Kubernetes
backend.add(kubernetesPlugin());
backend.start();
@@ -0,0 +1,12 @@
## API Report File for "@backstage/plugin-kubernetes-backend"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { BackendFeature } from '@backstage/backend-plugin-api';
// @alpha
export const kubernetesPlugin: () => BackendFeature;
// (No @packageDocumentation comment for this package)
```
+17
View File
@@ -10,6 +10,21 @@
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
},
"exports": {
".": "./src/index.ts",
"./alpha": "./src/alpha.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"alpha": [
"src/alpha.ts"
],
"package.json": [
"package.json"
]
}
},
"backstage": {
"role": "backend-plugin"
},
@@ -36,11 +51,13 @@
"dependencies": {
"@azure/identity": "^2.0.4",
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/catalog-client": "workspace:^",
"@backstage/catalog-model": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/plugin-auth-node": "workspace:^",
"@backstage/plugin-catalog-node": "workspace:^",
"@backstage/plugin-kubernetes-common": "workspace:^",
"@backstage/plugin-permission-common": "workspace:^",
"@backstage/plugin-permission-node": "workspace:^",
+16
View File
@@ -0,0 +1,16 @@
/*
* Copyright 2023 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 { kubernetesPlugin } from './plugin';
+54
View File
@@ -0,0 +1,54 @@
/*
* Copyright 2023 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 { loggerToWinstonLogger } from '@backstage/backend-common';
import {
createBackendPlugin,
coreServices,
} from '@backstage/backend-plugin-api';
import { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';
import { KubernetesBuilder } from '@backstage/plugin-kubernetes-backend';
/**
* This is the backend plugin that provides the Kubernetes integration.
* @alpha
*/
export const kubernetesPlugin = createBackendPlugin({
pluginId: 'kubernetes-backend',
register(env) {
env.registerInit({
deps: {
http: coreServices.httpRouter,
logger: coreServices.logger,
config: coreServices.config,
catalogApi: catalogServiceRef,
permissions: coreServices.permissions,
},
async init({ http, logger, config, catalogApi, permissions }) {
const winstonLogger = loggerToWinstonLogger(logger);
// TODO: expose all of the customization & extension points of the builder here
const { router } = await KubernetesBuilder.createBuilder({
logger: winstonLogger,
config,
catalogApi,
permissions,
}).build();
http.use(router);
},
});
},
});
+3
View File
@@ -7031,6 +7031,7 @@ __metadata:
dependencies:
"@azure/identity": ^2.0.4
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/catalog-client": "workspace:^"
"@backstage/catalog-model": "workspace:^"
@@ -7038,6 +7039,7 @@ __metadata:
"@backstage/config": "workspace:^"
"@backstage/errors": "workspace:^"
"@backstage/plugin-auth-node": "workspace:^"
"@backstage/plugin-catalog-node": "workspace:^"
"@backstage/plugin-kubernetes-common": "workspace:^"
"@backstage/plugin-permission-common": "workspace:^"
"@backstage/plugin-permission-node": "workspace:^"
@@ -23396,6 +23398,7 @@ __metadata:
"@backstage/cli": "workspace:^"
"@backstage/plugin-app-backend": "workspace:^"
"@backstage/plugin-catalog-backend": "workspace:^"
"@backstage/plugin-kubernetes-backend": "workspace:^"
"@backstage/plugin-scaffolder-backend": "workspace:^"
"@backstage/plugin-search-backend": "workspace:^"
"@backstage/plugin-search-backend-module-catalog": "workspace:^"