@@ -17,14 +17,9 @@ import {
1717 coreServices ,
1818 createBackendModule ,
1919} from '@backstage/backend-plugin-api' ;
20- import {
21- catalogProcessingExtensionPoint ,
22- catalogLocationsExtensionPoint ,
23- } from '@backstage/plugin-catalog-node/alpha' ;
20+ import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha' ;
2421
2522import { ModelCatalogResourceEntityProvider } from './providers' ;
26- import { RHDHRHOAIReaderProcessor } from './processors' ;
27- import { RHDHRHOAIEntityProvider } from './providers/RHDHRHOAIEntityProvider' ;
2823
2924/**
3025 * catalogModuleModelCatalogResourceEntityProvider defines the model catalog entity provider which runs on startup
@@ -60,96 +55,3 @@ export const catalogModuleModelCatalogResourceEntityProvider =
6055 } ) ;
6156 } ,
6257 } ) ;
63-
64- /**
65- * catalogModuleRHDHRHOAIReaderProcessor defines the custom processor used to ingest updated/newly
66- * discovered model catalog entities
67- *
68- * @public
69- */
70- export const catalogModuleRHDHRHOAIReaderProcessor = createBackendModule ( {
71- pluginId : 'catalog' ,
72- moduleId : 'rhdh-rhoai-bridge-reader-processor' ,
73- register ( env ) {
74- env . registerInit ( {
75- deps : {
76- catalog : catalogProcessingExtensionPoint ,
77- reader : coreServices . urlReader ,
78- config : coreServices . rootConfig ,
79- logger : coreServices . logger ,
80- } ,
81- async init ( { catalog, reader, config, logger } ) {
82- catalog . addProcessor (
83- new RHDHRHOAIReaderProcessor ( reader , config , logger ) ,
84- ) ;
85- } ,
86- } ) ;
87- } ,
88- } ) ;
89-
90- /** so a `CatalogProcessor` does not need to also provide a `CatalogLocationsExtensionPoint` if it only supports imports of locations
91- * from the app-config.yaml on startup, but if you want to dynamically add Locations via the catalog's REST API (like what the UI does for import
92- * of catalog-info.yaml from git repos) then you need to also provide a `CatalogLocationsExtension` point to add your type to the default list of 'url' and 'file';
93- * fwiw in examining the core Backstage code, none of the default `CatalogProcessors` bother to also provide a `CatalogLocationsExtension`; however,
94- * we want to allow our RHDH bridge to import new locations dynamically
95- *
96- * @public
97- */
98- export const catalogModuleRHDHRHOAILocationsExtensionPoint =
99- createBackendModule ( {
100- pluginId : 'catalog' ,
101- moduleId : 'rhdh-rhoai-bridge-location-extension-point' ,
102- register ( env ) {
103- env . registerInit ( {
104- deps : {
105- catalog : catalogLocationsExtensionPoint ,
106- logger : coreServices . logger ,
107- } ,
108- async init ( { catalog, logger } ) {
109- // setAllowedLocationTypes does not add to the list but replaces it, so we preserve the default options of 'file' and 'url'
110- logger
111- . child ( { source : 'catalog-backend-module-model-catalog"' } )
112- . info ( "Registering the 'rhdh-rhoai-bridge' location type" ) ;
113- const allowedLocationTypes = [ 'file' , 'url' , 'rhdh-rhoai-bridge' ] ;
114- catalog . setAllowedLocationTypes ( allowedLocationTypes ) ;
115- } ,
116- } ) ;
117- } ,
118- } ) ;
119-
120- /**
121- * catalogModuleRHDHRHOAIEntityProvider defines the entity provider used to handle ingestion/cleanup of locations in the model catalog
122- *
123- * @public
124- */
125- export const catalogModuleRHDHRHOAIEntityProvider = createBackendModule ( {
126- pluginId : 'catalog' ,
127- moduleId : 'rhdh-rhoai-bridge-entiry-provider' ,
128- register ( env ) {
129- env . registerInit ( {
130- deps : {
131- catalog : catalogProcessingExtensionPoint ,
132- config : coreServices . rootConfig ,
133- discovery : coreServices . discovery ,
134- logger : coreServices . logger ,
135- scheduler : coreServices . scheduler ,
136- reader : coreServices . urlReader ,
137- } ,
138- async init ( { catalog, config, logger, scheduler, discovery, reader } ) {
139- const runner = scheduler . createScheduledTaskRunner ( {
140- frequency : { seconds : 30 } ,
141- timeout : { minutes : 3 } ,
142- } ) ;
143- catalog . addEntityProvider (
144- new RHDHRHOAIEntityProvider (
145- discovery ,
146- config ,
147- logger ,
148- runner ,
149- reader ,
150- ) ,
151- ) ;
152- } ,
153- } ) ;
154- } ,
155- } ) ;
0 commit comments