Defining port ranges with native scheduler


Is it possible to define public port ranges for applications in the native scheduler? I have a service which serves UDP over ~100 ports and defining each individual rule is tedious and unsightly.

I looked for ways to do this with templating too, but unless seq is an available template function I think I would be stuck with something like:

{{repl range $port := [16384, 16385, ..., 16484]}}
- { public_port: {{repl $port}}, private_port: {{repl $port}}, port_type: udp }
{{repl end}}


Replicated Native YAML does not support free-form loops. You can only template individual fields.

If you need to write the same port in multiple locations, you could define a YAML anchor (the <<* and & syntax) to do something multiple times. Something like this:

base: &base
  port: 16384

foo: &foo
  <<: *base

bar: &bar
  <<: *base

Unfortunately, if all ~100 ports are unique, you will need to define them individually.


Thanks @kevinherro… Unfortunately these are 100 unique ports on the same service.