@@ -1203,89 +1203,3 @@ func (s *PublishingService) cleanupPublishedModelMetadata(namespace, modelName s
12031203 }
12041204}
12051205
1206- func (s * PublishingService ) logPublishingEvent (user * User , modelName , namespace , action string ) {
1207- // Create audit log entry
1208- logEntry := map [string ]interface {}{
1209- "timestamp" : time .Now ().Format (time .RFC3339 ),
1210- "action" : action ,
1211- "modelName" : modelName ,
1212- "namespace" : namespace ,
1213- "user" : map [string ]interface {}{
1214- "tenant" : user .Tenant ,
1215- "name" : user .Name ,
1216- "subject" : user .Subject ,
1217- "isAdmin" : user .IsAdmin ,
1218- },
1219- }
1220-
1221- // Store audit log as ConfigMap
1222- auditLogName := fmt .Sprintf ("publishing-audit-%s" , time .Now ().Format ("2006-01-02" ))
1223-
1224- // Try to get existing audit log for today
1225- existingLog , err := s .k8sClient .GetConfigMap (namespace , auditLogName )
1226- if err != nil {
1227- // Create new audit log
1228- auditData := map [string ]interface {}{
1229- "entries" : []interface {}{logEntry },
1230- }
1231- s .k8sClient .CreateConfigMap (namespace , auditLogName , auditData )
1232- } else {
1233- // Append to existing audit log
1234- if entries , ok := existingLog ["entries" ].([]interface {}); ok {
1235- entries = append (entries , logEntry )
1236- existingLog ["entries" ] = entries
1237- s .k8sClient .UpdateConfigMap (namespace , auditLogName , existingLog )
1238- }
1239- }
1240-
1241- // Also log to application logs
1242- log .Printf ("Publishing event: %s - User: %s (%s) - Model: %s/%s" , action , user .Name , user .Tenant , namespace , modelName )
1243- }
1244-
1245- // Cleanup methods
1246- func (s * PublishingService ) cleanupAPIKey (namespace , modelName string ) {
1247- // Delete API key secret
1248- secretName := fmt .Sprintf ("published-model-apikey-%s" , modelName )
1249-
1250- if err := s .k8sClient .DeleteAPIKeySecret (namespace , secretName ); err != nil {
1251- log .Printf ("Failed to cleanup API key secret %s/%s: %v" , namespace , secretName , err )
1252- }
1253- }
1254-
1255- func (s * PublishingService ) cleanupGatewayConfiguration (namespace , modelName string ) {
1256- // Delete HTTPRoute and AIGatewayRoute
1257- routeName := fmt .Sprintf ("published-model-%s-%s" , namespace , modelName )
1258-
1259- // Delete HTTPRoute
1260- if err := s .k8sClient .DeleteHTTPRoute ("envoy-gateway-system" , routeName ); err != nil {
1261- log .Printf ("Failed to cleanup HTTPRoute %s: %v" , routeName , err )
1262- }
1263-
1264- // Delete AIGatewayRoute
1265- if err := s .k8sClient .DeleteAIGatewayRoute ("envoy-gateway-system" , routeName ); err != nil {
1266- log .Printf ("Failed to cleanup AIGatewayRoute %s: %v" , routeName , err )
1267- }
1268- }
1269-
1270- func (s * PublishingService ) cleanupRateLimitingPolicy (namespace , modelName string ) {
1271- // Delete BackendTrafficPolicy
1272- policyName := fmt .Sprintf ("published-model-rate-limit-%s-%s" , namespace , modelName )
1273-
1274- if err := s .k8sClient .DeleteBackendTrafficPolicy ("envoy-gateway-system" , policyName ); err != nil {
1275- log .Printf ("Failed to cleanup BackendTrafficPolicy %s: %v" , policyName , err )
1276- }
1277- }
1278-
1279- func (s * PublishingService ) cleanupPublishedModelMetadata (namespace , modelName string ) {
1280- // Delete published model metadata ConfigMap
1281- metadataName := fmt .Sprintf ("published-model-metadata-%s" , modelName )
1282-
1283- if err := s .k8sClient .DeletePublishedModelMetadata (namespace , metadataName ); err != nil {
1284- log .Printf ("Failed to cleanup published model metadata %s/%s: %v" , namespace , metadataName , err )
1285- }
1286- }
1287-
1288- // Utility functions
1289- func generateKeyID () string {
1290- return uuid .New ().String ()
1291- }
0 commit comments