Skip to content

Resources are pruned if using ApplySets #592

@uhthomas

Description

@uhthomas

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions