GithubHelp home page GithubHelp logo

hs-knative-demo's Introduction

hs-demo

This is a demo of using Knative using Haskell. It defines 4 services:

haskell-fn-events-ping
haskell-fn-events-pong
haskell-fn-serving-ping
haskell-fn-serving-pong

haskell-fn-events-ping and haskell-fn-events-pong can be called from outside of a cluster using HTTP Get requests. They send events to haskell-fn-serving-ping, haskell-fn-serving-pong event handlers. Event handlers just log received messaged.

Schematically it looks like that:

haskell-fn-events-ping -- Ping --> haskell-fn-serving-ping
haskell-fn-events-pong -- Pong --> haskell-fn-serving-pong

Messaging is done using Knative's exapmle-broker which comes with kn quickstart.

Build & Deploy

[Optional] Build docker images. This script will build executables locally and copy into docker images:

sh docker/build-images-from-local-exe.sh

This version builds everything inside of docker images docker/build-images.sh.

Deploy

kubectl apply -f knative.yaml

Watch logs

stern haskell-fn-events

Send events

curl http://haskell-fn-serving-pong.default.127.0.0.1.sslip.io
curl http://haskell-fn-serving-ping.default.127.0.0.1.sslip.io

Changes reconciliation

This is an open question. After any changes doing kubectl apply -f knative.yaml doesn't update services. My guess is that knative.yaml should contain version tags for images so that kubectl can understand that service configuration has changed.

For now, one needs to update services manually:

kn service update haskell-fn-serving-ping --image kevroletin/haskell-fn-serving-ping --port 8080
kn service update haskell-fn-serving-pong --image kevroletin/haskell-fn-serving-pong --port 8080
kn service update haskell-fn-events-ping --image kevroletin/haskell-fn-events-ping --port 8080
kn service update haskell-fn-events-pong --image kevroletin/haskell-fn-events-pong --port 8080

hs-knative-demo's People

Contributors

kevroletin avatar

Watchers

 avatar James Cloos 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.