diff --git a/test/e2e_node/runner/remote/run_remote.go b/test/e2e_node/runner/remote/run_remote.go index 8e4373e4d18..26872d5b4f1 100644 --- a/test/e2e_node/runner/remote/run_remote.go +++ b/test/e2e_node/runner/remote/run_remote.go @@ -935,12 +935,13 @@ func ignitionInjectGCEPublicKey(path string, content string) string { } const sshPublicKeyFileContentMarker = "GCE_SSH_PUBLIC_KEY_FILE_CONTENT" - return strings.Replace( - content, - sshPublicKeyFileContentMarker, - base64.StdEncoding.EncodeToString(sshPublicKey), - 1, + key := base64.StdEncoding.EncodeToString(sshPublicKey) + base64Marker := base64.StdEncoding.EncodeToString([]byte(sshPublicKeyFileContentMarker)) + replacer := strings.NewReplacer( + sshPublicKeyFileContentMarker, key, + base64Marker, key, ) + return replacer.Replace(content) } func imageToInstanceName(imageConfig *internalGCEImage) string {