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

fix(kuma-cp): allow names of the resource to be longer and validate the length #6123

Merged
merged 7 commits into from
Feb 28, 2023

Conversation

lukidzi
Copy link
Contributor

@lukidzi lukidzi commented Feb 23, 2023

When kuma-cp runs with Postgres database it allows the resource to have a name up to 100 characters. Kubernetes allows for most of the resources to have a length of 253 characters. There is the case that when kuma-cp runs in multizone deployment, during synchronization we are prefixing resource with the zone name and when the store is Kubernetes, we suffix resource name with the namespace name.
Resource name pattern when synced to global:

  • Global on Universal: zone-name.resource-name
  • Global on Kubernetes: zone-name.resource-name.namespace

Each element in the name has a different limit of character:

  • namespace - up to 63 characters
  • zone-name - up to 255 characters: 1 2
  • resource-name - whatever is left to fit into 253 characters allowed in etcd

There are 4 cases:

  • Global on K8s and Zone on K8s
  • Global on K8s and Zone on Universal
  • Global on Universal and Zone on Kubernetes
  • Global on Universal and Zone on Universal

To solve it I've increased the column size from 100 to 253 characters and added a check on API that validate that length of zone-name.resource-name.default is less than 253 characters. Because the only resources we synchronize from zone to global are the Dataplanes/ZoneEgress/ZoneIngress we don't need to check other namespaces. These resources can only be created in the default namespace. Another point to notice is that when running global on universal we are still checking for namespace because, on the zone level, we don't know what kind of database is running the global control-plane.

  • Link to relevant issue as well as docs and UI issues -- fix: Names being too long in Global break KDS #5681
  • This will not break child repos: it doesn't hardcode values (.e.g "kumahq" as a image registry) and it will work on Windows, system specific functions like syscall.Mkfifo have equivalent implementation on the other OS --
  • Tests (Unit test, E2E tests, manual test on universal and k8s) --
  • Do you need to update UPGRADE.md? --
  • Does it need to be backported according to the backporting policy? --
  • Do you need to explicitly set a > Changelog: entry here or add a ci/ label to run fewer/more tests?

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
@lukidzi lukidzi requested review from a team, bartsmykla and lobkovilya and removed request for a team February 23, 2023 19:01
@bartsmykla
Copy link
Contributor

/format

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
Signed-off-by: Łukasz Dziedziak <lukidzi@gmail.com>
@lukidzi lukidzi merged commit 60733cb into kumahq:master Feb 28, 2023
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

Successfully merging this pull request may close these issues.

Names being too long in Global break KDS
2 participants