Code Monkey home page Code Monkey logo

wasmcloud-k8s-demo's Introduction

wasmcloud k8s demo

This repo contains our investigation into the developer experience of using wasmcloud in a multi-cloud kubernetes environment. We are hoping to explore:

  • wasmcloud lattice across multiple cloud providers (GCP+AWS), via NGS
  • GitOps
  • Ingress
  • kv store with redis (only in GCP)
  • moving actors between clouds
  • chaos testing
  • ...

This project is running the todo example that can be found here.

Setup

Infrastructure

We are using pulumi for our infrastructure-as-code setup. If you get lost, it might be because we forgot to write down a step. If you manage to unblock yourself by reading https://www.pulumi.com/docs/get-started/ , please send us a pull request.

To set things up:

  • Ask for the .env from someone on the red-badger slack. Specifically, you will want to export PULUMI_CONFIG_PASSPHRASE into your environment (this is used to decrypt the pulumi state, which is shared in a google storage bucket).

Log into aws if you aren't already

Follow the steps from https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/obtain-credentials.html to get your credentials as a csv, and then run:

aws configure

and paste in the appropriate values.

gcloud auth login
gcloud config set project wasmcloud-k8s-demo
gcloud auth application-default login

Check that you don't have a GOOGLE_CREDENTIALS environment variable exported from a previous project ๐Ÿ™ˆ.

Run pulumi

pulumi login --cloud-url gs://wasmcloud-k8s-demo-state

pulumi up contains a confirmation step, so you don't need to worry about accidentally stomping over other people's work.

(cd infrastructure/ && npm install && pulumi up --stack dev)

The user who does this step becomes god on the eks cluster automatically. As a work-around,

kubectl edit configmap aws-auth -n kube-system
mapUsers: |
    - userarn: arn:aws:iam::394465323128:user/david.laban
      username: david.laban
      groups:
        - system:masters
    - userarn: arn:aws:iam::394465323128:user/stuart.harris
      username: stuart.harris
      groups:
        - system:masters
    - userarn: arn:aws:iam::394465323128:user/aayush.attri
      username: aayush.attri
      groups:
        - system:masters

Set up kubernetes

All setup operations live in ./scripts/setup.sh. This takes an argument eks or gke, and sets up the appropriate cluster + link definitions.

Testing

kubectl port-forward -n todo-backend service/todo-http-capability-service 8082:8082
curl localhost:8082/api

This should return the empty array [], or whatever todo items people have added.

Developing

Pushing an actor image

Found some inconsistency when pushing and pulling images to and from GCR when using wash cli, we resorted to using wasm-to-oci. The inconsistency lied with the media types supported for the images. Had to change the supported media types within wasm-to-oci as shown below.

wash doesn't understand how to talk to gcr.io, and we're not in the mood for debugging it right now. As a work-around, we applied this patch to https://github.com/engineerd/wasm-to-oci :

diff --git a/pkg/oci/mediatypes.go b/pkg/oci/mediatypes.go
index 5c99816..ffaa489 100644
--- a/pkg/oci/mediatypes.go
+++ b/pkg/oci/mediatypes.go
@@ -2,5 +2,5 @@ package oci

 const (
        ConfigMediaType       = "application/vnd.wasm.config.v1+json"
-       ContentLayerMediaType = "application/vnd.wasm.content.layer.v1+wasm"
+       ContentLayerMediaType = "application/vnd.module.wasm.content.layer.v1+wasm"
 )

and push a new image like this wasm-to-oci push todo-backend/target/wasm32-unknown-unknown/debug/todo_backend_s.wasm eu.gcr.io/wasmcloud-k8s-demo/todo-backend:0.2

We made our registry public, to simplify our lives.

wasmcloud-k8s-demo's People

Contributors

stuartharris avatar attriaayush 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.