Skip to content

Commit bcfe28f

Browse files
author
smarunich
committed
minor fixes
1 parent fe22cbc commit bcfe28f

File tree

2 files changed

+3
-108
lines changed

2 files changed

+3
-108
lines changed

management/k8s.go

Lines changed: 2 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -613,59 +613,7 @@ func (k *K8sClient) GetHTTPRoute(namespace, name string) (map[string]interface{}
613613
return obj.Object, nil
614614
}
615615

616-
// AIGatewayRoute CRUD operations
617-
func (k *K8sClient) CreateAIGatewayRoute(namespace string, route map[string]interface{}) error {
618-
ctx := context.Background()
619-
620-
// Convert to unstructured
621-
obj := &unstructured.Unstructured{
622-
Object: route,
623-
}
624-
obj.SetGroupVersionKind(AIGatewayRouteGVR.GroupVersion().WithKind("AIGatewayRoute"))
625-
626-
// Create the AIGatewayRoute
627-
_, err := k.dynamicClient.Resource(AIGatewayRouteGVR).Namespace(namespace).Create(ctx, obj, metav1.CreateOptions{})
628-
if err != nil {
629-
k.logError("CreateAIGatewayRoute", err)
630-
return fmt.Errorf("failed to create AIGatewayRoute: %w", err)
631-
}
632-
633-
return nil
634-
}
635-
636-
func (k *K8sClient) UpdateAIGatewayRoute(namespace, name string, route map[string]interface{}) error {
637-
ctx := context.Background()
638-
639-
// Convert to unstructured
640-
obj := &unstructured.Unstructured{
641-
Object: route,
642-
}
643-
obj.SetGroupVersionKind(AIGatewayRouteGVR.GroupVersion().WithKind("AIGatewayRoute"))
644-
obj.SetName(name)
645-
obj.SetNamespace(namespace)
646-
647-
// Update the AIGatewayRoute
648-
_, err := k.dynamicClient.Resource(AIGatewayRouteGVR).Namespace(namespace).Update(ctx, obj, metav1.UpdateOptions{})
649-
if err != nil {
650-
k.logError("UpdateAIGatewayRoute", err)
651-
return fmt.Errorf("failed to update AIGatewayRoute: %w", err)
652-
}
653-
654-
return nil
655-
}
656-
657-
func (k *K8sClient) DeleteAIGatewayRoute(namespace, name string) error {
658-
ctx := context.Background()
659-
660-
// Delete the AIGatewayRoute
661-
err := k.dynamicClient.Resource(AIGatewayRouteGVR).Namespace(namespace).Delete(ctx, name, metav1.DeleteOptions{})
662-
if err != nil {
663-
k.logError("DeleteAIGatewayRoute", err)
664-
return fmt.Errorf("failed to delete AIGatewayRoute: %w", err)
665-
}
666-
667-
return nil
668-
}
616+
// Removed duplicate AIGatewayRoute CRUD operations - using comprehensive versions later in file
669617

670618
func (k *K8sClient) GetAIGatewayRoute(namespace, name string) (map[string]interface{}, error) {
671619
ctx := context.Background()
@@ -680,59 +628,7 @@ func (k *K8sClient) GetAIGatewayRoute(namespace, name string) (map[string]interf
680628
return obj.Object, nil
681629
}
682630

683-
// BackendTrafficPolicy CRUD operations
684-
func (k *K8sClient) CreateBackendTrafficPolicy(namespace string, policy map[string]interface{}) error {
685-
ctx := context.Background()
686-
687-
// Convert to unstructured
688-
obj := &unstructured.Unstructured{
689-
Object: policy,
690-
}
691-
obj.SetGroupVersionKind(BackendTrafficPolicyGVR.GroupVersion().WithKind("BackendTrafficPolicy"))
692-
693-
// Create the BackendTrafficPolicy
694-
_, err := k.dynamicClient.Resource(BackendTrafficPolicyGVR).Namespace(namespace).Create(ctx, obj, metav1.CreateOptions{})
695-
if err != nil {
696-
k.logError("CreateBackendTrafficPolicy", err)
697-
return fmt.Errorf("failed to create BackendTrafficPolicy: %w", err)
698-
}
699-
700-
return nil
701-
}
702-
703-
func (k *K8sClient) UpdateBackendTrafficPolicy(namespace, name string, policy map[string]interface{}) error {
704-
ctx := context.Background()
705-
706-
// Convert to unstructured
707-
obj := &unstructured.Unstructured{
708-
Object: policy,
709-
}
710-
obj.SetGroupVersionKind(BackendTrafficPolicyGVR.GroupVersion().WithKind("BackendTrafficPolicy"))
711-
obj.SetName(name)
712-
obj.SetNamespace(namespace)
713-
714-
// Update the BackendTrafficPolicy
715-
_, err := k.dynamicClient.Resource(BackendTrafficPolicyGVR).Namespace(namespace).Update(ctx, obj, metav1.UpdateOptions{})
716-
if err != nil {
717-
k.logError("UpdateBackendTrafficPolicy", err)
718-
return fmt.Errorf("failed to update BackendTrafficPolicy: %w", err)
719-
}
720-
721-
return nil
722-
}
723-
724-
func (k *K8sClient) DeleteBackendTrafficPolicy(namespace, name string) error {
725-
ctx := context.Background()
726-
727-
// Delete the BackendTrafficPolicy
728-
err := k.dynamicClient.Resource(BackendTrafficPolicyGVR).Namespace(namespace).Delete(ctx, name, metav1.DeleteOptions{})
729-
if err != nil {
730-
k.logError("DeleteBackendTrafficPolicy", err)
731-
return fmt.Errorf("failed to delete BackendTrafficPolicy: %w", err)
732-
}
733-
734-
return nil
735-
}
631+
// Removed duplicate BackendTrafficPolicy CRUD operations - using comprehensive versions later in file
736632

737633
func (k *K8sClient) GetBackendTrafficPolicy(namespace, name string) (map[string]interface{}, error) {
738634
ctx := context.Background()

management/publishing.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package main
33
import (
44
"crypto/rand"
55
"encoding/base64"
6-
"encoding/json"
76
"fmt"
87
"log"
98
"net/http"
@@ -118,7 +117,7 @@ func (s *PublishingService) PublishModel(c *gin.Context) {
118117
}
119118

120119
// Generate API key
121-
apiKeyMetadata, apiKey, err := s.generateAPIKey(u, modelName, namespace, modelType)
120+
_, apiKey, err := s.generateAPIKey(u, modelName, namespace, modelType)
122121
if err != nil {
123122
c.JSON(http.StatusInternalServerError, ErrorResponse{
124123
Error: "Failed to generate API key",

0 commit comments

Comments
 (0)