Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kubernetes plugin #5

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@backstage/plugin-catalog-import": "^0.10.4",
"@backstage/plugin-catalog-react": "^1.9.2",
"@backstage/plugin-github-actions": "^0.6.9",
"@backstage/plugin-kubernetes": "^0.11.4",
"@backstage/plugin-org": "^0.6.18",
"@backstage/plugin-permission-react": "^0.4.18",
"@backstage/plugin-scaffolder": "^1.17.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/app/src/components/catalog/EntityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {

import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';
import { EntityKubernetesContent } from '@backstage/plugin-kubernetes';

const techdocsContent = (
<EntityTechdocsContent>
Expand Down Expand Up @@ -175,6 +176,10 @@ const serviceEntityPage = (
<EntityLayout.Route path="/docs" title="Docs">
{techdocsContent}
</EntityLayout.Route>

<EntityLayout.Route path="/kubernetes" title="Kubernetes">
<EntityKubernetesContent refreshIntervalMs={30000} />
</EntityLayout.Route>
</EntityLayout>
);

Expand Down
1 change: 1 addition & 0 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@backstage/plugin-auth-node": "^0.4.2",
"@backstage/plugin-catalog-backend": "^1.16.0",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.1.5",
"@backstage/plugin-kubernetes-backend": "^0.14.1",
"@backstage/plugin-permission-common": "^0.7.11",
"@backstage/plugin-permission-node": "^0.7.19",
"@backstage/plugin-proxy-backend": "^0.4.6",
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import search from './plugins/search';
import { PluginEnvironment } from './types';
import { ServerPermissionClient } from '@backstage/plugin-permission-node';
import { DefaultIdentityClient } from '@backstage/plugin-auth-node';
import kubernetes from './plugins/kubernetes';

function makeCreateEnv(config: Config) {
const root = getRootLogger();
Expand Down Expand Up @@ -85,6 +86,7 @@ async function main() {
const techdocsEnv = useHotMemoize(module, () => createEnv('techdocs'));
const searchEnv = useHotMemoize(module, () => createEnv('search'));
const appEnv = useHotMemoize(module, () => createEnv('app'));
const kubernetesEnv = useHotMemoize(module, () => createEnv('kubernetes'));

const apiRouter = Router();
apiRouter.use('/catalog', await catalog(catalogEnv));
Expand All @@ -93,6 +95,7 @@ async function main() {
apiRouter.use('/techdocs', await techdocs(techdocsEnv));
apiRouter.use('/proxy', await proxy(proxyEnv));
apiRouter.use('/search', await search(searchEnv));
apiRouter.use('/kubernetes', await kubernetes(kubernetesEnv));

// Add backends ABOVE this line; this 404 handler is the catch-all fallback
apiRouter.use(notFoundHandler());
Expand Down
17 changes: 17 additions & 0 deletions packages/backend/src/plugins/kubernetes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { KubernetesBuilder } from '@backstage/plugin-kubernetes-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
import { CatalogClient } from '@backstage/catalog-client';

export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
const catalogApi = new CatalogClient({ discoveryApi: env.discovery });
const { router } = await KubernetesBuilder.createBuilder({
logger: env.logger,
config: env.config,
catalogApi,
permissions: env.permissions,
}).build();
return router;
}
Loading
Loading