Skip to content

CloudStack DNS framework - Integrate PowerDNS as first plugin#12737

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

CloudStack DNS framework - Integrate PowerDNS as first plugin#12737
sudo87 wants to merge 60 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.

First supported DNS provider: PowerDNS

Github issue: #9958
Cwiki: https://cwiki.apache.org/confluence/display/CLOUDSTACK/DNS+Framework+and+Plugins
Doc PR: apache/cloudstack-documentation#646

Untitled Diagram drawio

Terminology:

  1. DNS Server: integration between CloudStack and DNS provider
  2. DNS Zone: Domain scope
  3. DNS Record: mapping entry with dns zones (e.g. mapping between names and ip)

API Changes

There are following APIs have been introduced to support DNS management from CloudStack and Instance auto registration:

  • [add/update/delete]DnsServer
  • [create/update/delete]DnsZone
  • [create/delete]DnsRecord
  • [associate/disassociate]DnsZoneToNetwork

UI changes
Screenshot 2026-04-27 at 4 38 42 PM
Screenshot 2026-04-27 at 4 38 49 PM
Screenshot 2026-04-27 at 4 38 57 PM
Screenshot 2026-04-27 at 4 39 21 PM

  • DNS Server subsection under Network
  • DNS Zone subsection under Network
  • DNS records management tab in the Dns Zone

Supported network for Auto Registration: Shared network

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 75.02935% with 638 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.29%. Comparing base (a73cc9a) to head (9391ea3).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../apache/cloudstack/dns/DnsProviderManagerImpl.java 79.59% 112 Missing and 50 partials ⚠️
...ava/org/apache/cloudstack/dns/DnsProviderUtil.java 60.29% 37 Missing and 17 partials ⚠️
...apache/cloudstack/dns/powerdns/PowerDnsClient.java 79.43% 23 Missing and 28 partials ⚠️
...g/apache/cloudstack/dns/dao/NicDnsJoinDaoImpl.java 0.00% 45 Missing ⚠️
...rg/apache/cloudstack/dns/dao/DnsServerDaoImpl.java 58.00% 41 Missing and 1 partial ⚠️
...rg/apache/cloudstack/dns/vo/DnsServerDetailVO.java 0.00% 37 Missing ⚠️
...ava/org/apache/cloudstack/dns/vo/NicDnsJoinVO.java 0.00% 33 Missing ⚠️
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 48.07% 26 Missing and 1 partial ⚠️
...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 ⚠️
... and 33 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12737      +/-   ##
============================================
+ Coverage     18.03%   18.29%   +0.25%     
- Complexity    16648    17013     +365     
============================================
  Files          6035     6091      +56     
  Lines        542487   545414    +2927     
  Branches      66477    66837     +360     
============================================
+ Hits          97854    99794    +1940     
- Misses       433612   434483     +871     
- Partials      11021    11137     +116     
Flag Coverage Δ
uitests 3.49% <ø> (-0.04%) ⬇️
unittests 19.48% <75.02%> (+0.28%) ⬆️

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 marked this pull request as ready for review April 28, 2026 08:55
@sudo87 sudo87 changed the title [WIP] DNS provider framework - PowerDNS plugin CloudStack DNS framework - Integrate PowerDNS as first plugin Apr 28, 2026
@sudo87
Copy link
Copy Markdown
Contributor Author

sudo87 commented Apr 28, 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 17627

Comment thread api/src/main/java/com/cloud/configuration/Resource.java Outdated
Comment thread api/src/main/java/org/apache/cloudstack/api/command/user/dns/AddDnsServerCmd.java Outdated
Comment thread api/src/main/java/org/apache/cloudstack/api/command/user/dns/AddDnsServerCmd.java Outdated
private List<String> nameServers;

@Parameter(name = "externalserverid", type = CommandType.STRING, description = "External server id or hostname for the DNS server, e.g., 'localhost' for PowerDNS")
private String externalServerId;
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.

is it applicable for PowerDNS only ?

I think we'd better avoid provider-specific parameters

@ACL(accessType = SecurityChecker.AccessType.OperateEntry)
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DnsZoneResponse.class, required = true,
description = "The ID of the DNS zone")
private Long id;
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.

when delete a DNS zone, is it possible to keep the DNS records on the external provider ?

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.

No, DNS records will no longer exist once DNS zone is deleted.

Comment thread api/src/main/java/org/apache/cloudstack/api/response/NicResponse.java Outdated
public enum DnsProviderType {
PowerDNS;
// Cloudflare
}
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.

there is an API to list all available DNS provider types:
ListDnsProvidersCmd, which calls listProviderNames

this enum may be not needed

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.

this is used other places and is not used in listDnsProviderCmd

Comment thread engine/schema/src/main/java/com/cloud/vm/dao/NicDetailsDaoImpl.java
}
HttpPost request = new HttpPost(buildUrl(baseUrl, port, "/servers/" + externalServerId + "/zones"));
request.setEntity(new StringEntity(json.toString(), StandardCharsets.UTF_8));
JsonNode response = execute(request, apiKey, 201);
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.

if the DNS zone already exists in powerdns, what will happen ?

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.

I wonder if DNS zone existence need to be checked before each DNS zone operation (create, update, list, delete), it will lead to 1 more API and cause longer response time. need to consider the trade-offs

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.

Client throws DnsConflictException and it is shown in the API response as error:

DNS zone: %s already exists"

@sudo87
Copy link
Copy Markdown
Contributor Author

sudo87 commented Apr 29, 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 17639

@sudo87 sudo87 force-pushed the dnsProviderFramework branch from dd4e94b to 9c435d6 Compare April 29, 2026 14:23
@sudo87 sudo87 force-pushed the dnsProviderFramework branch 2 times, most recently from 741a410 to 8e9fe78 Compare April 29, 2026 17:24
@sudo87 sudo87 force-pushed the dnsProviderFramework branch from 8e9fe78 to 8d365cb Compare April 29, 2026 18:21
@apache apache deleted a comment from blueorangutan Apr 30, 2026
@apache apache deleted a comment from blueorangutan Apr 30, 2026
@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.

@sudo87 sudo87 marked this pull request as draft April 30, 2026 09:35
@sudo87
Copy link
Copy Markdown
Contributor Author

sudo87 commented Apr 30, 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 ✔️ debian ✖️ suse15. SL-JID 17671

@blueorangutan
Copy link
Copy Markdown

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

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