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

Fractional traffic weights don't seem to be set accurately #214

Open
herojan opened this issue Apr 17, 2020 · 0 comments
Open

Fractional traffic weights don't seem to be set accurately #214

herojan opened this issue Apr 17, 2020 · 0 comments

Comments

@herojan
Copy link
Contributor

herojan commented Apr 17, 2020

I have created a stackset called ss-stack with stacks v1 and v2. When I switch traffic using fractional values, the resulting traffic percentage is slightly inaccurate. See the following examples:

Examples
zkubectl traffic ss-stack ss-stack-v2 50.1
Name       │Actual│Desired
ss-stack-v1    100      50
ss-stack-v2      0    50.1
Name       │Actual│Desired
ss-stack-v1   50.0    50.0
ss-stack-v2   50.0    50.0

And in the stackset status I see:

[
  {
    "serviceName": "ss-stack-v1",
    "servicePort": 5678,
    "stackName": "ss-stack-v1",
    "weight": 49.95004995004995
  },
  {
    "serviceName": "ss-stack-v2",
    "servicePort": 5678,
    "stackName": "ss-stack-v2",
    "weight": 50.049950049950056
  }
]

Another example is

zkubectl traffic ss-stack ss-stack-v2 50.8
Name       │Actual│Desired
ss-stack-v1   50.0      49
ss-stack-v2   50.0    50.8
Name       │Actual│Desired
ss-stack-v1   49.1    49.1
ss-stack-v2   50.9    50.9

And the stackset status is

[
  {
    "serviceName": "ss-stack-v1",
    "servicePort": 5678,
    "stackName": "ss-stack-v1",
    "weight": 49.09819639278557
  },
  {
    "serviceName": "ss-stack-v2",
    "servicePort": 5678,
    "stackName": "ss-stack-v2",
    "weight": 50.901803607214426
  }
]

The stackset used was:

apiVersion: zalando.org/v1
kind: StackSet
metadata:
  labels:
    application: ss-stack
  name: ss-stack
spec:
  externalIngress:
    backendPort: 5678
  stackTemplate:
    spec:
      replicas: 1
      version: v1
      podTemplate:
        spec:
          containers:
            - name: gw-test-app
              image: hashicorp/http-echo
              args: ["-text", "Stack V1"]
              ports:
                - containerPort: 5678
              resources:
                requests:
                  cpu: 1
                  memory: 100Mi
                limits:
                  memory: 100Mi

It was applied and then reapplied with v1 replaced by v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant