-
Notifications
You must be signed in to change notification settings - Fork 128
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
support cert by reference (#268) #269
Changes from 2 commits
e6b484b
cb5f5ef
8f6af95
8f29981
27a07d6
45eac8f
99c0a8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -432,9 +432,15 @@ func (b *stateBuilder) services() { | |
|
||
if s.ClientCertificate != nil && !utils.Empty(s.ClientCertificate.ID) { | ||
if _, ok := b.certIDs[*s.ClientCertificate.ID]; !ok { | ||
b.err = errors.Errorf("client certificate not found: %v", | ||
*s.ClientCertificate.ID) | ||
return | ||
_, err := b.currentState.Certificates.Get(*s.ClientCertificate.ID) | ||
if err == state.ErrNotFound { | ||
b.err = errors.Errorf("client certificate not found: %v", | ||
*s.ClientCertificate.ID) | ||
return | ||
} else if err != nil { | ||
b.err = err | ||
return | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you explain what is the case that you are trying to fix here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi Harry, sure.. the particular scenario we faced was that we want to setup mTLS between a Service and the Upstream endpoint, so a Client Cert/Key needs to be configured on the Gateway so that the Service can reference it. We also want to separate concerns so that the Client Cert/Key is updated in a different process than the Service/Route - for example having the Cert/Key updated/rotated by a security team, and the Service/Route updated by an application team. We use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I missed the reference to that issue before (please include it in your PR message body next time). So the use case you are trying to achieve makes a lot of sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have tested it; and there are a couple of unit tests included. You are correct that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah sorry - I follow what you are saying now - you are saying that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I retested and you are correct - this looks like it is a bit more involved to get it supported :(. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Harry, have a look at the latest commit and see if you agree with the solution. I added code to pull in all certs into the state in a different table ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the prompt response here. The current patch doesn't seem acceptable to me:
Amongst the two options, I think removing validation makes the most sense here. I do not like reducing validation but given the safety net that this will be caught by Kong's API later, this is okay. Foreign-key references are hard to catch in decK and are performed on a best effort basis. I also think it makes sense to add the validation you have in your patch but it requires some more machinery in the code-base to ensure maintainability. Managing in-memory state in decK is very hairy and tricky, I don't want to further increase the tech debt in this area. @ikethecoder Could you update the patch to remove the validation of Certificate from Service resource? Note for future-selves: |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems
b.certIDs
was used only in this one place and can now be completely removed.Can you delete the following lines as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, true! Have removed those lines.