Repository navigation
Conversation
- A verified lease's lic_exp now sets the license end in both directions. - Expired, revoked and suspended check-in answers trigger an immediate resync (throttled to one per 5 minutes). - Signed requests and activations carry server-corrected time from srv_time / X-Kwatch-Srv-Time; one retry after stale_timestamp. - Activate and move retry once on nonce_reused and send ts. - The lease and clock guard are stored as one record and mirrored to the kwatch-license-instance Secret, so emptyDir keeps offline grace. - Init raises the clock guard to the cached lease's signed time. - Retry backoff gets ±20% jitter.
Owner
Author
|
Folded into #567. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #567 (base
fixes-4). Client side of abahmed/kwatch-api#13.Changes
lic_exp, that date is the license end. A later date is an extension and a sooner one ends the license early, both without a network call (state.go).evaluate_extension_test.gonow asserts this. If a check-in comes backexpired,revokedorsuspended(403), the manager is told throughManager.ResyncOnVerdict, which wakes the renew loop at once. At most one resync runs per 5 minutes. The state still comes from the renew answer, never from the ping answer.Result.SrvTimeis read from the body'ssrv_time. If that is missing, it falls back toX-Kwatch-Srv-Timeand then toDate, so it works on 204s and on errors too. The manager keepsoffset = srv - localand uses it to timestamp renew, deactivate, ping, activate and move. Astale_timestampthat carries a server time updates the offset and retries once. A second rejection is treated as transient: the state stays the same, so Pro does not flap to Expired and back. The offset is used only for requestts; it never feeds the clock guard.kwatch-license-instancehashelm.sh/resource-policy: keep, sohelm uninstallkeeps it. This was already in the chart README, and the README now also mentions the lease copy.lease-cache. Its RBAC is unchanged (get/update on that name). On load, kwatch takes the newer verified lease from bolt or the Secret (license.NewerLease) and the later clock guard. The Secret is written when the lease changes or when the guard has moved by at least 1h. The chart README andvalues.yamlare updated.iat/srv_time.license.lease, so the guard cannot be deleted on its own. The old layout (a string lease pluslicense.clock) is still read.tsand retry once on409 nonce_reusedwith a fresh nonce. A reinstall over the cap gets429 rate_limited+Retry-After, which goes through the existingErrRateLimitedpath. It is not a verdict.Protocol assumptions (API #13)
X-Kwatch-Srv-Timeis unix seconds. The body'ssrv_timetakes precedence.tson activate and move is unix seconds, checked against ±600s, with the error400 stale_timestamp.409 {"error":"nonce_reused"}on activate and move.403 {"error":"expired"|"revoked"|"suspended"}.expis at mostlic_exp. The client does not depend on this.Compatibility
An older kwatch build reading the new record at
license.leasefails to parse it and activates again online. The fast edition grace check in the older binary is also skipped once.Checks
make verify-focused PKGS=./internal/license/... ./internal/app/...passed. The disk was low, so I used this instead of the fullmake verify.go test -raceand-tags licenseteston both packages passed.make ci, e2e and helm tests.