vault_raft_snapshot_agent icon indicating copy to clipboard operation
vault_raft_snapshot_agent copied to clipboard

Add timeout support for vault client

Open luanphantiki opened this issue 4 years ago • 13 comments

ref:

  • https://github.com/Lucretius/vault_raft_snapshot_agent/issues/9
  • https://github.com/Lucretius/vault_raft_snapshot_agent/issues/20

luanphantiki avatar Oct 26 '21 13:10 luanphantiki

@Lucretius Please review it, thanks!

luanphantiki avatar Oct 26 '21 14:10 luanphantiki

@devops-42 , please consider to test this feature, it's not harmful for your production, but you should test it at UAT if possible.

luanphantiki avatar Oct 26 '21 14:10 luanphantiki

@luanphantiki

unfortunately it seems not to work. Steps which I've done:

  • cloned your repo
  • switched into branch snapshot-timeout-support
  • built the new Docker image using docker build -t imagename .
  • pushed the new image into our registry
  • added timeout setting in config file:
{
   "addr":"http://vault-leader:8200",
   "retain":72,
   "frequency":"3600s",
   "timeout":"300s",
   "role_id": "***",
   "secret_id":"***",
   "aws_storage":{
      "access_key_id":"***",
      "secret_access_key":"***",
      "s3_region":"us-east-1",
      "s3_bucket":"***,
      "s3_endpoint":***",
      "s3_force_path_style":true
   }
}
  • performed pod re-deployment

The pod still exits after 60 secs with the well-known error:

2021/10/27 12:35:29 Reading configuration...
2021/10/27 12:36:30 Unable to generate snapshot context deadline exceeded (Client.Timeout or context cancellation while reading body)

I already logged into the pod and can confirm, that the timeout value is present in the mounted config file. I also grepped against the binary of the vault_raft_snapshot_agent to check whether the right image has been pull from our registry:

grep timeout vault_raft_snapshot_agent 
[...]
json:"timeout,ommitempty"
[...]

Maybe I missed something?

devops-42 avatar Oct 27 '21 12:10 devops-42

@devops-42 : there was a typo on my code, fixed, can you please pull the latest and try again ?

luanphantiki avatar Oct 28 '21 02:10 luanphantiki

@luanphantiki

Tested again. The log file now shows that the timeout parameter could parsed correctly, but the task still aborts after 60s:

2021/10/28 08:13:05 Reading configuration...
2021/10/28 08:13:05 Vault client timeout has been set to 5m0s
2021/10/28 08:14:05 Unable to generate snapshot context deadline exceeded (Client.Timeout or context cancellation while reading body)

devops-42 avatar Oct 28 '21 08:10 devops-42

@devops-42 thanks, I might be missed somethings, will update it soon.

luanphantiki avatar Oct 28 '21 08:10 luanphantiki

@devops-42: please test the latest commit once have a chance, thanks!

luanphantiki avatar Oct 29 '21 13:10 luanphantiki

Hey @luanphantiki

finally :) Thumbs up, good work!

2021/10/29 13:58:25 Reading configuration...
2021/10/29 13:58:25 Vault http client timeout has been set to 5m0s
2021/10/29 14:01:43 Successfully created aws snapshot to ....

Thanks

devops-42 avatar Oct 29 '21 14:10 devops-42

Alright, thanks for the confirmation @devops-42 ;)

@Lucretius The new feature seems to work, please review it, thanks!

luanphantiki avatar Oct 29 '21 14:10 luanphantiki

Can we merge this is? For me snapshot creation didn't work at all. Sometimes got infamous context deadline error, but other times the snapshots were created with only 0 bytes. I just tried this PR to increase the timeout and it does work for me.

kirrmann avatar Nov 08 '22 13:11 kirrmann

@Lucretius The repository is stale since 2021 - are you planning on updating or enhancing it with PR's like this at all?

druesendieb avatar Jan 15 '24 07:01 druesendieb

HI @druesendieb: see https://github.com/Lucretius/vault_raft_snapshot_agent/issues/28#issuecomment-1516986172

This repo is not actively maintained any more. There are some forks with added features including the timeout for vault client (e.g. https://github.com/Boostport/vault_raft_snapshot_agent). I've created a fork too (https://github.com/Argelbargel/vault-raft-snapshot-agent) which includes most of the open prs and some further enhancements. Perhaps one of those might work for you?

Argelbargel avatar Jan 15 '24 17:01 Argelbargel

Hello,

No, I built this years ago when I was working at a place that used Vault, which I no longer do. There are others who have forked this repo and have enhanced it. Feel free to do so as well. I will update this repo to reflect its status.

Lucretius avatar Jan 15 '24 17:01 Lucretius