Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: add support for secrets in manifests #307

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:
# Run all tests
- name: Run tests
run: |
cargo test -- --nocapture
cargo test --workspace -- --nocapture
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions crates/wadm-types/oam/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: config-example
annotations:
description: 'This is my app'
spec:
components:
- name: http
type: component
properties:
image: ghcr.io/wasmcloud/components/http-hello-world-rust:0.1.0
# You can pass any config data you'd like sent to your component as a string->string map
config:
- name: component_config
properties:
lang: EN-US

- name: webcap
type: capability
properties:
image: ghcr.io/wasmcloud/http-server:0.21.0
# You can pass any config data you'd like sent to your provider as a string->string map
config:
- name: provider_config
properties:
default-port: '8080'
cache_file: '/tmp/mycache.json'
40 changes: 40 additions & 0 deletions crates/wadm-types/oam/custom.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: my-example-app
annotations:
description: "This is my app revision 2"
spec:
components:
- name: userinfo
type: component
properties:
image: wasmcloud.azurecr.io/fake:1
traits:
# NOTE: This demonstrates what a custom scaler could look like. This functionality does not currently exist
- type: customscaler
properties:
instances: 4
clouds:
- aws
- azure
scale_profile: mini

- name: webcap
type: capability
properties:
image: wasmcloud.azurecr.io/httpserver:0.13.1
traits:
- type: link
properties:
target:
name: userinfo
namespace: wasi
package: http
interfaces:
- incoming-handler
source:
config:
- name: default-port
properties:
port: "8080"
38 changes: 38 additions & 0 deletions crates/wadm-types/oam/echo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: echo
annotations:
description: 'This is my app'
spec:
components:
- name: echo
type: component
properties:
image: wasmcloud.azurecr.io/echo:0.3.7
traits:
- type: spreadscaler
properties:
instances: 1

- name: httpserver
type: capability
properties:
image: wasmcloud.azurecr.io/httpserver:0.17.0
traits:
- type: spreadscaler
properties:
instances: 1
- type: link
properties:
target:
name: echo
namespace: wasi
package: http
interfaces:
- incoming-handler
source:
config:
- name: default-port
properties:
address: 0.0.0.0:8080
38 changes: 38 additions & 0 deletions crates/wadm-types/oam/hello.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Metadata
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: hello-world
annotations:
description: 'HTTP hello world demo'
spec:
components:
- name: http-component
type: component
properties:
# Run components from OCI registries as below or from a local .wasm component binary.
image: ghcr.io/wasmcloud/components/http-hello-world-rust:0.1.0
traits:
# One replica of this component will run
- type: spreadscaler
properties:
instances: 1
# The httpserver capability provider, started from the official wasmCloud OCI artifact
- name: httpserver
type: capability
properties:
image: ghcr.io/wasmcloud/http-server:0.21.0
traits:
# Link the HTTP server and set it to listen on the local machine's port 8080
- type: link
properties:
target:
name: http-component
namespace: wasi
package: http
interfaces: [incoming-handler]
source:
config:
- name: default-http
properties:
ADDRESS: 127.0.0.1:8080
60 changes: 60 additions & 0 deletions crates/wadm-types/oam/kvcounter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: kvcounter-rust
annotations:
description: 'Kvcounter demo in Rust, using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)'
labels:
app.oam.io/name: kvcounter-rust
spec:
components:
- name: kvcounter
type: component
properties:
image: file:///Users/brooks/github.com/wasmcloud/wadm/kvc/build/http_hello_world_s.wasm
traits:
# Govern the spread/scheduling of the component
- type: spreadscaler
properties:
instances: 1
# Compose with KVRedis for wasi:keyvalue calls
- type: link
properties:
target:
name: kvredis
config:
- name: redis-connect-local
properties:
url: redis://127.0.0.1:6379

namespace: wasi
package: keyvalue
interfaces:
- atomic
- eventual

# Add a capability provider that mediates HTTP access
- name: httpserver
type: capability
properties:
image: ghcr.io/wasmcloud/http-server:0.21.0
traits:
# Compose with component to handle wasi:http calls
- type: link
properties:
target:
name: kvcounter
namespace: wasi
package: http
interfaces:
- incoming-handler
source:
config:
- name: listen-config
properties:
address: 127.0.0.1:8080
# Add a capability provider that interfaces with the Redis key-value store
- name: kvredis
type: capability
properties:
image: ghcr.io/wasmcloud/keyvalue-redis:0.23.0
87 changes: 87 additions & 0 deletions crates/wadm-types/oam/simple1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"apiVersion": "core.oam.dev/v1beta1",
"kind": "Application",
"metadata": {
"name": "my-example-app",
"annotations": {
"description": "This is my app"
}
},
"spec": {
"components": [
{
"name": "userinfo",
"type": "actor",
"properties": {
"image": "wasmcloud.azurecr.io/fake:1"
},
"traits": [
{
"type": "spreadscaler",
"properties": {
"instances": 4,
"spread": [
{
"name": "eastcoast",
"requirements": {
"zone": "us-east-1"
},
"weight": 80
},
{
"name": "westcoast",
"requirements": {
"zone": "us-west-1"
},
"weight": 20
}
]
}
}
]
},
{
"name": "webcap",
"type": "capability",
"properties": {
"image": "wasmcloud.azurecr.io/httpserver:0.13.1"
},
"traits": [
{
"type": "link",
"properties": {
"target": "webcap",
"namespace": "wasi",
"package": "http",
"interfaces": ["incoming-handler"],
"name": "default"
}
}
]
},
{
"name": "ledblinky",
"type": "capability",
"properties": {
"image": "wasmcloud.azurecr.io/ledblinky:0.0.1"
},
"traits": [
{
"type": "spreadscaler",
"properties": {
"instances": 1,
"spread": [
{
"name": "haslights",
"requirements": {
"ledenabled": "true"
}
}
]
}
}
]
}
]
}
}
52 changes: 52 additions & 0 deletions crates/wadm-types/oam/simple1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: my-example-app
annotations:
description: "This is my app"
spec:
components:
- name: userinfo
type: actor
properties:
image: wasmcloud.azurecr.io/fake:1
traits:
- type: spreadscaler
properties:
instances: 4
spread:
- name: eastcoast
requirements:
zone: us-east-1
weight: 80
- name: westcoast
requirements:
zone: us-west-1
weight: 20

- name: webcap
type: capability
properties:
image: wasmcloud.azurecr.io/httpserver:0.13.1
traits:
- type: link
properties:
target:
name: webcap
namespace: wasi
package: http
interfaces: ["incoming-handler"]
name: default

- name: ledblinky
type: capability
properties:
image: wasmcloud.azurecr.io/ledblinky:0.0.1
traits:
- type: spreadscaler
properties:
instances: 1
spread:
- name: haslights
requirements:
ledenabled: "true"
Loading
Loading