wasmCloud / wadm

wasmCloud Application Deployment Manager (wadm) is a Wasm-native orchestrator for managing and scaling declarative wasmCloud applications.
https://wasmcloud.com
Apache License 2.0
106 stars 27 forks source link

[FEATURE]: Add regex matching to spreadscalers #419

Open jamesstocktonj1 opened 1 month ago

jamesstocktonj1 commented 1 month ago

Description

This feature lets you deploy to a set of labels which match the RegEx rather than just being equal to a label. This could allow for the following:

Example

Imagine a set of 5 nodes, each with the following zone labels:

And the following spreadscaler config:

- type: spreadscaler
  properties:
    replicas: 100
    spread:
      - name: spread-a
        requirements:
          zone: ([a-z]{2})-west-1

Would result in deployment to:

This prevents the need for separate labels for country, region and availability zone.

brooksmtownsend commented 1 month ago

Ooh @jamesstocktonj1 this is a really cool feature idea! I don't think this would be all that difficult to implement in the spreadscalers + daemonscalers, and we might be able to just treat the whole thing as regex. We should publish recommendations here if there are issues with escaping + special characters in YAML strings.

Notably this would not allow for regex matching on the key of the label, which I think is okay. Happy to help point in the right direction to where this can be implemented

jamesstocktonj1 commented 1 month ago

@brooksmtownsend Thanks for the feedback! I have used regex within yaml files before and they can just be wrapped in quote marks if/when escape characters become an issue. But I will be sure to check this out when testing.

LiamRandall commented 4 weeks ago

This is a cool idea; I can imagine a lot of different ways this could be leveraged.