Skip to content

Commit 50043ec

Browse files
author
smarunich
committed
typos
1 parent 49c8b47 commit 50043ec

File tree

2 files changed

+0
-131
lines changed

2 files changed

+0
-131
lines changed

management/k8s.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,51 +1091,6 @@ func (k *K8sClient) UpdateConfigMap(namespace, configMapName string, data map[st
10911091
}
10921092
// Missing Gateway API operations
10931093

1094-
// DeleteHTTPRoute deletes an HTTPRoute
1095-
func (k *K8sClient) DeleteHTTPRoute(namespace, routeName string) error {
1096-
ctx := context.Background()
1097-
1098-
err := k.dynamicClient.Resource(HTTPRouteGVR).Namespace(namespace).Delete(ctx, routeName, metav1.DeleteOptions{})
1099-
if err != nil {
1100-
k.logError("DeleteHTTPRoute", err)
1101-
return fmt.Errorf("failed to delete HTTPRoute: %w", err)
1102-
}
1103-
1104-
return nil
1105-
}
1106-
1107-
// DeleteAIGatewayRoute deletes an AIGatewayRoute
1108-
func (k *K8sClient) DeleteAIGatewayRoute(namespace, routeName string) error {
1109-
ctx := context.Background()
1110-
1111-
err := k.dynamicClient.Resource(AIGatewayRouteGVR).Namespace(namespace).Delete(ctx, routeName, metav1.DeleteOptions{})
1112-
if err != nil {
1113-
k.logError("DeleteAIGatewayRoute", err)
1114-
return fmt.Errorf("failed to delete AIGatewayRoute: %w", err)
1115-
}
1116-
1117-
return nil
1118-
}
1119-
1120-
// DeletePublishedModelMetadata deletes published model metadata
1121-
func (k *K8sClient) DeletePublishedModelMetadata(namespace, modelName string) error {
1122-
ctx := context.Background()
1123-
1124-
configMapName := fmt.Sprintf("published-model-metadata-%s", modelName)
1125-
1126-
err := k.clientset.CoreV1().ConfigMaps(namespace).Delete(ctx, configMapName, metav1.DeleteOptions{})
1127-
if err != nil {
1128-
k.logError("DeletePublishedModelMetadata", err)
1129-
return fmt.Errorf("failed to delete published model metadata: %w", err)
1130-
}
1131-
1132-
return nil
1133-
}
1134-
1135-
// Helper function to generate unique key IDs
1136-
func generateKeyID() string {
1137-
return uuid.New().String()
1138-
}
11391094

11401095
// Helper function to check if error is resource not found
11411096
func IsResourceNotFoundError(err error) bool {

management/publishing.go

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)