wasmCloud / wasmcloud-operator

Kubernetes operator for declaratively deploying wasmCloud applications (via wadm) and hosts on Kubernetes.
Apache License 2.0
28 stars 9 forks source link

Ensure wasmcloud-operator works with wadm applications without version specified #48

Closed joonas closed 3 months ago

joonas commented 3 months ago

Since wadm v0.12.0 it has been possible to leave the version annotation off from the Application manifest, we need to verify that the operator can successfully deploy and modify applications that do not have it set.

liamwh commented 3 months ago

Am getting this error with wadm v0.12.1:

Error from server (StatusInternalServerError): error when applying patch:
{"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"core.oam.dev/v1beta1\",\"kind\":\"Application\",\"metadata\":{\"annotations\":{\"description\":\"HTTP hello world demo in Golang (TinyGo), using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)\"},\"name\":\"tinygo-http-hello-world\",\"namespace\":\"wasmcloud\"},\"spec\":{\"components\":[{\"name\":\"http-hello-world-go\",\"properties\":{\"config\":[{\"name\":\"timezone\",\"properties\":{\"TZ\":\"Europe/Amsterdam\"}}],\"image\":\"ichp-harbor.apps.cluster0010.non-prod.ichp.ing.net/wasmcloud/http_hello_world_go:0.0.2\"},\"traits\":[{\"properties\":{\"replicas\":1},\"type\":\"spreadscaler\"}],\"type\":\"component\"},{\"name\":\"httpserver\",\"properties\":{\"image\":\"ichp-harbor.apps.cluster0010.non-prod.ichp.ing.net/wasmcloud/http-server:0.21.0\"},\"traits\":[{\"properties\":{\"interfaces\":[\"incoming-handler\"],\"namespace\":\"wasi\",\"package\":\"http\",\"source_config\":[{\"name\":\"default-http\",\"properties\":{\"address\":\"0.0.0.0:8062\"}}],\"target\":\"http-hello-world-go\"},\"type\":\"link\"}],\"type\":\"capability\"}]}}\n","version":null}},"spec":{"components":[{"name":"http-hello-world-go","properties":{"config":[{"name":"timezone","properties":{"TZ":"Europe/Amsterdam"}}],"image":"ichp-harbor.apps.cluster0010.non-prod.ichp.ing.net/wasmcloud/http_hello_world_go:0.0.2"},"traits":[{"properties":{"replicas":1},"type":"spreadscaler"}],"type":"component"},{"name":"httpserver","properties":{"image":"ichp-harbor.apps.cluster0010.non-prod.ichp.ing.net/wasmcloud/http-server:0.21.0"},"traits":[{"properties":{"interfaces":["incoming-handler"],"namespace":"wasi","package":"http","source_config":[{"name":"default-http","properties":{"address":"0.0.0.0:8062"}}],"target":"http-hello-world-go"},"type":"link"}],"type":"capability"}]}}
to:
Resource: "core.oam.dev/v1beta1, Resource=applications", GroupVersionKind: "core.oam.dev/v1beta1, Kind=Application"
Name: "tinygo-http-hello-world", Namespace: "wasmcloud"
for: "wadm.yaml": error when patching "wadm.yaml": unexpected response from wadm: result=Error, message=Model with the name tinygo-http-hello-world does not have the specified version to deploy

With this wadm.yaml:

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: tinygo-http-hello-world
  annotations:
    description: "HTTP hello world demo in Golang (TinyGo), using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)"
spec:
  components:
    - name: http-hello-world-go
      type: component
      properties:
        image: redacted
        config:
          - name: timezone
            properties:
              TZ: Europe/Amsterdam
      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: redacted
      traits:
        # Link the httpserver to the component, and configure the HTTP server
        # to listen on port 8062 for incoming requests
        - type: link
          properties:
            target: http-hello-world-go
            namespace: wasi
            package: http
            interfaces: [incoming-handler]
            source_config:
              - name: default-http
                properties:
                  address: 0.0.0.0:8062

Note that this manifest was previously deployed with the version field specified.

joonas commented 3 months ago

This is related to https://github.com/wasmCloud/wadm/pull/309

joonas commented 3 months ago

This has been merged in as part of the recently released 0.3.0