-
Notifications
You must be signed in to change notification settings - Fork 4
Feature/custom certs #130
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
Feature/custom certs #130
Conversation
Currently deployed in dev (Silver, Gold/DR) at 5ba7708 Can see example route in Gold - https://console.apps.gold.devops.gov.bc.ca/k8s/ns/b8840c-dev/routes/wild-ns-gw-41c0c-webapps.gov.bc.ca from:
|
break | ||
|
||
for host in route_obj['hosts']: | ||
# Look for a matching certificate by SNI for custom domains |
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.
Can this new block of logic be moved to a separate function that returns cert
and cert_id
? Also, not sure if the Kong id
is a sufficient identifier for determining there is a changed cert, because a user can update the cert.cert
and cert.key
while keeping the kong id
the same. You could hash the cert.cert
and use that, or inspect the cert itself to get the serial number. Alternatively, don't bother passing the sslCertificateId
and let kube api dig out the serial number for comparison.
custom_cert_label= '' | ||
custom_cert_found = False | ||
|
||
if is_host_custom_domain(host): |
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.
Rather than duplicating the is_host_custom_domain
function, I would just skip it, and assume that if the certificates
is passed, then it is only including custom certs.. so just need to move the logger.debug
line under the if certificates
. You can then delete the is_host_custom_domain
for kube.
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.
I believe it's necessary to keep is_host_custom_domain - otherwise how to have kube raise an exception when a custom domain is used but no certs are provided?
e.g. this test: https://github.com/bcgov/gwa-api/blob/feature/custom-certs/microservices/kubeApi/tests/clients/test_ocp_routes.py#L161
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.
kube can still raise an exception - if no cert is found an exception should be thrown
logger.debug("[%s] Route A %03d matched ssl cert %s" % (select_tag, index, ssl_ref)) | ||
ssl_key = read_and_indent("/ssl/%s.key" % ssl_ref, 8) | ||
ssl_crt = read_and_indent("/ssl/%s.crt" % ssl_ref, 8) | ||
ssl_key = read_and_indent("/ssl/%s.key" % ssl_ref, 8) |
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.
what if host_transformation is enabled? Where does ssl_key
and ssl_crt
get set to when custom_cert_found is False?
@ikethecoder I believe I have address our issues in the last set of commits |
Description
Fixes:
Types of changes
Checklist
Further comments