add --init-period and --init-max-failures flags#980
add --init-period and --init-max-failures flags#980k8s-ci-robot merged 6 commits intokubernetes:masterfrom
Conversation
|
Welcome @knQzx! |
thockin
left a comment
There was a problem hiding this comment.
Thanks. The code looks good, but I'd really like e2e tests to cover these (test_e2e.sh)
| dynamic credentials from an external secrets system). | ||
| See also $GITSYNC_PASSWORD. | ||
|
|
||
| --init-period <duration>, $GITSYNC_INIT_PERIOD |
There was a problem hiding this comment.
please keep this section alphabetical -- these should go earlier
|
thanks for the feedback, fixed - moved flags to alphabetical order, added readme docs, and added e2e tests for both init-period and init-timeout |
|
pushed a fix: the init-timeout test was using a valid repo with a slow fetch wrapper, so git-sync would succeed after 2s and run forever instead of timing out. swapped to a non-existent repo path so fetches actually fail and init-timeout fires as expected. |
- rename flag and helper to count-based (int, not duration) - skip --max-failures during init when init-max-failures is set so main-max does not override init tolerance - add SYNC PHASES section to --man and README describing init vs steady-state - update e2e test to use a bad server path, as suggested in review
|
reworked per the review:
lmk if the new shape works |
…ures - move flInitMaxFailures next to flMaxFailures - default flInitPeriod to flPeriod to kill conditional in hot path - replace isInitFailuresExceeded + useMainLimit with getMaxFailures closure - track waitTime as a loop-outer variable, flip on init-done - detect --init-max-failures via pflag.Changed || GITSYNC_INIT_MAX_FAILURES env; -1 = unlimited, 0 = abort immediately, unset = fall through to --max-failures - drop now-stale unit tests for removed helpers, update --man and README
|
applied all five. small deviation in getMaxFailures: kept |
|
Thanks! /lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: knQzx, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
summary
--init-periodflag - used for retries until the first successful sync, then switches to normal--period--init-max-failuresflag - aborts after N consecutive failures during the initial sync phase, then --max-failures takes overtest plan
chooseWaitTime()andisInitFailuresExceeded()helper functionsgo test ./...go build ./...fixes #959