Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(license) add expired license behavior #5936

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rainest
Copy link
Contributor

@rainest rainest commented Apr 25, 2024

What this PR does / why we need it:

Add new rules for the license agent when the license is expired. The agent will use its initial polling period and disregard updated_at when its cached license is expired.

Add an expired license check helper.

Which issue this PR fixes:

Seeks to fix expired license status quickly, because we want to get out of that state if we're in it. This situation generally should not occur, but could if the controller were unable to talk to Konnect around the same time as its cached license was expiring.

The updated_at behavior is somewhat odd but based on an actual situation where upstream essentially lied about the date and provided a current license with an older updated_at than another expired license it had previously served. There's no use to providing an expired license to the gateway, so we may as well always update cache until we get something that's not expired.

Special notes for your reviewer:

Per comments, the Kong license APIs feature JSON blobs embedded in JSON objects, which is annoying. We can't really properly retrieve license expiration information, though we can probably reasonably expect that it is available at the indicated path. If that expectation breaks, this takes a conservative approach and reverts to expiration-unaware behavior (it updates at the standard interval and relies on updated_at).

The update frequency change is probably always warranted. The change to have expiration supersede updated_at were requested, but I'm less sure of them. There are some unknowns about the incident that suggest they're not actually warranted. See chat discussion for further details.

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

Add new rules for the license agent when the license is expired. The
agent will use its initial polling period and disregard updated_at when
its cached license is expired.

Add an expired license check helper.
Copy link

codecov bot commented Apr 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (main@feb2ce1). Click here to learn what that means.

Additional details and impacted files
@@          Coverage Diff           @@
##             main   #5936   +/-   ##
======================================
  Coverage        ?   72.2%           
======================================
  Files           ?     179           
  Lines           ?   18324           
  Branches        ?       0           
======================================
  Hits            ?   13238           
  Misses          ?    4107           
  Partials        ?     979           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant