Skip to content

Commit

Permalink
Part of bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jinminhao committed Jan 14, 2021
1 parent a0fc4d6 commit e7ba05b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions config/configmap/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ data:
}
ingress: |-
{
"ingressGateway": "paddleflow/paddleflow-gateway",
"ingressServiceName": "*"
"ingressGateway" : "istio-ingressgateway",
"ingressServiceName" : "istio-ingressgateway.istio-system.svc.cluster.local"
}
3 changes: 1 addition & 2 deletions config/samples/elasticserving_v1_paddle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ spec:
runtimeVersion: paddleserving
service:
minScale: 1
# storageUri: nginx:latest
# runtimeVersion: nginx
concurrency: "cpu"
18 changes: 12 additions & 6 deletions pkg/controllers/elasticserving/resources/istio/virtualservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package istio

import (
elasticservingv1 "ElasticServing/pkg/apis/elasticserving/v1"
"ElasticServing/pkg/constants"
"fmt"

istiov1alpha3 "istio.io/api/networking/v1alpha3"
Expand Down Expand Up @@ -31,15 +32,20 @@ func NewVirtualServiceBuilder(configMap *core.ConfigMap) *VirtualServiceBuilder
ingressConfig.IngressGateway = istioIngressConfig.IngressGateway
ingressConfig.IngressServiceName = istioIngressConfig.IngressServiceName

if ingressConfig.IngressGateway == "" || ingressConfig.IngressServiceName == "" {
panic(fmt.Errorf("Invalid ingress config, ingressGateway and ingressService are required."))
}

return &VirtualServiceBuilder{ingressConfig: ingressConfig}
}

func (r *VirtualServiceBuilder) CreateVirtualService(paddlesvc *elasticservingv1.PaddleService) *v1alpha3.VirtualService {
clusterDomain := "cluster.local"
// clusterDomain := "cluster.local"
prefix := fmt.Sprintf("/paddlepaddle/%s/%s/", paddlesvc.Namespace, paddlesvc.Name)
rewrite := fmt.Sprintf("/paddlepaddle/%s/%s/", paddlesvc.Namespace, paddlesvc.Name)

service := fmt.Sprintf("%s.%s.svc.%s", paddlesvc.ObjectMeta.Name, paddlesvc.ObjectMeta.Namespace, clusterDomain)
// service := fmt.Sprintf("%s.%s.svc.%s", paddlesvc.Name, paddlesvc.Namespace, clusterDomain)
service := constants.DefaultServiceName(paddlesvc.Name)

istioGateway := r.ingressConfig.IngressGateway
host := r.ingressConfig.IngressServiceName
Expand All @@ -50,10 +56,10 @@ func (r *VirtualServiceBuilder) CreateVirtualService(paddlesvc *elasticservingv1
Kind: "VirtualService",
},
ObjectMeta: metav1.ObjectMeta{
Name: paddlesvc.ObjectMeta.Name,
Namespace: paddlesvc.ObjectMeta.Namespace,
Labels: paddlesvc.ObjectMeta.Labels,
Annotations: paddlesvc.ObjectMeta.Annotations,
Name: paddlesvc.Name,
Namespace: paddlesvc.Namespace,
Labels: paddlesvc.Labels,
Annotations: paddlesvc.Annotations,
},
Spec: istiov1alpha3.VirtualService{
Hosts: []string{host},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func (r *ServiceBuilder) CreateService(serviceName string, paddlesvc *elasticser
tar -xzf uci_housing.tar.gz &&
python -m paddle_serving_server.serve --model uci_housing_model --thread 1 --port 9292`,
}

service := &knservingv1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: serviceName,
Expand Down

0 comments on commit e7ba05b

Please sign in to comment.