@kuadrant/kuadrant-backstage-plugin-backend 0.0.1-test.1-1593c3ec

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.
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ var backendPluginApi = require('@backstage/backend-plugin-api');
4
+ var router = require('./router.cjs.js');
5
+ var permissionsRouter = require('./permissions-router.cjs.js');
6
+
7
+ const kuadrantPlugin = backendPluginApi.createBackendPlugin({
8
+ pluginId: "kuadrant",
9
+ register(env) {
10
+ env.registerInit({
11
+ deps: {
12
+ httpAuth: backendPluginApi.coreServices.httpAuth,
13
+ userInfo: backendPluginApi.coreServices.userInfo,
14
+ httpRouter: backendPluginApi.coreServices.httpRouter,
15
+ config: backendPluginApi.coreServices.rootConfig,
16
+ permissions: backendPluginApi.coreServices.permissions
17
+ },
18
+ async init({ httpAuth, userInfo, httpRouter, config, permissions }) {
19
+ httpRouter.addAuthPolicy({
20
+ path: "/",
21
+ allow: "unauthenticated"
22
+ });
23
+ httpRouter.use(permissionsRouter.createKuadrantPermissionIntegrationRouter());
24
+ httpRouter.use(
25
+ await router.createRouter({
26
+ httpAuth,
27
+ userInfo,
28
+ config,
29
+ permissions
30
+ })
31
+ );
32
+ }
33
+ });
34
+ }
35
+ });
36
+
37
+ exports.kuadrantPlugin = kuadrantPlugin;
38
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["../src/plugin.ts"],"sourcesContent":["import {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { createRouter } from './router';\nimport { createKuadrantPermissionIntegrationRouter } from './permissions-router';\n\n/**\n * kuadrantPlugin backend plugin\n *\n * @public\n */\nexport const kuadrantPlugin = createBackendPlugin({\n pluginId: 'kuadrant',\n register(env) {\n // register http router\n env.registerInit({\n deps: {\n httpAuth: coreServices.httpAuth,\n userInfo: coreServices.userInfo,\n httpRouter: coreServices.httpRouter,\n config: coreServices.rootConfig,\n permissions: coreServices.permissions,\n },\n async init({ httpAuth, userInfo, httpRouter, config, permissions }) {\n // allow unauthenticated access at HTTP router level\n // authorization is enforced in the router via:\n // 1. group-based checks (isAdmin from platform-engineers group)\n // 2. permission framework checks (when credentials available)\n // this allows the app to work in development mode with guest auth\n // while still providing proper authorization\n httpRouter.addAuthPolicy({\n path: '/',\n allow: 'unauthenticated',\n });\n\n // register permission integration router for rbac discovery\n httpRouter.use(createKuadrantPermissionIntegrationRouter());\n\n // register main api router\n httpRouter.use(\n await createRouter({\n httpAuth,\n userInfo,\n config,\n permissions,\n }),\n );\n },\n });\n },\n});\n"],"names":["createBackendPlugin","coreServices","createKuadrantPermissionIntegrationRouter","createRouter"],"mappings":";;;;;;AAYO,MAAM,iBAAiBA,oCAAoB,CAAA;AAAA,EAChD,QAAU,EAAA,UAAA;AAAA,EACV,SAAS,GAAK,EAAA;AAEZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,UAAUC,6BAAa,CAAA,QAAA;AAAA,QACvB,UAAUA,6BAAa,CAAA,QAAA;AAAA,QACvB,YAAYA,6BAAa,CAAA,UAAA;AAAA,QACzB,QAAQA,6BAAa,CAAA,UAAA;AAAA,QACrB,aAAaA,6BAAa,CAAA;AAAA,OAC5B;AAAA,MACA,MAAM,KAAK,EAAE,QAAA,EAAU,UAAU,UAAY,EAAA,MAAA,EAAQ,aAAe,EAAA;AAOlE,QAAA,UAAA,CAAW,aAAc,CAAA;AAAA,UACvB,IAAM,EAAA,GAAA;AAAA,UACN,KAAO,EAAA;AAAA,SACR,CAAA;AAGD,QAAW,UAAA,CAAA,GAAA,CAAIC,6DAA2C,CAAA;AAG1D,QAAW,UAAA,CAAA,GAAA;AAAA,UACT,MAAMC,mBAAa,CAAA;AAAA,YACjB,QAAA;AAAA,YACA,QAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA,WACD;AAAA,SACH;AAAA;AACF,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
@@ -0,0 +1,131 @@
1
+ 'use strict';
2
+
3
+ var k8sClient = require('../k8s-client.cjs.js');
4
+
5
+ class APIProductEntityProvider {
6
+ k8sClient;
7
+ connection;
8
+ providerId = "kuadrant-apiproduct-provider";
9
+ constructor(config) {
10
+ console.log("apiproduct provider: constructor called");
11
+ this.k8sClient = new k8sClient.KuadrantK8sClient(config);
12
+ }
13
+ getProviderName() {
14
+ return this.providerId;
15
+ }
16
+ async connect(connection) {
17
+ console.log("apiproduct provider: connect called");
18
+ this.connection = connection;
19
+ console.log("apiproduct provider: starting initial sync");
20
+ await this.refresh();
21
+ console.log("apiproduct provider: scheduling periodic refresh every 30 seconds");
22
+ setInterval(async () => {
23
+ await this.refresh();
24
+ }, 30 * 1e3);
25
+ }
26
+ async refresh() {
27
+ console.log("apiproduct provider: refresh called");
28
+ if (!this.connection) {
29
+ console.log("apiproduct provider: no connection, skipping refresh");
30
+ return;
31
+ }
32
+ try {
33
+ console.log("apiproduct provider: fetching apiproducts from kubernetes");
34
+ const response = await this.k8sClient.listCustomResources(
35
+ "extensions.kuadrant.io",
36
+ "v1alpha1",
37
+ "apiproducts"
38
+ );
39
+ const apiProducts = response.items || [];
40
+ console.log(`apiproduct provider: found ${apiProducts.length} apiproducts`);
41
+ const entities = apiProducts.map((product) => this.transformToEntity(product));
42
+ console.log(`apiproduct provider: transformed ${entities.length} entities`);
43
+ console.log("apiproduct provider: submitting entities to catalog");
44
+ await this.connection.applyMutation({
45
+ type: "full",
46
+ entities: entities.map((entity) => ({
47
+ entity,
48
+ locationKey: `kuadrant-apiproduct:${entity.metadata.namespace}/${entity.metadata.name}`
49
+ }))
50
+ });
51
+ console.log(`apiproduct provider: synced ${entities.length} api products`);
52
+ } catch (error) {
53
+ console.error("error refreshing apiproduct entities:", error);
54
+ }
55
+ }
56
+ transformToEntity(product) {
57
+ const namespace = product.metadata.namespace || "default";
58
+ const name = product.metadata.name;
59
+ const displayName = product.spec.displayName || name;
60
+ const description = product.spec.description || `api product: ${displayName}`;
61
+ const lifecycle = product.metadata.labels?.lifecycle || "production";
62
+ const owner = product.spec.contact?.team || "guests";
63
+ const tags = product.spec.tags || [];
64
+ const entity = {
65
+ apiVersion: "backstage.io/v1alpha1",
66
+ kind: "API",
67
+ metadata: {
68
+ name: `${name}`,
69
+ namespace: "default",
70
+ title: displayName,
71
+ description,
72
+ annotations: {
73
+ "backstage.io/managed-by-location": `kuadrant:${namespace}/${name}`,
74
+ "backstage.io/managed-by-origin-location": `kuadrant:${namespace}/${name}`,
75
+ "backstage.io/orphan-strategy": "keep",
76
+ "kuadrant.io/namespace": namespace,
77
+ "kuadrant.io/apiproduct": name,
78
+ // add httproute annotation if we can infer it (usually same as apiproduct name without -api suffix)
79
+ "kuadrant.io/httproute": name.endsWith("-api") ? name.slice(0, -4) : name,
80
+ ...product.spec.documentation?.openAPISpec && {
81
+ "kuadrant.io/openapi-spec-url": product.spec.documentation.openAPISpec
82
+ },
83
+ ...product.spec.documentation?.docsURL && {
84
+ "kuadrant.io/docs-url": product.spec.documentation.docsURL
85
+ },
86
+ ...product.spec.documentation?.gitRepository && {
87
+ "backstage.io/source-location": `url:${product.spec.documentation.gitRepository}`
88
+ },
89
+ ...product.spec.documentation?.techdocsRef && {
90
+ "backstage.io/techdocs-ref": product.spec.documentation.techdocsRef
91
+ },
92
+ ...product.spec.contact?.email && {
93
+ "kuadrant.io/contact-email": product.spec.contact.email
94
+ },
95
+ ...product.spec.contact?.slack && {
96
+ "kuadrant.io/contact-slack": product.spec.contact.slack
97
+ }
98
+ },
99
+ tags: [...tags, "kuadrant", "apiproduct"],
100
+ labels: {
101
+ "kuadrant.io/synced": "true",
102
+ ...product.metadata.labels || {}
103
+ }
104
+ },
105
+ spec: {
106
+ type: "openapi",
107
+ lifecycle,
108
+ owner,
109
+ definition: product.spec.documentation?.openAPISpec ? `# openapi spec available at: ${product.spec.documentation.openAPISpec}
110
+
111
+ openapi: 3.0.0
112
+ info:
113
+ title: ${displayName}
114
+ version: ${product.spec.version || "1.0.0"}
115
+ description: ${description}
116
+ ` : `# no openapi spec configured
117
+
118
+ openapi: 3.0.0
119
+ info:
120
+ title: ${displayName}
121
+ version: ${product.spec.version || "1.0.0"}
122
+ description: ${description}
123
+ `
124
+ }
125
+ };
126
+ return entity;
127
+ }
128
+ }
129
+
130
+ exports.APIProductEntityProvider = APIProductEntityProvider;
131
+ //# sourceMappingURL=APIProductEntityProvider.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"APIProductEntityProvider.cjs.js","sources":["../../src/providers/APIProductEntityProvider.ts"],"sourcesContent":["import { ApiEntity } from '@backstage/catalog-model';\nimport { EntityProvider, EntityProviderConnection } from '@backstage/plugin-catalog-node';\nimport { RootConfigService } from '@backstage/backend-plugin-api';\nimport { KuadrantK8sClient } from '../k8s-client';\n\ninterface APIProduct {\n apiVersion: string;\n kind: string;\n metadata: {\n name: string;\n namespace: string;\n uid: string;\n resourceVersion: string;\n creationTimestamp: string;\n annotations?: Record<string, string>;\n labels?: Record<string, string>;\n };\n spec: {\n displayName?: string;\n description?: string;\n version?: string;\n tags?: string[];\n plans?: Array<{\n tier: string;\n description?: string;\n limits?: any;\n }>;\n planPolicyRef?: {\n name: string;\n namespace: string;\n };\n documentation?: {\n openAPISpec?: string;\n docsURL?: string;\n gitRepository?: string;\n techdocsRef?: string;\n };\n contact?: {\n team?: string;\n email?: string;\n slack?: string;\n };\n };\n}\n\nexport class APIProductEntityProvider implements EntityProvider {\n private readonly k8sClient: KuadrantK8sClient;\n private connection?: EntityProviderConnection;\n private readonly providerId = 'kuadrant-apiproduct-provider';\n\n constructor(config: RootConfigService) {\n console.log('apiproduct provider: constructor called');\n this.k8sClient = new KuadrantK8sClient(config);\n }\n\n getProviderName(): string {\n return this.providerId;\n }\n\n async connect(connection: EntityProviderConnection): Promise<void> {\n console.log('apiproduct provider: connect called');\n this.connection = connection;\n\n console.log('apiproduct provider: starting initial sync');\n // initial full sync\n await this.refresh();\n\n // schedule periodic refresh (every 30 seconds for development)\n // note: in production, consider 5-10 minutes to reduce api load\n console.log('apiproduct provider: scheduling periodic refresh every 30 seconds');\n setInterval(async () => {\n await this.refresh();\n }, 30 * 1000);\n }\n\n private async refresh(): Promise<void> {\n console.log('apiproduct provider: refresh called');\n if (!this.connection) {\n console.log('apiproduct provider: no connection, skipping refresh');\n return;\n }\n\n try {\n console.log('apiproduct provider: fetching apiproducts from kubernetes');\n // fetch all apiproducts from kubernetes\n const response = await this.k8sClient.listCustomResources(\n 'extensions.kuadrant.io',\n 'v1alpha1',\n 'apiproducts'\n );\n\n const apiProducts = (response.items || []) as APIProduct[];\n console.log(`apiproduct provider: found ${apiProducts.length} apiproducts`);\n\n // transform apiproducts to backstage api entities\n const entities = apiProducts.map(product => this.transformToEntity(product));\n console.log(`apiproduct provider: transformed ${entities.length} entities`);\n\n // submit entities to catalog\n console.log('apiproduct provider: submitting entities to catalog');\n await this.connection.applyMutation({\n type: 'full',\n entities: entities.map(entity => ({\n entity,\n locationKey: `kuadrant-apiproduct:${entity.metadata.namespace}/${entity.metadata.name}`,\n })),\n });\n\n console.log(`apiproduct provider: synced ${entities.length} api products`);\n } catch (error) {\n console.error('error refreshing apiproduct entities:', error);\n }\n }\n\n private transformToEntity(product: APIProduct): ApiEntity {\n const namespace = product.metadata.namespace || 'default';\n const name = product.metadata.name;\n const displayName = product.spec.displayName || name;\n const description = product.spec.description || `api product: ${displayName}`;\n\n // determine lifecycle from labels or default to production\n const lifecycle = product.metadata.labels?.lifecycle || 'production';\n\n // determine owner from contact info or default to guests\n const owner = product.spec.contact?.team || 'guests';\n\n // build tags from product tags\n const tags = product.spec.tags || [];\n\n // create entity with proper backstage structure\n const entity: ApiEntity = {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'API',\n metadata: {\n name: `${name}`,\n namespace: 'default',\n title: displayName,\n description,\n annotations: {\n 'backstage.io/managed-by-location': `kuadrant:${namespace}/${name}`,\n 'backstage.io/managed-by-origin-location': `kuadrant:${namespace}/${name}`,\n 'backstage.io/orphan-strategy': 'keep',\n 'kuadrant.io/namespace': namespace,\n 'kuadrant.io/apiproduct': name,\n // add httproute annotation if we can infer it (usually same as apiproduct name without -api suffix)\n 'kuadrant.io/httproute': name.endsWith('-api') ? name.slice(0, -4) : name,\n ...(product.spec.documentation?.openAPISpec && {\n 'kuadrant.io/openapi-spec-url': product.spec.documentation.openAPISpec,\n }),\n ...(product.spec.documentation?.docsURL && {\n 'kuadrant.io/docs-url': product.spec.documentation.docsURL,\n }),\n ...(product.spec.documentation?.gitRepository && {\n 'backstage.io/source-location': `url:${product.spec.documentation.gitRepository}`,\n }),\n ...(product.spec.documentation?.techdocsRef && {\n 'backstage.io/techdocs-ref': product.spec.documentation.techdocsRef,\n }),\n ...(product.spec.contact?.email && {\n 'kuadrant.io/contact-email': product.spec.contact.email,\n }),\n ...(product.spec.contact?.slack && {\n 'kuadrant.io/contact-slack': product.spec.contact.slack,\n }),\n },\n tags: [...tags, 'kuadrant', 'apiproduct'],\n labels: {\n 'kuadrant.io/synced': 'true',\n ...(product.metadata.labels || {}),\n },\n },\n spec: {\n type: 'openapi',\n lifecycle,\n owner,\n definition: product.spec.documentation?.openAPISpec\n ? `# openapi spec available at: ${product.spec.documentation.openAPISpec}\\n\\nopenapi: 3.0.0\\ninfo:\\n title: ${displayName}\\n version: ${product.spec.version || '1.0.0'}\\n description: ${description}\\n`\n : `# no openapi spec configured\\n\\nopenapi: 3.0.0\\ninfo:\\n title: ${displayName}\\n version: ${product.spec.version || '1.0.0'}\\n description: ${description}\\n`,\n },\n };\n\n return entity;\n }\n}\n"],"names":["KuadrantK8sClient"],"mappings":";;;;AA6CO,MAAM,wBAAmD,CAAA;AAAA,EAC7C,SAAA;AAAA,EACT,UAAA;AAAA,EACS,UAAa,GAAA,8BAAA;AAAA,EAE9B,YAAY,MAA2B,EAAA;AACrC,IAAA,OAAA,CAAQ,IAAI,yCAAyC,CAAA;AACr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C,2BAAA,EAA6B,OAAQ,CAAA,IAAA,CAAK,OAAQ,CAAA;AAAA,WACpD;AAAA,UACA,GAAI,OAAA,CAAQ,IAAK,CAAA,OAAA,EAAS,KAAS,IAAA;AAAA,YACjC,2BAAA,EAA6B,OAAQ,CAAA,IAAA,CAAK,OAAQ,CAAA;AAAA;AACpD,SACF;AAAA,QACA,IAAM,EAAA,CAAC,GAAG,IAAA,EAAM,YAAY,YAAY,CAAA;AAAA,QACxC,MAAQ,EAAA;AAAA,UACN,oBAAsB,EAAA,MAAA;AAAA,UACtB,GAAI,OAAA,CAAQ,QAAS,CAAA,MAAA,IAAU;AAAC;AAClC,OACF;AAAA,MACA,IAAM,EAAA;AAAA,QACJ,IAAM,EAAA,SAAA;AAAA,QACN,SAAA;AAAA,QACA,KAAA;AAAA,QACA,UAAA,EAAY,QAAQ,IAAK,CAAA,aAAA,EAAe,cACpC,CAAgC,6BAAA,EAAA,OAAA,CAAQ,IAAK,CAAA,aAAA,CAAc,WAAW;;AAAA;AAAA;AAAA,SAAA,EAAuC,WAAW;AAAA,WAAgB,EAAA,OAAA,CAAQ,IAAK,CAAA,OAAA,IAAW,OAAO;AAAA,eAAA,EAAoB,WAAW;AAAA,CACtM,GAAA,CAAA;;AAAA;AAAA;AAAA,SAAA,EAAmE,WAAW;AAAA,WAAgB,EAAA,OAAA,CAAQ,IAAK,CAAA,OAAA,IAAW,OAAO;AAAA,eAAA,EAAoB,WAAW;AAAA;AAAA;AAClK,KACF;AAEA,IAAO,OAAA,MAAA;AAAA;AAEX;;;;"}
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var backendPluginApi = require('@backstage/backend-plugin-api');
6
+ var pluginRbacNode = require('@backstage-community/plugin-rbac-node');
7
+
8
+ const kuadrantRbacModule = backendPluginApi.createBackendModule({
9
+ pluginId: "permission",
10
+ moduleId: "kuadrant-rbac-provider",
11
+ register(env) {
12
+ env.registerInit({
13
+ deps: {
14
+ pluginIdProvider: pluginRbacNode.pluginIdProviderExtensionPoint
15
+ },
16
+ async init({ pluginIdProvider }) {
17
+ pluginIdProvider.addPluginIdProvider({
18
+ getPluginIds: () => ["kuadrant"]
19
+ });
20
+ }
21
+ });
22
+ }
23
+ });
24
+
25
+ exports.default = kuadrantRbacModule;
26
+ exports.kuadrantRbacModule = kuadrantRbacModule;
27
+ //# sourceMappingURL=rbac.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rbac.cjs.js","sources":["../src/rbac-module.ts"],"sourcesContent":["import { createBackendModule } from '@backstage/backend-plugin-api';\nimport { pluginIdProviderExtensionPoint } from '@backstage-community/plugin-rbac-node';\n\n/**\n * backend module that registers kuadrant plugin id with rbac\n * this makes kuadrant permissions discoverable in the rbac ui\n *\n * @public\n */\nexport const kuadrantRbacModule = createBackendModule({\n pluginId: 'permission',\n moduleId: 'kuadrant-rbac-provider',\n register(env) {\n env.registerInit({\n deps: {\n pluginIdProvider: pluginIdProviderExtensionPoint,\n },\n async init({ pluginIdProvider }) {\n pluginIdProvider.addPluginIdProvider({\n getPluginIds: () => ['kuadrant'],\n });\n },\n });\n },\n});\n\nexport default kuadrantRbacModule;\n"],"names":["createBackendModule","pluginIdProviderExtensionPoint"],"mappings":";;;;;;;AASO,MAAM,qBAAqBA,oCAAoB,CAAA;AAAA,EACpD,QAAU,EAAA,YAAA;AAAA,EACV,QAAU,EAAA,wBAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,gBAAkB,EAAAC;AAAA,OACpB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,gBAAA,EAAoB,EAAA;AAC/B,QAAA,gBAAA,CAAiB,mBAAoB,CAAA;AAAA,UACnC,YAAA,EAAc,MAAM,CAAC,UAAU;AAAA,SAChC,CAAA;AAAA;AACH,KACD,CAAA;AAAA;AAEL,CAAC;;;;;"}