Skip to content

Commit b25624f

Browse files
committed
PWX-34271: live migrate KubeVirt VMs before deleting the pod during PX rolling update (#1533)
In order to avoid downtime for KubeVirt VMs during PX rolling update, the operator now evicts the VMs before deleting PX pod. Live migration is used for VM eviction. PX pod is deleted only when there are no virt-launcher pods running on the node. There is a chance that a VM could land on the node after operator has checked for the VMs and proceeded with the deletion of PX pod. Operator adds "unschedulable" annotation on the node to tell Stork that it should not schedule pods on the node. However, Stork changes are needed for the annotation to take effect. We ignore the VMs that are not live migratable. If VM eviction fails, PX upadte is paused on the node and an event is generated. Signed-off-by: Neelesh Thakur <[email protected]>
1 parent 0f9de79 commit b25624f

File tree

29 files changed

+4399
-146
lines changed

29 files changed

+4399
-146
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ mockgen: $(GOPATH)/bin/mockgen
302302
$(GOPATH)/bin/mockgen -destination=pkg/mock/controllercache.mock.go -package=mock sigs.k8s.io/controller-runtime/pkg/cache Cache
303303
$(GOPATH)/bin/mockgen -destination=pkg/mock/preflight.mock.go -package=mock github.com/libopenstorage/operator/pkg/preflight CheckerOps
304304
$(GOPATH)/bin/mockgen -destination=drivers/storage/portworx/mock/manifest.mock.go -package=mock -source=./drivers/storage/portworx/manifest/manifest.go
305+
$(GOPATH)/bin/mockgen -destination=pkg/mock/kubevirtmanager.mock.go -package=mock github.com/libopenstorage/operator/pkg/controller/storagecluster KubevirtManager
306+
$(GOPATH)/bin/mockgen -destination=pkg/mock/mockcore/core.ops.mock.go -package=mockcore github.com/portworx/sched-ops/k8s/core Ops
307+
$(GOPATH)/bin/mockgen -destination=pkg/mock/mockkubevirtdy/kubevirt-dynamic.ops.mock.go -package=mockkubevirtdy github.com/portworx/sched-ops/k8s/kubevirt-dynamic Ops
305308

306309
clean: clean-release-manifest clean-bundle
307310
@echo "Cleaning up binaries"

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/operator-framework/api v0.17.1
1717
github.com/pborman/uuid v1.2.1
1818
github.com/portworx/kvdb v0.0.0-20230326003017-21a38cf82d4b
19-
github.com/portworx/sched-ops v1.20.4-rc1.0.20240214081459-b1e25baf33c9
19+
github.com/portworx/sched-ops v1.20.4-rc1.0.20240502044614-dc8638ea15f9
2020
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.63.0
2121
github.com/prometheus-operator/prometheus-operator/pkg/client v0.46.0
2222
github.com/sirupsen/logrus v1.9.3
@@ -136,8 +136,7 @@ require (
136136
replace (
137137
github.com/kubernetes-incubator/external-storage => github.com/libopenstorage/external-storage v5.1.1-0.20190919185747-9394ee8dd536+incompatible
138138
github.com/libopenstorage/openstorage => github.com/libopenstorage/openstorage v1.0.1-0.20240221210452-7757fdc2b8ff
139-
github.com/portworx/sched-ops => github.com/portworx/sched-ops v1.20.4-rc1.0.20240214081459-b1e25baf33c9
140-
139+
github.com/portworx/sched-ops => github.com/portworx/sched-ops v1.20.4-rc1.0.20240502044614-dc8638ea15f9
141140
golang.org/x/tools => golang.org/x/tools v0.1.11
142141
google.golang.org/grpc => google.golang.org/grpc v1.29.1
143142
google.golang.org/grpc/examples/helloworld/helloworld => google.golang.org/grpc/examples/helloworld/helloworld v1.29.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3863,8 +3863,8 @@ github.com/portworx/kvdb v0.0.0-20230326003017-21a38cf82d4b/go.mod h1:Q8YyrNDvPp
38633863
github.com/portworx/px-backup-api v1.0.1-0.20200915150042-274508e876ef/go.mod h1:puy7YVXeb6glot1vVCIePIiRLSwB//+rFtN2ZjvXeEw=
38643864
github.com/portworx/px-object-controller v0.0.0-20220804234424-40d3b8a84987/go.mod h1:g3pw2lI2AjqAixUCRhaBdKTY98znsCPR7NGRrlpimVU=
38653865
github.com/portworx/pxc v0.33.0/go.mod h1:Tl7hf4K2CDr0XtxzM08sr9H/KsMhscjf9ydb+MnT0U4=
3866-
github.com/portworx/sched-ops v1.20.4-rc1.0.20240214081459-b1e25baf33c9 h1:9/WeXMlhzvB4vWrh7AO2fhcSjrpbHsSwiansYHvtw3M=
3867-
github.com/portworx/sched-ops v1.20.4-rc1.0.20240214081459-b1e25baf33c9/go.mod h1:aBipy9Jl9IS77SFZi2RqH2UT8MeKEmja1MYembOaZrY=
3866+
github.com/portworx/sched-ops v1.20.4-rc1.0.20240502044614-dc8638ea15f9 h1:bPpp70Ll7bc1g0zDKB/af8ckNv01YmPZhHmfW4vU1HI=
3867+
github.com/portworx/sched-ops v1.20.4-rc1.0.20240502044614-dc8638ea15f9/go.mod h1:KOe618gr1FAzVmLNe9LFHss19df3MBZ0qom6Ct7RpyM=
38683868
github.com/portworx/talisman v0.0.0-20210302012732-8af4564777f7/go.mod h1:e8a6uFpSbOlRpZQlW9aXYogC+GWAo065G0RL9hDkD4Q=
38693869
github.com/portworx/torpedo v0.20.4-rc1.0.20210325154352-eb81b0cdd145/go.mod h1:CkLAs/ojTzSu3SPyeDxc3qhsbRU78H5Xz1qJlj1Ap1U=
38703870
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=

pkg/constants/metadata.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ const (
1515
LabelValueTrue = "true"
1616
// AnnotationGarbageCollection is the annotation to let operator clean up external objects on uninstallation.
1717
AnnotationGarbageCollection = OperatorPrefix + "/garbage-collection"
18+
// AnnotationEvictVMsDuringUpdate is the annotation to let operator evict VMs during upgrade
19+
AnnotationEvictVMsDuringUpdate = OperatorPrefix + "/evict-vms-during-update"
1820
// AnnotationNodeLabels is the storage pod annotation that contains node labels
1921
AnnotationNodeLabels = OperatorPrefix + "/node-labels"
2022
// AnnotationDisableStorage annotation to disable the storage pods from running (default: false)
2123
AnnotationDisableStorage = OperatorPrefix + "/disable-storage"
2224
// AnnotationReconcileObject annotation to toggle reconciliation of operator created objects
2325
AnnotationReconcileObject = OperatorPrefix + "/reconcile"
26+
// AnnotationControllerRevisionHashKey has the controller revision hash for which a VM live migration was triggered
27+
AnnotationControllerRevisionHashKey = OperatorPrefix + "/controller-revision-hash"
28+
// AnnotationVMIMigrationSourceNode has the source node for the VM live migration triggered by the operator
29+
AnnotationVMIMigrationSourceNode = OperatorPrefix + "/vmi-migration-source-node"
2430
// AnnotationClusterAPIMachine is the annotation key name for the name of the
2531
// machine that's backing the k8s node
2632
AnnotationClusterAPIMachine = "cluster.k8s.io/machine"
@@ -39,6 +45,8 @@ const (
3945
// the custom registry, there is a list of hardcoded common registries, however the list
4046
// may not be complete, users can use this annotation to add more.
4147
AnnotationCommonImageRegistries = OperatorPrefix + "/common-image-registries"
48+
// StorkAnnotationUnschedulable tells Stork to consider the node unschedulable
49+
StorkAnnotationUnschedulable = "stork.libopenstorage.org/unschedulable"
4250
// OperatorLabelManagedByKey is a label key that is added to any object that is
4351
// managed the Portworx operator.
4452
OperatorLabelManagedByKey = OperatorPrefix + "/managed-by"

0 commit comments

Comments
 (0)