Repository navigation
Added config params & retry logic for getting secrets. See #2542 - #2717
Conversation
|
@vito we tried adding retries to https://github.com/concourse/atc/blob/master/creds/eval.go#L10:6 as you recommended in #2542, but revealed a number of issues:
so we decided not to go down that path and settled on:
adding this to every cred manager is not ideal, but we couldn't any common base that cred managers currently share. and even cred manager parameter parsing is done separately using cred manager name as a prefix. in the end it turned out ok, I think (not that many changes). but you'll have to configure retry attempts/timeout for every cred manager separately in order for this to work, we also need to:
|
vito
left a comment
There was a problem hiding this comment.
Having the retry logic in Get makes total sense, though I wonder if we could do it outside of each credential manager instead? I agree with the flaws with adding it to evaluate, but I think there's one more place we could try.
For example, everywhere we call NewVariables returns a creds.Variables interface - could we have a creds.Variables implementation that wraps the real implementation with retry logic? If I understand your changes correctly, that would accomplish the same goals, and only require one implementation (and one set of tests). I'm just worried about adding more behavior to the credential managers as the unit tests for some are slim to nonexistant (we cover them in TopGun instead, but that's also where testing things like retry logic can feel very cumbersome).
In fact, we might even be able to inject the retry logic all the way up top when we first construct a creds.VariablesFactory - by having a RetryableVariablesFactory that wraps the original, and having it return a RetryableVariables which wraps the original creds.Variables in turn.
What do ya think? 🙂
|
@vito that makes a lot of sense, I should have done this this way from the very beginning.
|
There was a problem hiding this comment.
Sweet! I think we can even skip the changes to the different managers by wrapping it once, way up in ATCCommand:
concourse/atc/atccmd/command.go
Line 884 in d8efdc1
You could also embed the creds.SecretRetryConfig here, which is currently empty - that way we don't have a bunch of different flags for the different credential managers:
concourse/atc/atccmd/command.go
Line 94 in d8efdc1
|
@vito if we embed SecretRetryConfig into RunCommand/CredentialManagement, I assume retry parameters would become global. right now it's done on cred mgr basis, i.e.: are you asking to switch to global? |
|
@ralekseenkov Yeah, I think it's fine to just have it global, since you can only configure one credential manager anyway. I don't think there's a need to configure it separately for each backend. |
|
ok, I switched it to global |
|
|
||
| type SecretRetryConfig struct { | ||
| Attempts int `long:"secret-retry-attempts" default:"5" description:"The number of attempts secret will be retried to be fetched, in case a retryable error happens."` | ||
| Interval time.Duration `long:"secret-retry-interval" default:"1s" description:"The interval between secret retry retrieval attempts."` |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
This is good to go so I'll just merge this in so you can try it out more easily. If the retry logic proves problematic it should be easy enough to switch to exponential backoff in a followup PR. This is still better than no retry at all. Thanks a bunch! 🎊 |
lookup and fail
all the same)