diff --git a/docs/gitbook/faq.md b/docs/gitbook/faq.md index 244fb773d..1ae564852 100644 --- a/docs/gitbook/faq.md +++ b/docs/gitbook/faq.md @@ -232,8 +232,7 @@ spec: mode: ISTIO_MUTUAL ``` -Both port `8080` and `9090` will be added to the ClusterIP services but the virtual service -will point to the port specified in `spec.service.port`. +Both port `8080` and `9090` will be added to the ClusterIP services. ### Label selectors diff --git a/pkg/router/istio.go b/pkg/router/istio.go index e7f45122e..cb80a8196 100644 --- a/pkg/router/istio.go +++ b/pkg/router/istio.go @@ -2,6 +2,7 @@ package router import ( "fmt" + "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" flaggerv1 "github.com/weaveworks/flagger/pkg/apis/flagger/v1alpha3" @@ -9,7 +10,6 @@ import ( clientset "github.com/weaveworks/flagger/pkg/client/clientset/versioned" "go.uber.org/zap" "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/kubernetes" @@ -236,7 +236,7 @@ func (ir *IstioRouter) GetRoutes(canary *flaggerv1.Canary) ( ) { targetName := canary.Spec.TargetRef.Name vs := &istiov1alpha3.VirtualService{} - vs, err = ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Get(targetName, v1.GetOptions{}) + vs, err = ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Get(targetName, metav1.GetOptions{}) if err != nil { if errors.IsNotFound(err) { err = fmt.Errorf("VirtualService %s.%s not found", targetName, canary.Namespace) @@ -283,7 +283,7 @@ func (ir *IstioRouter) SetRoutes( primaryName := fmt.Sprintf("%s-primary", targetName) canaryName := fmt.Sprintf("%s-canary", targetName) - vs, err := ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Get(targetName, v1.GetOptions{}) + vs, err := ir.istioClient.NetworkingV1alpha3().VirtualServices(canary.Namespace).Get(targetName, metav1.GetOptions{}) if err != nil { if errors.IsNotFound(err) { return fmt.Errorf("VirtualService %s.%s not found", targetName, canary.Namespace) @@ -383,12 +383,5 @@ func makeDestination(canary *flaggerv1.Canary, host string, weight int) istiov1a Weight: weight, } - // if port discovery is enabled then we need to explicitly set the destination port - if canary.Spec.Service.PortDiscovery { - dest.Destination.Port = &istiov1alpha3.PortSelector{ - Number: uint32(canary.Spec.Service.Port), - } - } - return dest } diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index df5797d8b..3d654c15c 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -33,6 +33,7 @@ spec: progressDeadlineSeconds: 60 service: port: 9898 + portDiscovery: true headers: request: add: @@ -142,6 +143,7 @@ spec: name: podinfo progressDeadlineSeconds: 60 service: + portDiscovery: true port: 9898 canaryAnalysis: interval: 10s @@ -202,4 +204,4 @@ echo '✔ A/B testing promotion test passed' kubectl -n istio-system logs deployment/flagger -echo '✔ All tests passed' \ No newline at end of file +echo '✔ All tests passed' diff --git a/test/e2e-workload.yaml b/test/e2e-workload.yaml index 56d0dbc3a..ca7c043d7 100644 --- a/test/e2e-workload.yaml +++ b/test/e2e-workload.yaml @@ -20,6 +20,7 @@ spec: metadata: annotations: prometheus.io/scrape: "true" + prometheus.io/port: "9797" labels: app: podinfo spec: @@ -31,9 +32,13 @@ spec: - containerPort: 9898 name: http protocol: TCP + - containerPort: 9797 + name: http-prom + protocol: TCP command: - ./podinfo - --port=9898 + - --port-metrics=9797 - --level=info - --random-delay=false - --random-error=false