Code Monkey home page Code Monkey logo

cff-info-demo's Introduction

cff-info-demo

A small two-tier web app to illustrate some of the service-mesh routing and networking features in the Cloud Foundry Application Runtime (CFAR).

Prerequisites

  • Install the cf CLI.
  • Install the jq command-line tool.
  • Log into a CFAR installation with the Istio service mesh enabled.
  • Change to the root directory of this repository.
  • Run export CF_DOMAIN=<REPLACE_WITH_CF_DOMAIN> with <REPLACE_WITH_CF_DOMAIN> replaced with the base apps domain for your CFAR installation.

Service-Mesh Load Balancing

Push the front-end CFF info apps:

cf push -f manifests/cff-info-v1.yml
cf push -f manifests/cff-info-v2.yml

Map an Istio ingress route to the cff-info-v1 app

cf map-route cff-info-v1 "istio.$CF_DOMAIN" -n cff-info

Push the back-end CFF member info apps:

for n in abby chip swarna;
do
  cf push -f "manifests/member-$n.yml"
done

Add network policies from the front-end apps to the back-end member apps:

./scripts/set-network-policies

Make a request to the front-end app:

curl "cff-info.istio.$CF_DOMAIN/random"

Make additional requests and observe that the member info changes while the URL and resolved IP in the member request metadata remain the same.

Fault handling

Change the member-chip app to listen on port 9999 instead of on 8080:

cf set-env member-chip BAD_LISTENER true
cf restart member-chip

Make several requests to the random CFF info page and observe that sometimes the front-end app makes several requests to the back-end internal route before getting a successful response.

Change the member-chip app to listening on 8080:

cf unset-env member-chip BAD_LISTENER
cf restart member-chip

Weighted Routing

Set the weighted-routing rules to send 80% of traffic to the v1 CFF info app and 20% to the v2 CFF info app:

./scripts/set-route-weights 80

Make many requests to the random info page and observe differences in styling.

Set the weighted-routing rules to send 10% of traffic to the v1 CFF info app and 90% to the v2 CFF info app:

./scripts/set-route-weights 90

Make many more requests to the random info page and observe the new style eventually occurs much more frequently.

Return to routing 100% of traffic to the v1 CFF info app:

./scripts/clear-route-weights

cff-info-demo's People

Contributors

emalm avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.