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

When changing the namespace, the workload remains in the old namespace #5213

Open
ffjlabo opened this issue Sep 17, 2024 · 2 comments
Open
Labels
kind/bug Something isn't working

Comments

@ffjlabo
Copy link
Member

ffjlabo commented Sep 17, 2024

What happened:

When changing the namespace, the workload remains in the old namespace.

Change_ns_to_test2_by_ffjlabo_·Pull_Request__227·_ca-dp_ffjlabo-dev (1)

ca-tech-pipecd-support__Channel__-_CyberAgent_-_1_new_item_-_Slack

before

% kubectl get deployment -n test simple-hoge                                                               
NAME          READY   UP-TO-DATE   AVAILABLE   AGE
simple-hoge   2/2     2            2           12m

after

% kubectl get deployment -n test2 simple-hoge                                                             
NAME          READY   UP-TO-DATE   AVAILABLE   AGE
simple-hoge   2/2     2            2           7m8s

What you expected to happen:

It would be nice to delete the old resource successfully.

How to reproduce it:

Environment:

  • piped version:
  • control-plane version:
  • Others:
@ffjlabo ffjlabo added the kind/bug Something isn't working label Sep 17, 2024
@ffjlabo
Copy link
Member Author

ffjlabo commented Sep 17, 2024

[Root cause]
Resources in the old namespace cannot be deleted because the namespace is not included in the conditions for searching the deletion target resources.

Inside PipeCD, resources are identified by four types: apiVersion, kind, namespace, and name.
However, based on the live state and the manifest on git, in the pruning phase, the deletion target seems to be searched for only three things except for the namespace.

https://github.com/pipe-cd/pipecd/blob/c0d5b795de2e89ff6d3c1b7221fb2480c094ce72/pkg/app/piped/executor/kubernetes/sync.go#L131C2-L144C3

@khanhtc1202
Copy link
Member

khanhtc1202 commented Nov 8, 2024

NOTE:

  • For the same prune feature but in the config of PRIMARY_ROLLOUT we allow users to remove/prune the resource from the previous/old namespace
  • This issue only happened if using the prune feature in the config of K8S_SYNC (QUICK_SYNC prune true)

=> If there is no specific reason, we should keep the spec/behavior of this prune feature the same for both PRIMARY_ROLLOUT and K8S_SYNC stage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
Status: 📋 New
Development

No branches or pull requests

2 participants