zalando-incubator / zalando-incubator/stackset-controller

Fractional traffic weights don't seem to be set accurately

Open
#214 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
183
Forks
29
Avg merge
3d 18h
Merged PRs (30d)
5

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the fractional traffic changes with the zkubectl traffic commands and the provided StackSet manifest, then trace how the controller calculates and reports weights. Done means requested fractional values produce accurate desired, actual, and StackSet status weights for both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.