Skip to content

Commit

Permalink
fix: respect verify_ca and openstack_ca
Browse files Browse the repository at this point in the history
  • Loading branch information
mnaser committed Dec 12, 2022
1 parent dfd9304 commit 107cc2f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion magnum_cluster_api/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import yaml
from magnum import objects as magnum_objects
from magnum.common import cert_manager, cinder, context, neutron
from magnum.common import utils as magnum_utils
from magnum.common.x509 import operations as x509
from oslo_config import cfg
from oslo_serialization import base64
Expand Down Expand Up @@ -366,6 +367,8 @@ def __init__(
self.credential = credential

def get_object(self) -> pykube.Secret:
ca_certificate = magnum_utils.get_openstack_ca()

return pykube.Secret(
self.api,
{
Expand All @@ -379,13 +382,16 @@ def get_object(self) -> pykube.Secret:
"labels": self.labels,
},
"stringData": {
"cacert": open(certifi.where(), "r").read(),
"cacert": ca_certificate
if ca_certificate
else open(certifi.where(), "r").read(),
"clouds.yaml": yaml.dump(
{
"clouds": {
"default": {
"region_name": self.region_name,
"identity_api_version": 3,
"verify": CONF.drivers.verify_ca,
"auth": {
"auth_url": self.auth_url,
"application_credential_id": self.credential.id,
Expand Down

0 comments on commit 107cc2f

Please sign in to comment.