sia agent - exit when refresh fails after configured number of attempts #2148
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
let's assume we have a setup where the certs are issued for 7 days and refresh daily (default behavior).
when SIA refreshes the certs and the certificate signer is down, the refresh will fail. This will cause the sia container to exit and a new one is created. however, the cert signer might be down for a so our sia container keeps restarting. however, the existing key/cert pair is valid for at least 6 days, so there is no reason to exit.
now, we have a configurable value with default setting of 2. this means we won't be exiting if we fail to refresh our certs, instead, we'll just ignore the failure and try again tomorrow. If after 2 refresh operations, we still fail, we'll exit.
In addition, when we fail, we also check if the cert will expire before the next rotation. So even if the fail count is below the limit, if the next refresh will be too late, we'll exit as well so that the container can keep trying to fetch new certs periodically.