-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--------- Signed-off-by: Lucas Fontes <[email protected]> Signed-off-by: Lucas Fontes <[email protected]> Co-authored-by: Joonas Bergius <[email protected]>
- Loading branch information
Showing
8 changed files
with
258 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
apiVersion: k8s.wasmcloud.dev/v1alpha1 | ||
kind: WasmCloudHostConfig | ||
metadata: | ||
name: my-wasmcloud-cluster | ||
namespace: default | ||
spec: | ||
# Optional: Number of hosts (pods). Defaults to 1. | ||
hostReplicas: 1 | ||
# Required: The lattice to connect the hosts to. | ||
lattice: default | ||
# Optional: Additional labels to apply to the host other than the defaults set in the controller. | ||
hostLabels: | ||
test: value | ||
cluster: kind | ||
# Required: Which wasmCloud version to use. | ||
version: "1.0.4" | ||
# Optional: The image to use for the wasmCloud host. | ||
# If provided, the 'version' field will be ignored. | ||
image: "registry/wasmcloud:tag" | ||
# Optional: The image to use for the NATS leaf that is deployed alongside the wasmCloud host. | ||
# If not provided, the default upstream image will be used. | ||
natsLeafImage: "registry/nats:tag" | ||
# Optional. The name of a secret containing a set of NATS credentials under 'nats.creds' key. | ||
secretName: "wasmcloud-host-nats-secret" | ||
# Optional: Enable structured logging for host logs. Defaults to "false". | ||
enableStructuredLogging: true | ||
# Optional: The name of a secret containing the registry credentials. | ||
# See https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-by-providing-credentials-on-the-command-line | ||
registryCredentialsSecret: "wasmcloud-pull-secret" | ||
# Optional: The control topic prefix to use for the host. Defaults to "wasmbus.ctl" | ||
controlTopicPrefix: "wasmbus.custom-ctl" | ||
# Optional: The leaf node domain to use for the NATS sidecar. Defaults to "leaf". | ||
leafNodeDomain: "custom-leaf" | ||
# Optional: Enable the config service for this host. Defaults to "false". | ||
# Makes wasmCloud host issue requests to a config service on startup. | ||
configServiceEnabled: true | ||
# Optional: The log level to use for the host. Defaults to "INFO". | ||
logLevel: INFO | ||
# Optional: The address of the NATS server to connect to. Defaults to "nats://nats.default.svc.cluster.local". | ||
natsAddress: nats://nats.default.svc.cluster.local | ||
# Optional: Allow the host to deploy using the latest tag on OCI components or providers. Defaults to "false". | ||
allowLatest: true | ||
# Optional: Allow the host to pull artifacts from OCI registries insecurely. | ||
allowedInsecure: | ||
- "localhost:5001" | ||
- "kind-registry:5000" | ||
# Optional: Policy service configuration. | ||
policyService: | ||
# If provided, enables policy checks on start actions and component invocations. | ||
topic: "wasmcloud.policy" | ||
# If provided, allows the host to subscribe to updates on past policy decisions. Requires 'topic' above to be set. | ||
changesTopic: "wasmcloud.policy.changes" | ||
# If provided, allows setting a custom timeout for requesting policy decisions. Defaults to 1000. Requires 'topic' to be set. | ||
timeoutMs: 10000 | ||
# Optional: Observability options for configuring the OpenTelemetry integration. | ||
observability: | ||
# NOTE: Enables all signals (logs/metrics/traces) at once. Set it to 'false' and enable each signal individually in case you don't need all of them. | ||
enable: true | ||
endpoint: "otel-collector.svc" | ||
# Either 'grpc' or 'http' | ||
protocol: "http" | ||
logs: | ||
enable: false | ||
endpoint: "logs-specific-otel-collector.svc" | ||
metrics: | ||
enable: false | ||
endpoint: "metrics-specific-otel-collector.svc" | ||
traces: | ||
enable: false | ||
endpoint: "traces-specific-otel-collector.svc" | ||
# Optional: Additional options to control how the underlying wasmCloud hosts are scheduled in Kubernetes. | ||
# This includes setting resource requirements for the nats and wasmCloud host | ||
# containers along with any additional pot template settings. | ||
schedulingOptions: | ||
# Optional: Enable the following to run the wasmCloud hosts as a DaemonSet. Defaults to "false". | ||
daemonset: true | ||
# Optional: Set the resource requirements for the nats and wasmCloud host containers. | ||
# See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ for valid values | ||
resources: | ||
nats: | ||
requests: | ||
cpu: "1" | ||
wasmCloudHost: | ||
requests: | ||
cpu: "1" | ||
# Optional: Any additional pod template settings to apply to the wasmCloud host pods. | ||
# See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#podspec-v1-core for all valid options. | ||
# Note that you *cannot* set the `containers` field here as it is managed by the controller. | ||
podTemplateAdditions: | ||
spec: | ||
nodeSelector: | ||
kubernetes.io/os: linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Example setup | ||
|
||
This example shows the bare minimum requirements to deploy applications on wasmCloud. | ||
|
||
It relies on the Kubernetes `default` namespace for simplicity. | ||
|
||
## Install [NATS](https://github.com/nats-io/nats-server) | ||
|
||
```bash | ||
helm repo add nats https://nats-io.github.io/k8s/helm/charts/ | ||
helm upgrade --install -f nats-values.yaml nats nats/nats | ||
``` | ||
|
||
Validate installation with: | ||
|
||
```bash | ||
# make sure pods are ready | ||
kubectl rollout status deploy,sts -l app.kubernetes.io/instance=nats | ||
``` | ||
|
||
## Install wasmCloud Application Deployment Manager - [wadm](https://github.com/wasmCloud/wadm) | ||
|
||
```sh | ||
helm install wadm -f wadm-values.yaml oci://ghcr.io/wasmcloud/charts/wadm | ||
``` | ||
|
||
Validate installation with: | ||
|
||
```bash | ||
# make sure pods are ready | ||
kubectl rollout status deploy -l app.kubernetes.io/instance=wadm | ||
``` | ||
|
||
## Install the operator | ||
|
||
```sh | ||
kubectl apply -k ../../deploy/base | ||
``` | ||
|
||
Validate installation with: | ||
|
||
```bash | ||
# make sure pods are ready | ||
kubectl rollout status deploy -l app=wasmcloud-operator -n wasmcloud-operator | ||
# apiservice should be available | ||
kubectl get apiservices.apiregistration.k8s.io v1beta1.core.oam.dev | ||
``` | ||
|
||
## Create wasmcloud cluster | ||
|
||
```bash | ||
kubectl apply -f wasmcloud-host.yaml | ||
``` | ||
|
||
Check wasmCloud host status with: | ||
|
||
```bash | ||
kubectl describe wasmcloudhostconfig wasmcloud-host | ||
``` | ||
|
||
## Managing applications using kubectl | ||
|
||
Install the rust hello world application: | ||
|
||
```bash | ||
kubectl apply -f hello-world-application.yaml | ||
``` | ||
|
||
Check application status with: | ||
|
||
```bash | ||
kubectl get applications | ||
``` | ||
|
||
## Managing applications with wash | ||
|
||
Port forward into the NATS cluster. 4222 = NATS Service, 4223 = NATS Websockets | ||
|
||
```bash | ||
kubectl port-forward svc/nats 4222:4222 4223:4223 | ||
``` | ||
|
||
In another shell: | ||
|
||
```bash | ||
wash app list | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
apiVersion: core.oam.dev/v1beta1 | ||
kind: Application | ||
metadata: | ||
name: hello-world | ||
annotations: | ||
version: v0.0.1 | ||
description: "HTTP hello world demo in Rust, using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)" | ||
wasmcloud.dev/authors: wasmCloud team | ||
wasmcloud.dev/source-url: https://github.com/wasmCloud/wasmCloud/blob/main/examples/rusg/components/http-hello-world/wadm.yaml | ||
wasmcloud.dev/readme-md-url: https://github.com/wasmCloud/wasmCloud/blob/main/examples/rusg/components/http-hello-world/README.md | ||
wasmcloud.dev/homepage: https://github.com/wasmCloud/wasmCloud/tree/main/examples/rusg/components/http-hello-world | ||
wasmcloud.dev/categories: | | ||
http,http-server,rust,hello-world,example | ||
spec: | ||
components: | ||
- name: http-component | ||
type: component | ||
properties: | ||
image: ghcr.io/wasmcloud/components/http-hello-world-rust:0.1.0 | ||
traits: | ||
# Govern the spread/scheduling of the component | ||
- type: spreadscaler | ||
properties: | ||
replicas: 1 | ||
|
||
# Add a capability provider that enables HTTP access | ||
- name: httpserver | ||
type: capability | ||
properties: | ||
image: ghcr.io/wasmcloud/http-server:0.21.0 | ||
traits: | ||
# Establish a unidirectional link from this http server provider (the "source") | ||
# to the `http-component` component (the "target") so the component can handle incoming HTTP requests, | ||
# | ||
# The source (this provider) is configured such that the HTTP server listens on 127.0.0.1:8080 | ||
- type: link | ||
properties: | ||
target: http-component | ||
namespace: wasi | ||
package: http | ||
interfaces: [incoming-handler] | ||
source_config: | ||
- name: default-http | ||
properties: | ||
address: 127.0.0.1:8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
config: | ||
cluster: | ||
enabled: true | ||
replicas: 3 | ||
leafnodes: | ||
enabled: true | ||
websocket: | ||
enabled: true | ||
port: 4223 | ||
jetstream: | ||
enabled: true | ||
fileStore: | ||
pvc: | ||
size: 10Gi | ||
merge: | ||
domain: default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
wadm: | ||
image: | ||
tag: v0.12.2 | ||
config: | ||
nats: | ||
server: "nats.default.svc.cluster.local:4222" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: k8s.wasmcloud.dev/v1alpha1 | ||
kind: WasmCloudHostConfig | ||
metadata: | ||
name: wasmcloud-host | ||
spec: | ||
lattice: default | ||
version: "1.0.4" |
This file was deleted.
Oops, something went wrong.