Giter Club home page Giter Club logo

Comments (8)

somaritane avatar somaritane commented on June 15, 2024 1

@kuritka Yep, so my point is that by using percentages we're forcing users to think in % and keep the "100% in total" rule in mind.
Whereas when we use just numbers and calculate resulting weights as a proportion of the total sum, we give more flexibility.
This approach still allows using percentages as well, as you've shown in the examples above.
And we don't have to provide a complex validation in this case, we might just limit the max weight to some sensible value, like 1000

from k8gb.

kuritka avatar kuritka commented on June 15, 2024 1

Hi @ytsarev , sure we can. I supposed it's already closed

from k8gb.

kuritka avatar kuritka commented on June 15, 2024

The round robin is taken care of by our library https://github.com/k8gb-io/go-weight-shuffling, which shuffles the indexes in the array according to the predefined weights.

The library would run in the new CoreDNS external plugin within https://github.com/k8gb-io/coredns-crd-plugin. Data will be fed into this plugin from annotation within external DNS endpoints. The CoreDNS - external DNS plugin will read these annotations and arrange itself accordingly.

One cluster can have a number of IP addresses that can change from time to time. The N% weight is set per cluster (region), so I need IP addresses X Region X weight. The annotation is string, so I can annotate by json:

[
  {region: "eu", weightPercent: 20, targets:["172.18.0.5","172.18.0.6"]}, 
  {region: "us", weightPercent:80, targets:["172.18.0.1","172.18.0.2"]}
]
apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
  annotations:
    k8gb.absa.oss/dnstype: local
    k8gb.absa.oss/weight-round-robin: '[{"region":"eu","weightPercent":20,"targets":["172.18.0.5","172.18.0.6"]},{"region":"us","weightPercent":80,"targets":["172.18.0.1","172.18.0.2"]}]'
  name: k8gb-ns-extdns
  namespace: k8gb

from k8gb.

somaritane avatar somaritane commented on June 15, 2024

@kuritka sorry if I'm coming late to the party, but I've tried to check settings for different implementations of WRR, and in most cases, WRR weights are provided as positive integer instead of percentage:

https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy-weighted.html
https://cloud.google.com/dns/docs/zones/manage-routing-policies
https://en.wikipedia.org/wiki/Weighted_round_robin
https://en.wikipedia.org/wiki/SRV_record

The resulting percentage for a particular member can be calculated as a proportion of the total weight of all the members in the WRR group.

This way users also don't have to keep in mind the rule of having 100% of weights in total across n clusters.

from k8gb.

kuritka avatar kuritka commented on June 15, 2024

It's more about the point of view. The change is a little more extensive, but not complex. Currently it works with percentages and accept values values like "100", "100%",100,100%

But I can change it so that the results are equivalent

# current
weight:
  us: 50%
  eu: 30%
  za: 20
  uk: 0%

# new alternative (integers distribution) 
weight:
  us: 50
  eu: 30
  za: 20
  uk: 0

weight:
  us: 5
  eu: 3
  za: 2
  uk: 0

weight:
  us: 64
  eu: 38
  za: 26
  uk: 0

from k8gb.

kuritka avatar kuritka commented on June 15, 2024

ok, will keep it consistent with route53 style and refactor k8gb controller to integers.

from k8gb.

ytsarev avatar ytsarev commented on June 15, 2024

@kuritka as WRR is implemented, can we close this issue?

from k8gb.

ytsarev avatar ytsarev commented on June 15, 2024

WRR was released in https://github.com/k8gb-io/k8gb/releases/tag/v0.11.1. Closing

from k8gb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.