kubebuilder-declarative-pattern icon indicating copy to clipboard operation
kubebuilder-declarative-pattern copied to clipboard

Cross namespace pruning is not working as intended

Open JeffLuoo opened this issue 3 years ago • 2 comments
trafficstars

What happened: Using WithApplyPrune in the operator doesn't prune the objects in different namespaces.

What you expected to happen: All objects in all namespaces with matching labels will be pruned.

How to reproduce it (as minimally and precisely as possible): Use the guestbook operator example and replace the manifest file with

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: kube-system
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

to simplify the deployment.

Deploy the operator in the cluster and wait for the nginx-deployment to be deployed. Terminate the operator and update the namespace of the deployment to default and then restart the operator. I see that the nginx-deployment in the kube-system namespace still exists where the addons.example.org/guestbook: guestbook-sample is the common labels used by prune.

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version): 1.23
  • OS (e.g: cat /etc/os-release):
  • Kernel (e.g. uname -a):
  • Go version (e.g. go version): 1.17
  • Others:

JeffLuoo avatar Jul 18 '22 00:07 JeffLuoo

cc: @justinsb

JeffLuoo avatar Jul 18 '22 00:07 JeffLuoo

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Oct 16 '22 02:10 k8s-triage-robot

/unstale

JeffLuoo avatar Nov 02 '22 17:11 JeffLuoo

I wonder if the actual problem here is the different namespaces or if pruning generally did not work (also in the same namespace? I wonder if Deployments are by default whitelisted for pruning, if not, I guess that #274 might fix this. Did you try running the same command with kubectl manually and have you been able to prune the Deployment with that?

stephanhorsthemke avatar Nov 18 '22 09:11 stephanhorsthemke

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Dec 18 '22 10:12 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Jan 17 '23 11:01 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jan 17 '23 11:01 k8s-ci-robot