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

work: name conflicts when different workloads have the same name #358

Closed
Garrybest opened this issue May 19, 2021 · 4 comments · Fixed by #359
Closed

work: name conflicts when different workloads have the same name #358

Garrybest opened this issue May 19, 2021 · 4 comments · Fixed by #359
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@Garrybest
Copy link
Member

What happened:
When different workload have the same name, the work that creating by the ResourceBindingController will have the same name in one ExecutionSpaceName, which would cause execution chaos.

Reason: The work's name is the same with the resource binding, but it's namespace is associated with cluster. I suggest to adding namespace to generate works' name.

workName := binding.GetName()
workNamespace, err := names.GenerateExecutionSpaceName(clusterName)
if err != nil {
klog.Errorf("Failed to ensure Work for cluster: %s. Error: %v.", clusterName, err)
return err
}

What you expected to happen:
The work's name may contain namespace to distinguish with each other.

How to reproduce it (as minimally and precisely as possible):
For example:
I create 2 deployment in 2 different namespace but having the same name, only one work will be created. When I delete them, the member cluster also runs one of a deployment which may cause resource leak.

[root@garryfang /data/garryfang/karmada/samples/nginx]# kubectl get deployments.apps -A
NAMESPACE   NAME    READY   UP-TO-DATE   AVAILABLE   AGE
garrytest   nginx   2/2     2            2           23s
lynntest    nginx   10/10   10           10          84s
[root@garryfang /data/garryfang/karmada/samples/nginx]# kubectl get works.work.karmada.io -A
NAMESPACE            NAME                  AGE
karmada-es-member1   garrytest-namespace   23h
karmada-es-member1   lynntest-namespace    4d12h
karmada-es-member1   nginx-deployment      99s
karmada-es-member2   garrytest-namespace   23h
karmada-es-member2   lynntest-namespace    4d12h
karmada-es-member3   garrytest-namespace   23h
karmada-es-member3   lynntest-namespace    4d12h

Only one work exists.

Anything else we need to know?:

Environment:

  • Karmada version: latest
  • Others:
Garrybest added a commit to Garrybest/karmada that referenced this issue May 19, 2021
Signed-off-by: Garrybest <garrybest@foxmail.com>
@Garrybest
Copy link
Member Author

/assign @Garrybest

@RainbowMango
Copy link
Member

/assign @Garrybest

Karmada bot not ready now, (it will be soon), manually assign to you :)

@RainbowMango RainbowMango added the kind/bug Categorizes issue or PR as related to a bug. label May 20, 2021
@RainbowMango
Copy link
Member

LGTM.
cc @GitHubxsy @mrlihanbo

@mrlihanbo
Copy link

LGTM

Garrybest added a commit to Garrybest/karmada that referenced this issue May 20, 2021
Signed-off-by: Garrybest <garrybest@foxmail.com>
RainbowMango pushed a commit that referenced this issue May 20, 2021
Signed-off-by: Garrybest <garrybest@foxmail.com>
lfbear pushed a commit to lfbear/karmada that referenced this issue May 20, 2021
Signed-off-by: Garrybest <garrybest@foxmail.com>
Signed-off-by: lfbear <lfbear@gmail.com>
XiShanYongYe-Chang pushed a commit to XiShanYongYe-Chang/karmada that referenced this issue Aug 28, 2021
Signed-off-by: Garrybest <garrybest@foxmail.com>
jwcesign pushed a commit to jwcesign/karmada that referenced this issue Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants