From da0ed7dfa52978f3c41b169a38709dd580f1e9d7 Mon Sep 17 00:00:00 2001 From: Alexander Wels Date: Fri, 2 Aug 2024 13:34:35 -0500 Subject: [PATCH] Allow nodeName to be set in blockrsync options If the source volume is RWO we need to ensure the blockrsync client is started on the same node as the running pod. This change allows the nodeName to be set in the blockrsync options. Signed-off-by: Alexander Wels --- state_transfer/transfer/blockrsync/client.go | 3 +++ state_transfer/transfer/blockrsync/options.go | 1 + 2 files changed, 4 insertions(+) diff --git a/state_transfer/transfer/blockrsync/client.go b/state_transfer/transfer/blockrsync/client.go index 6622a91..e095426 100644 --- a/state_transfer/transfer/blockrsync/client.go +++ b/state_transfer/transfer/blockrsync/client.go @@ -97,6 +97,9 @@ func createBlockrsyncClient(c client.Client, r *BlockrsyncTransfer, pvc transfer RestartPolicy: v1.RestartPolicyOnFailure, }, } + if r.transferOptions.NodeName != "" { + pod.Spec.NodeName = r.transferOptions.NodeName + } return c.Create(context.TODO(), &pod, &client.CreateOptions{}) } diff --git a/state_transfer/transfer/blockrsync/options.go b/state_transfer/transfer/blockrsync/options.go index 9e2e338..9293a1d 100644 --- a/state_transfer/transfer/blockrsync/options.go +++ b/state_transfer/transfer/blockrsync/options.go @@ -9,6 +9,7 @@ type TransferOptions struct { password string blockrsyncServerImage string blockrsyncClientImage string + NodeName string } func (t *TransferOptions) GetBlockrsyncServerImage() string {