Skip to content

The stock-rest-app sample can't access stock quotes web service #872

@trisberg

Description

@trisberg

/area build
/area networking
/kind bug
/kind doc

Expected Behavior

I build and deploy the sample app and when accessing the app I can get stock prices for specified ticker.

Actual Behavior

$ curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}
Welcome to the stock app! 
$ curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/stock/GOOG
stock not found for ticker : GOOG 

Steps to Reproduce the Problem

  1. Follow the instruction for the stock-rest-app sample
  2. curl the sample app's endpoint with a ticker
  3. the ticker is not found message should show

Additional Info

Looks like an issue with Istio egress configuration - not sure if this is something the developer has to configure, but if the developer is expected to do this then that should be added to the sample.

I played around with a few different egress rules and this one seemed to work:

apiVersion: config.istio.io/v1alpha2
kind: EgressRule
metadata:
  name: stock-rest-app-egress-tcp
spec:
  destination:
      service: 35.225.233.74/32
  ports:
      - port: 443
        protocol: tcp

I now get:

$ curl --header "Host:$SERVICE_HOST" http://${SERVICE_IP}/stock/GOOG
stock price for ticker GOOG is 1097.86

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/buildBuild topics specifically related to Knativearea/networkingkind/bugCategorizes issue or PR as related to a bug.kind/docSomething isn't clear

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions