-
Notifications
You must be signed in to change notification settings - Fork 3
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
Use a custom designate driver for FIP's #70
base: stable/yoga-m3
Are you sure you want to change the base?
Conversation
47fec91
to
0cc8559
Compare
672dc6d
to
1be302f
Compare
1be302f
to
a5bd376
Compare
Use designate /v2/reverse/floatingips/ endpoint to create DNS zones and DNS entries during FIP creation. Current driver uses zones and recordset endpoints instead of specific designate endpoint.
a5bd376
to
b44f3e7
Compare
neutron/services/externaldns/drivers/designate/driver_ccloud.py
Outdated
Show resolved
Hide resolved
neutron/services/externaldns/drivers/designate/driver_ccloud.py
Outdated
Show resolved
Hide resolved
neutron/services/externaldns/drivers/designate/driver_ccloud.py
Outdated
Show resolved
Hide resolved
neutron/services/externaldns/drivers/designate/driver_ccloud.py
Outdated
Show resolved
Hide resolved
fa3f049
to
20d9ba7
Compare
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.
only some minor things
neutron/services/externaldns/drivers/designate/driver_ccloud.py
Outdated
Show resolved
Hide resolved
class DesignateCcloud(driver.ExternalDNSService): | ||
"""Driver for Designate.""" |
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 looks like your code is almost identical to neutron.services.externaldns.drivers.designate.driver.Designate
. You could inherit that class and then only use the methods that changed, i.e. create_record_set()
and delete_record_set
.
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.
If I read the git log correctly, we already extensively modified that driver compared to upstream.
This means updating to a new release would mean patching two classes. If we want to avoid that we would need to compare the currently proposed new driver to upstream first and then overwrite the changed methods.
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.
Yes, we already have a changes for driver.py.
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, I see. Would it then make sense to - in an extra commit - change the driver back to original? Then we have the usptream driver there and only our changes in our own driver.
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 did a diff between the real upstream, our changes in yoga and the new ccloud driver, as well as the 2024.2 version.
Given that most of the code changes and only __init__
and 4 class-internal helper methods are not changed, inheriting from the upstream class seems to have no advantages, but would make the code hard to follow.
Reverting driver.py
back to the upstream version would, in my opinion, defeat the purpose of adding a new ccloud driver instead of replacing driver.py
. The original upstream driver will not work for us at all, and the reason to keep the our existing driver.py was, to be able to quickly switch back to that version by config, in case the new driver shows bad behavior.
If we replace our existing driver.py with upstream, we could also just replace driver.py by the ccloud_driver.py and be done.
client, admin_client = get_all_projects_edit_managed_client( | ||
context) |
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.
This seems to be the only change to the already existing Designate externaldns driver for this class. Why do we need this change here? It doesn't seem to be related to the FIP problem you set out to solve. If we don't need it we could just use the already existing delete_record_set()
and would have less code duplication.
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.
We need it to avoid leftover ptr's.
@@ -1,4 +1,4 @@ | |||
# Copyright (c) 2016 IBM | |||
# Copyright (c) 2025 SAP SE |
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.
Copyright is cumulative (i.e. as long as we keep some of the original code, the original's author still applies to that part of the code).
So please don't remove IBMs copyright, but instead add ours next to it, else this would be an IP infringement.
(Needed only for files that we actually change.)
@@ -1,4 +1,4 @@ | |||
# Copyright 2012 VMware, Inc. | |||
# Copyright (c) 2025 SAP SE |
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.
Same issue with the copyright - we cannot remove other companies as long as there is upstream code left in the file.
def get_clients(context, all_projects=False, edit_managed=False): | ||
global _SESSION | ||
|
||
if not _SESSION: | ||
_SESSION = loading.load_session_from_conf_options( | ||
CONF, 'designate') | ||
|
||
auth = token_endpoint.Token(CONF.designate.url, context.auth_token) | ||
client = d_client.Client(session=_SESSION, auth=auth) | ||
if CONF.designate.auth_type: | ||
admin_auth = loading.load_auth_from_conf_options( | ||
CONF, 'designate') | ||
else: | ||
# TODO(tkajinam): Make this fail when admin_* parameters are removed. | ||
admin_auth = password.Password( | ||
auth_url=CONF.designate.admin_auth_url, | ||
username=CONF.designate.admin_username, | ||
password=CONF.designate.admin_password, | ||
tenant_name=CONF.designate.admin_tenant_name, | ||
tenant_id=CONF.designate.admin_tenant_id) | ||
admin_client = d_client.Client(session=_SESSION, auth=admin_auth, | ||
endpoint_override=CONF.designate.url, | ||
all_projects=all_projects, | ||
edit_managed=edit_managed) | ||
return client, admin_client | ||
|
||
|
||
def get_all_projects_client(context): | ||
auth = token_endpoint.Token(CONF.designate.url, context.auth_token) | ||
return d_client.Client(session=_SESSION, auth=auth, all_projects=True) | ||
|
||
|
||
def get_all_projects_edit_managed_client(context): | ||
return get_clients(context, all_projects=True, edit_managed=True) |
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.
get_clients
is modified to support all_projects
and edit_managed
, which we need.
get_all_projects_client
is not used and can be omitted, that is true
and get_all_projects_edit_managed_client is a local addition that is not present in the original upstream.
So there is nothing to import left I think.
class DesignateCcloud(driver.ExternalDNSService): | ||
"""Driver for Designate.""" |
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 did a diff between the real upstream, our changes in yoga and the new ccloud driver, as well as the 2024.2 version.
Given that most of the code changes and only __init__
and 4 class-internal helper methods are not changed, inheriting from the upstream class seems to have no advantages, but would make the code hard to follow.
Reverting driver.py
back to the upstream version would, in my opinion, defeat the purpose of adding a new ccloud driver instead of replacing driver.py
. The original upstream driver will not work for us at all, and the reason to keep the our existing driver.py was, to be able to quickly switch back to that version by config, in case the new driver shows bad behavior.
If we replace our existing driver.py with upstream, we could also just replace driver.py by the ccloud_driver.py and be done.
No description provided.