Kuadrant / kuadrant-console-plugin

Apache License 2.0
2 stars 2 forks source link

Improve the UX for setting custom weight selectors in the DNSPolicy create page #60

Open david-martin opened 1 month ago

david-martin commented 1 month ago

When the routing strategy is changed from Simple to Load Balanced, the loadBalancing.geo and loadBalancing.weighted fields become required. In the UI, when you change from Simple routing strategy to Load Balanced, it looks like:

image

A custom weight selector is then needed, set on the loadBalancing.weighted.custom key. When you click the 'Add Custom Weight Selector' button, new fields are shown like this:

image

You need to add 1 or more matchLabels or matchExpressions. (at least 1 of either, but can mix and match). When you click 'Add Match Label', it looks like this:

image

You can modify it, remove it, or add more. These end up looking like this in yaml:

spec:
  loadBalancing:
    geo:
      defaultGeo: eu
    weighted:
      custom:
        - selector:
            matchLabels:
              key-1: value1
              key-2: value2

When you click 'Add Match Expression', it looks like this:

image

You can modify the key, operator and value. You can also add more values. If you set the operator to 'Exists' or 'NotExists', the values are removed. Here's what it might look like in yaml:

spec:
  loadBalancing:
    geo:
      defaultGeo: eu
    weighted:
      custom:
        - selector:
            matchExpressions:
              - key: test
                operator: In
                values:
                  - val1
                  - val2

Things can get a little confusing as you add more match labels and match expressions. Here's with 2 of either:

image

Functionally, it allows you to build up what's possible in the CRD spec. However, there's definitely improvements to the layout (like grouping with labelled boxes, and limiting the width of fields and boxes) that would make for a better overall UX in this complex part of the view.