Skip to content

[WIP] DNS provider framework - PowerDNS plugin#12737

Draft
sudo87 wants to merge 41 commits intoapache:mainfrom
shapeblue:dnsProviderFramework
Draft

[WIP] DNS provider framework - PowerDNS plugin#12737
sudo87 wants to merge 41 commits intoapache:mainfrom
shapeblue:dnsProviderFramework

Conversation

@sudo87
Copy link
Copy Markdown
Contributor

@sudo87 sudo87 commented Mar 3, 2026

Description

This PR introduces initial implementation for a plugin based DNS framework in Apache CloudStack. It enables both admin and end-users to manage DNS zones and record with external authoritative dns providers. PowerDNS is the first provider for initial implementation.

Github issue: #9958
Cwiki: https://cwiki.apache.org/confluence/display/CLOUDSTACK/DNS+Framework+and+Plugins

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

sudo87 added 22 commits February 9, 2026 10:52
2. added relevant changes in dao and vo
3. worked on creatednszone, integration with mgr
4. powerdns create zone api call
1. creatednszone
2. listdnszone
3. updatednszone
4. deletednszone
1. Add dns server
2. create zone
3. add records
4. verify in powerdns
5. verify using dig
1. Registerdnsrecordforvm api
2. removednsrecordforvm api
3. cleanup; fixed license, dao logic
1. refactored client
2. added exceptions
3. enhanced updateZone
4. ownership check for deleteDnsServer
1. port for dns_server
2. remove hard coded localhost for server_id
3. resolve and store server id if not passed in the api request
4. restrict public dns_server for domain admins and admins
…elete events

2. add dnsrecordurl in nic_details table
3. add dnsrecordurl in vm response
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 71.12737% with 671 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.23%. Comparing base (4f93ba8) to head (883dc32).
⚠️ Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
.../apache/cloudstack/dns/DnsProviderManagerImpl.java 58.36% 281 Missing and 40 partials ⚠️
...apache/cloudstack/dns/powerdns/PowerDnsClient.java 73.83% 34 Missing and 28 partials ⚠️
...g/apache/cloudstack/dns/dao/DnsNicJoinDaoImpl.java 0.00% 45 Missing ⚠️
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 21.81% 42 Missing and 1 partial ⚠️
...ava/org/apache/cloudstack/dns/vo/DnsNicJoinVO.java 0.00% 33 Missing ⚠️
...n/java/org/apache/cloudstack/dns/vo/DnsZoneVO.java 53.57% 24 Missing and 2 partials ⚠️
...pache/cloudstack/api/response/DnsZoneResponse.java 55.81% 18 Missing and 1 partial ⚠️
...che/cloudstack/api/response/DnsServerResponse.java 69.23% 11 Missing and 1 partial ⚠️
.../main/java/com/cloud/vm/dao/NicDetailsDaoImpl.java 0.00% 12 Missing ⚠️
...ava/org/apache/cloudstack/dns/DnsProviderUtil.java 76.47% 6 Missing and 6 partials ⚠️
... and 32 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12737      +/-   ##
============================================
+ Coverage     18.00%   18.23%   +0.22%     
- Complexity    16455    16808     +353     
============================================
  Files          5976     6031      +55     
  Lines        537582   540519    +2937     
  Branches      66006    66359     +353     
============================================
+ Hits          96784    98539    +1755     
- Misses       429885   430964    +1079     
- Partials      10913    11016     +103     
Flag Coverage Δ
uitests 3.49% <ø> (-0.04%) ⬇️
unittests 19.42% <71.12%> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@winterhazel winterhazel added this to the 4.23.0 milestone Mar 3, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 9, 2026

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@sudo87 sudo87 force-pushed the dnsProviderFramework branch from e9de026 to 981bb64 Compare March 19, 2026 11:12
@sudo87 sudo87 force-pushed the dnsProviderFramework branch from a6e812b to bde9fd9 Compare March 23, 2026 09:31
sudo87 added 2 commits March 23, 2026 18:21
1. Remove usage of in-memory eventBus for VM lifecycle events
2. Publish event for VM, NIC and DNS record delete events into  messageBus
3. Introducer subscribers for above topics
@sudo87
Copy link
Copy Markdown
Contributor Author

sudo87 commented Mar 26, 2026

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17245

@github-actions
Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

1. new messageSubscriber to handle dns record create/delete event
2. instance dns record registration uses hostname, prepend random 3 char if conflict
@sudo87
Copy link
Copy Markdown
Contributor Author

sudo87 commented Apr 6, 2026

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@weizhouapache
Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17395

Copy link
Copy Markdown
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically it looks fine overall.

left some minor comments

@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Record name")
private String name;

@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, required = true, description = "Record type (A, CNAME)")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sudo87
It looks like more record types are supported, right ?
if so, can you update the description ?

<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these properties needed ? @sudo87


-- Set default limit to 10 DNS zones for standard Accounts
INSERT INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `description`, `default_value`)
VALUES ('Advanced', 'DEFAULT', 'ResourceLimitManager', 'max.account.dns_zones', '10', 'The default maximum number of DNS zones that can be created by an Account', '10');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about projects and domains ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can enforce limits per project/domain. I wasn't sure if it would make sense to put it at project or domain level.

We can revisit this in next phase during resource limit enforcement.


@Encrypt
@Column(name = "api_key")
private String apiKey;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the API parameter is credentials, but database column name is api_key

what if there are multiple secrets ? for example both credentials and apikey (just an example) ?
can they be stored in the same column with a separator ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another param "dns_username" (might rename) which could be used with other providers following apiKey : apiSecret kind of credential.

@sudo87
Copy link
Copy Markdown
Contributor Author

sudo87 commented Apr 10, 2026

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17431

1. handle vm hostname change for dns registration
2. generate event for dns name collision
3. remove dns record lifecycle subscriber
@sudo87
Copy link
Copy Markdown
Contributor Author

sudo87 commented Apr 10, 2026

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17445

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DNS Provider for CloudStack

4 participants