Node plugin will try to migrate the pod's data whenever a pod needs to be unstaged in an unschedulable node. Some notes: We use node selectors in PV and the field is immutable. spec.volumeName in PVC is also immutable Since the node selector field in PV is immutable, we need to create the PV again and copy data from the old PV to the new one. Also since the PVC volumeName is immutable, we need to delete and then recreate the PVC with the right volumeName. During unstage, if node is not schedulable, we would first set the reclaim policy of PV to "Retain" so it wouldn't get deleted during the PVC recreation. Then keep a copy of base64 encoded PVC in PV's annotations in case something happens between PVC delete and create. The most important step here is setting the old-pv-name in the newly created PVC's annotations. It will be used in the new host "stage" phase to copy the data. When the new PVC is created, pod will be scheduled to a new node and the node plugin will check for the existence of the old-pv-name annotation, if present, it will try to copy the data from the source by "nsenter"ing to the host's namespace and using daemonizer2 to run rsync command to copy the data in background. During this time we will keep returning errors to the kubelet and kubelet will keep trying with backoffs but eventually, when data is copied, it would succeed and pod would run.
10 lines
134 B
Ruby
10 lines
134 B
Ruby
# frozen_string_literal: true
|
|
|
|
source "https://rubygems.org"
|
|
|
|
gem "grpc", "~> 1.73"
|
|
gem "grpc-tools", "~> 1.73"
|
|
gem "base64"
|
|
|
|
gemspec
|