-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
fix(certificate): hybrid dp cannot refresh certificate entity with vault reference #12868
Conversation
474bc7d
to
152772d
Compare
why wasn't this enough: I don't understand. Is it because of |
@bungle The value kong/kong/runloop/certificate.lua Line 211 in 1714e26
Without the kong/kong/runloop/certificate.lua Line 170 in 1714e26
So we're actually caching these cdata objects inside the L1 cache. Calling On the other hand secrets may gets updated when certificate entity is still in cache(hit L1/L2), so certificate entity's TTL must follow vault's TTL in some way |
The certificate entity itself is not refreshed unless there is new config. In which case it is read again from LMDB (because caches are purged)? But vault.update is always called before certificate is served.
This is where I have problem of understanding. Why would infinite value be a problem if caches are purged, and entity cannot change without caches being purged? |
Oh... that is the key! Thanks. |
@windmgc check last commit here for alternate proposal (basically only changing certificate.lua): My proposal: |
Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
@bungle I've applied the changes in your proposal, please review again, thanks! |
@kikito I added some backport labels to this. |
…ult reference (#12868) This PR fixes a problem that a certificate entity with cert/keys stored in a vault-referenced type cannot be refreshed even if the vault reference secret value has been updated both in L1/L2 vault PDK. FTI-5881 --------- Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> Co-authored-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> (cherry picked from commit 7dd29d4)
Successfully created cherry-pick PR for |
Successfully created backport PR for |
…ult reference (#12868) This PR fixes a problem that a certificate entity with cert/keys stored in a vault-referenced type cannot be refreshed even if the vault reference secret value has been updated both in L1/L2 vault PDK. FTI-5881 --------- Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> Co-authored-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> (cherry picked from commit 7dd29d4)
Successfully created backport PR for |
…ult reference (#12868) This PR fixes a problem that a certificate entity with cert/keys stored in a vault-referenced type cannot be refreshed even if the vault reference secret value has been updated both in L1/L2 vault PDK. FTI-5881 --------- Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> Co-authored-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> (cherry picked from commit 7dd29d4)
Successfully created backport PR for |
…ult reference (#12868) This PR fixes a problem that a certificate entity with cert/keys stored in a vault-referenced type cannot be refreshed even if the vault reference secret value has been updated both in L1/L2 vault PDK. FTI-5881 --------- Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> Co-authored-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> (cherry picked from commit 7dd29d4)
…ult reference (#12868) This PR fixes a problem that a certificate entity with cert/keys stored in a vault-referenced type cannot be refreshed even if the vault reference secret value has been updated both in L1/L2 vault PDK. FTI-5881 --------- Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> Co-authored-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> (cherry picked from commit 7dd29d4)
…ult reference (#12868) This PR fixes a problem that a certificate entity with cert/keys stored in a vault-referenced type cannot be refreshed even if the vault reference secret value has been updated both in L1/L2 vault PDK. FTI-5881 --------- Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> Co-authored-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> (cherry picked from commit 7dd29d4)
…ult reference (#12868) This PR fixes a problem that a certificate entity with cert/keys stored in a vault-referenced type cannot be refreshed even if the vault reference secret value has been updated both in L1/L2 vault PDK. FTI-5881 --------- Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> Co-authored-by: Aapo Talvensaari <aapo.talvensaari@gmail.com> (cherry picked from commit 7dd29d4)
Summary
This PR fixes a problem that a certificate entity with cert/keys stored in a vault-referenced type cannot be refreshed even if the vault reference secret value has been updated both in L1/L2 vault PDK.
The root cause of this problem is that in a dp node running hybrid mode, kong cache interfaces force the cache TTL to be infinite(and it also does not respect cache TTL configured in
kong.conf
), thus the certificate object cannot be updated unless a new configuration is received and cachepurge
being called.The PR fixes the problem by caching the vault reference fields
$ref
and callkong.vault.update
every time inget_certificate
, and l1 serializer will keep the value serialized inside the certificate object.This PR contains a test case that tests a certificate entity with a vault-referenced key that can be refreshed promptly, according to the TTL configured on the vault reference. The test case will fail consistently without the fix.
Checklist
changelog/unreleased/kong
orskip-changelog
label added on PR if changelog is unnecessary. README.mdIssue reference
FTI-5881