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

Resources are pruned if using ApplySets #592

Closed
uhthomas opened this issue May 11, 2023 · 5 comments · May be fixed by #596
Closed

Resources are pruned if using ApplySets #592

uhthomas opened this issue May 11, 2023 · 5 comments · May be fixed by #596
Labels

Comments

@uhthomas
Copy link

uhthomas commented May 11, 2023

Expected behaviour

Kubernetes has introduced ApplySets, an improvement to server side apply and pruning.

https://kubernetes.io/blog/2023/05/09/introducing-kubectl-applyset-pruning/

ApplySets work by applying labels to objects it manages.

{
  "labels": {
      "app.kubernetes.io/component": "redis",
      "app.kubernetes.io/managed-by": "redis-operator",
      "app.kubernetes.io/name": "redis",
      "app.kubernetes.io/part-of": "redis-failover",
      "applyset.kubernetes.io/part-of": "applyset-xjZyH1FmMYtP-oSkfLUgubxDYIbsrD-IuDRLmezicIo-v1",
      "redisfailovers-role": "slave",
      "redisfailovers.databases.spotahome.com/name": "redis"
  }
}

The applyset label should not be inherited, or else the created resources are pruned.

Actual behaviour

service/rfr-redis pruned
service/rfs-redis pruned
deployment.apps/rfs-redis pruned
poddisruptionbudget.policy/rfr-redis pruned
poddisruptionbudget.policy/rfs-redis pruned
statefulset.apps/rfr-redis pruned
configmap/rfr-readiness-redis pruned
configmap/rfr-redis pruned
configmap/rfr-s-redis pruned
configmap/rfs-redis pruned

Steps to reproduce the behaviour

Create a RedisFailover object with KUBECTL_APPLYSET=true kubectl apply --server-side --applyset=some-apply-set --prune -f -. Wait for the resources to be created, and then observe they are pruned when the original custom resource is applied again.

Environment

How are the pieces configured?

  • Redis Operator version 1.2.4
  • Kubernetes version 1.27.1
  • Kubernetes configuration used (eg: Is RBAC active?) Server-Side Apply, ApplySets.

Logs

N/A

@uhthomas uhthomas changed the title Don't inherit labels from the custom resource Resources are pruned if using ApplySets May 11, 2023
@uhthomas
Copy link
Author

I recognise this behaviour is configurable with the LabelWhitelist field, though I would urge the authors to reconsider the default behaviour. I would expect that with the introduction of ApplySets, pruning will become more popular and label propagation should be opt-in rather than opt-out. Either that, or an exception should be made specifically for applyset labels.

uhthomas added a commit to uhthomas/redis-operator that referenced this issue May 11, 2023
Deployment tools like kubectl ApplySets use labels to keep track of objects they manage. Propagating those labels where a tool is actively pruning resources will cause resources managed by the operator to be pruned also.

https://kubernetes.io/blog/2023/05/09/introducing-kubectl-applyset-pruning/

Fixes spotahome#592
@github-actions
Copy link

This issue is stale because it has been open for 45 days with no activity.

@github-actions github-actions bot added the stale label Jun 26, 2023
@uhthomas
Copy link
Author

Closing an issue due to age isn't helpful for anyone.

@github-actions
Copy link

This issue is stale because it has been open for 45 days with no activity.

@github-actions github-actions bot added the stale label Aug 12, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant