mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #58708 from hyperbolic2346/mwilson/kubeapi-network-spaces
Automatic merge from submit-queue (batch tested with PRs 54242, 58522, 58704, 58708, 58712). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Adding network spaces support for kubeapi-load-balancer. **What this PR does / why we need it**: Adding support for juju network spaces to kubeapi-load-balancer charm **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # https://github.com/juju-solutions/bundle-canonical-kubernetes/issues/406 **Special notes for your reviewer**: **Release note**: ```release-note Added support for network spaces in the kubeapi-load-balancer charm ```
This commit is contained in:
commit
36ea7614e9
@ -56,8 +56,23 @@ apilb_nginx = """/var/log/nginx.*.log {
|
|||||||
}"""
|
}"""
|
||||||
|
|
||||||
|
|
||||||
@when('certificates.available')
|
def get_ingress_address(relation):
|
||||||
def request_server_certificates(tls):
|
try:
|
||||||
|
network_info = hookenv.network_get(relation.relation_name)
|
||||||
|
except NotImplementedError:
|
||||||
|
network_info = []
|
||||||
|
|
||||||
|
if network_info and 'ingress-addresses' in network_info:
|
||||||
|
# just grab the first one for now, maybe be more robust here?
|
||||||
|
return network_info['ingress-addresses'][0]
|
||||||
|
else:
|
||||||
|
# if they don't have ingress-addresses they are running a juju that
|
||||||
|
# doesn't support spaces, so just return the private address
|
||||||
|
return hookenv.unit_get('private-address')
|
||||||
|
|
||||||
|
|
||||||
|
@when('certificates.available', 'website.available')
|
||||||
|
def request_server_certificates(tls, website):
|
||||||
'''Send the data that is required to create a server certificate for
|
'''Send the data that is required to create a server certificate for
|
||||||
this server.'''
|
this server.'''
|
||||||
# Use the public ip of this unit as the Common Name for the certificate.
|
# Use the public ip of this unit as the Common Name for the certificate.
|
||||||
@ -65,7 +80,7 @@ def request_server_certificates(tls):
|
|||||||
# Create SANs that the tls layer will add to the server cert.
|
# Create SANs that the tls layer will add to the server cert.
|
||||||
sans = [
|
sans = [
|
||||||
hookenv.unit_public_ip(),
|
hookenv.unit_public_ip(),
|
||||||
hookenv.unit_private_ip(),
|
get_ingress_address(website),
|
||||||
socket.gethostname(),
|
socket.gethostname(),
|
||||||
]
|
]
|
||||||
# maybe they have extra names they want as SANs
|
# maybe they have extra names they want as SANs
|
||||||
|
Loading…
Reference in New Issue
Block a user