Skip to content

bug: event leases are dropped on migration #4407

Closed

Description

@ntnn

Describe the bug

Events in an LC that is being migrated do not expire.

Steps To Reproduce

  1. Start an external etcd
etcd --data-dir .etcd

And run sharded-test-server against it

./bin/sharded-test-server --number-of-shards=3 \
  --shard-feature-gates=LogicalClusterMigration=true \
  --external-etcd-servers=http://localhost:2379
  1. Bind the migration API
export KUBEOCNFIG=.kcp/admin.kubeconfig
kubectl apply -f - <<EOF
apiVersion: apis.kcp.io/v1alpha2
kind: APIBinding
metadata:
  name: migration
spec:
  reference:
    export:
      path: root
      name: migration.kcp.io
EOF
  1. Create a workspaces with events
kubectl create-workspace event-migration --location-selector name=shard-1 --enter
kubectl apply -f - <<EOF
apiVersion: v1
kind: Event
metadata:
  name: demo-event
  namespace: default
involvedObject:
  apiVersion: v1
  kind: ConfigMap
  name: kube-root-ca.crt
  namespace: default
reason: Demo
message: lease check
type: Normal
EOF
  1. Check the lease in etcd:
kubectl ws :root
lc="$(kubectl get workspace event-migration -o jsonpath='{.spec.cluster}')"
etcdctl get "/shard/shard-1/core/events/$lc/default/demo-event" -w json | grep -o '"lease":[0-9]*'
  1. Migrate the LC
kubectl apply -f - <<EOF
apiVersion: migration.kcp.io/v1alpha1
kind: LogicalClusterMigration
metadata:
  name: event-migration
spec:
  logicalCluster: $lc
  destinationShard: shard-2
EOF
kubectl wait logicalclustermigration event-migration --for=jsonpath='{.status.phase}'=Completed
  1. Check the lease in etcd after the migration:
etcdctl get "/shard/shard-1/core/events/$lc/default/demo-event" -w json

Expected Behaviour

Events should retain their expiry during a migration.

Additional Context

No response

Activity

  1. added this to the TBD milestone on Oct 1, 2026
  2. added
    kind/bugCategorizes issue or PR as related to a bug.
    on Oct 1, 2026
  3. Sarthak-Shreshtha01 commented on Oct 5, 2026

    @Sarthak-Shreshtha01
    Contributor

    I looked into this, but I will not be able to work on it after all, so please feel free to pick it up. Thanks!

  4. moved this from New to Done in kcpon Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    • Status
      Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions