Skip to content

Commit

Permalink
Add TLS endpoint for ModelMesh payload processors. (trustyai-explaina…
Browse files Browse the repository at this point in the history
…bility#268)

Keep non-TLS endpoint for KServe Serverless (disabled by default)
  • Loading branch information
ruivieira authored Aug 1, 2024
1 parent 1515872 commit 91ba2c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions controllers/inference_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (r *TrustyAIServiceReconciler) patchEnvVarsByLabelForDeployments(ctx contex
}

// Build the payload processor endpoint
url := generateServiceURL(crName, namespace) + "/consumer/kserve/v2"
url := generateTLSServiceURL(crName, namespace) + "/consumer/kserve/v2"

// Patch environment variables for the Deployments
if shouldContinue, err := r.patchEnvVarsForDeployments(ctx, instance, deployments, envVarName, url, remove); err != nil {
Expand Down Expand Up @@ -240,7 +240,7 @@ func (r *TrustyAIServiceReconciler) handleInferenceServices(ctx context.Context,
// patchKServe adds a TrustyAI service as an InferenceLogger to a KServe InferenceService
func (r *TrustyAIServiceReconciler) patchKServe(ctx context.Context, instance *trustyaiopendatahubiov1alpha1.TrustyAIService, infService kservev1beta1.InferenceService, namespace string, crName string, remove bool) error {

url := generateServiceURL(crName, namespace)
url := generateNonTLSServiceURL(crName, namespace)

if remove {
if infService.Spec.Predictor.Logger == nil || *infService.Spec.Predictor.Logger.URL != url {
Expand Down
9 changes: 7 additions & 2 deletions controllers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ func (r *TrustyAIServiceReconciler) GetDeploymentsByLabel(ctx context.Context, n
return deployments.Items, nil
}

// generateServiceURL generates an internal URL for a TrustyAI service
func generateServiceURL(crName string, namespace string) string {
// generateTLSServiceURL generates an internal URL for a TLS-enabled TrustyAI service
func generateTLSServiceURL(crName string, namespace string) string {
return "https://" + crName + "." + namespace + ".svc"
}

// generateNonTLSServiceURL generates an internal URL for a TrustyAI service
func generateNonTLSServiceURL(crName string, namespace string) string {
return "http://" + crName + "." + namespace + ".svc"
}

0 comments on commit 91ba2c5

Please sign in to comment.