Skip to content

Feature: support multi hosts in vs #5430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion operator/controllers/seldondeployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func createIstioResources(mlDep *machinelearningv1.SeldonDeployment,
Namespace: namespace,
},
Spec: istio_networking.VirtualService{
Hosts: []string{utils2.GetAnnotation(mlDep, ANNOTATION_ISTIO_HOST, "*")},
Hosts: utils2.GetAnnotation(mlDep, ANNOTATION_ISTIO_HOST, "*"),
Gateways: []string{utils2.GetAnnotation(mlDep, ANNOTATION_ISTIO_GATEWAY, istio_gateway)},
Http: []*istio_networking.HTTPRoute{
{
Expand Down
4 changes: 2 additions & 2 deletions operator/controllers/seldondeployment_explainers.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ func createExplainerIstioResources(pSvcName string, p *machinelearningv1.Predict
Namespace: namespace,
},
Spec: istio_networking.VirtualService{
Hosts: []string{utils2.GetAnnotation(mlDep, ANNOTATION_ISTIO_HOST, "*")},
Hosts: utils2.HostsFromAnnotation(mlDep, ANNOTATION_ISTIO_HOST, "*"),
Gateways: []string{utils2.GetAnnotation(mlDep, ANNOTATION_ISTIO_GATEWAY, istio_gateway)},
Http: []*istio_networking.HTTPRoute{
{
Expand All @@ -349,7 +349,7 @@ func createExplainerIstioResources(pSvcName string, p *machinelearningv1.Predict
Namespace: namespace,
},
Spec: istio_networking.VirtualService{
Hosts: []string{utils2.GetAnnotation(mlDep, ANNOTATION_ISTIO_HOST, "*")},
Hosts: utils2.HostsFromAnnotation(mlDep, ANNOTATION_ISTIO_HOST, "*"),
Gateways: []string{utils2.GetAnnotation(mlDep, ANNOTATION_ISTIO_GATEWAY, istio_gateway)},
Http: []*istio_networking.HTTPRoute{
{
Expand Down
10 changes: 10 additions & 0 deletions operator/controllers/utils/controller_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ func GetAnnotation(mlDep *machinelearningv1.SeldonDeployment, annotationKey stri
}
}

// Get an annotation array for hosts from the Seldon Deployment given by annotationKey or return the array with fallback.
func HostsFromAnnotation(mlDep *machinelearningv1.SeldonDeployment, annotationKey string, fallback string) []string {
annotation := GetAnnotation(mlDep, annotationKey, fallback)
if strings.Contains(annotation, ",") {
return strings.Split(annotation, ",")
} else {
return []string{annotation}
}
}

// get annotations that start with seldon.io/engine
func GetEngineEnvAnnotations(mlDep *machinelearningv1.SeldonDeployment) []corev1.EnvVar {

Expand Down