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

[FEATURE]: Add regex matching to spreadscalers #419

Open
jamesstocktonj1 opened this issue Sep 17, 2024 · 3 comments
Open

[FEATURE]: Add regex matching to spreadscalers #419

jamesstocktonj1 opened this issue Sep 17, 2024 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed rust Pull requests that update Rust code

Comments

@jamesstocktonj1
Copy link

jamesstocktonj1 commented Sep 17, 2024

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:

  • may reduce the number of labels per-host
  • keep traffic within a single availability zone (for use with Nats Leaf Nodes)
  • should be backwards compatible (provided your label doesn't have , *, + etc...)

Example

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

  • us-east-1
  • us-east-2
  • us-west-1
  • us-west-2
  • eu-west-1

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:

  • us-west-1
  • eu-west-1

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

@brooksmtownsend brooksmtownsend added enhancement New feature or request help wanted Extra attention is needed rust Pull requests that update Rust code good first issue Good for newcomers labels Sep 23, 2024
@brooksmtownsend
Copy link
Member

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
Copy link
Author

@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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed rust Pull requests that update Rust code
Projects
None yet
Development

No branches or pull requests

3 participants