Skip to content

CloudStack DNS framework - Integrate PowerDNS as first plugin#12737

Open
sudo87 wants to merge 54 commits intoapache:mainfrom
shapeblue:dnsProviderFramework
Open

CloudStack DNS framework - Integrate PowerDNS as first plugin#12737
sudo87 wants to merge 54 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 79.16840% with 501 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.28%. Comparing base (82bfa9f) to head (dc18aa7).
⚠️ Report is 55 commits behind head on main.

Files with missing lines Patch % Lines
.../apache/cloudstack/dns/DnsProviderManagerImpl.java 80.30% 108 Missing and 47 partials ⚠️
...ava/org/apache/cloudstack/dns/DnsProviderUtil.java 62.50% 33 Missing and 12 partials ⚠️
...g/apache/cloudstack/dns/dao/NicDnsJoinDaoImpl.java 0.00% 45 Missing ⚠️
...apache/cloudstack/dns/powerdns/PowerDnsClient.java 83.12% 12 Missing and 28 partials ⚠️
...ava/org/apache/cloudstack/dns/vo/NicDnsJoinVO.java 0.00% 33 Missing ⚠️
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 45.09% 26 Missing and 2 partials ⚠️
...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 ⚠️
... and 32 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12737      +/-   ##
============================================
+ Coverage     17.95%   18.28%   +0.32%     
- Complexity    16522    16978     +456     
============================================
  Files          6022     6083      +61     
  Lines        541387   544955    +3568     
  Branches      66346    66790     +444     
============================================
+ Hits          97211    99640    +2429     
- Misses       433210   434193     +983     
- Partials      10966    11122     +156     
Flag Coverage Δ
uitests 3.49% <ø> (-0.04%) ⬇️
unittests 19.47% <79.16%> (+0.36%) ⬆️

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
Copy link
Copy Markdown
Contributor Author

sudo87 commented Apr 20, 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 17552

@blueorangutan
Copy link
Copy Markdown

[SF] Trillian test result (tid-15924)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 48629 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12737-t15924-kvm-ol8.zip
Smoke tests completed. 151 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_06_create_a_dns_record Failure 16.14 test_dns_framework_powerdns.py
test_07_create_aaaa_dns_records Failure 16.15 test_dns_framework_powerdns.py
test_08_create_mx_dns_record Failure 16.13 test_dns_framework_powerdns.py

@blueorangutan
Copy link
Copy Markdown

[SF] Trillian test result (tid-15933)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 57119 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12737-t15933-kvm-ol8.zip
Smoke tests completed. 151 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_provision_certificate Error 120.64 test_certauthority_root.py

1. stop and start vm operations wont trigger dns sync
2. ip update for nic will refresh dns records
@sudo87
Copy link
Copy Markdown
Contributor Author

sudo87 commented Apr 24, 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 17598

@weizhouapache
Copy link
Copy Markdown
Member

@sudo87
thanks for the PR
is this ready for review and QA ?

can you update the description to summarize the changes ?
can you compare with the design on cwiki page and list the differences if any ?

@sudo87
Copy link
Copy Markdown
Contributor Author

sudo87 commented Apr 27, 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 17614

@sudo87 sudo87 force-pushed the dnsProviderFramework branch from 8ca39da to e997f4c Compare April 27, 2026 08:32
@sudo87
Copy link
Copy Markdown
Contributor Author

sudo87 commented Apr 27, 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 17616

@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 17625

@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

object_storage("object_storage", 15),
gpu("gpu", 16);
gpu("gpu", 16),
dns_zone("dns_zone", 17);
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.

resource limitation on dns_zone is not implemented, isn't it ?

@Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "Whether the DNS server is publicly accessible by other accounts")
private Boolean isPublic;

@Parameter(name = ApiConstants.PUBLIC_DOMAIN_SUFFIX, type = CommandType.STRING, description = "The domain suffix used for public access (e.g. public.example.com)")
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
can you add more in the description ? for example, `If set, user can only create dns zones with this domain suffix ......"

private String publicDomainSuffix;

@Parameter(name = ApiConstants.NAME_SERVERS, type = CommandType.LIST, collectionType = CommandType.STRING,
required = true, description = "Comma separated list of name servers")
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.

add more details in the description like below ?
`NS records will be created for the DNS zone ......"

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 ?


@Parameter(name = ApiConstants.PROVIDER_TYPE, type = CommandType.STRING,
description = "filter by provider type (e.g. PowerDNS, Cloudflare)")
private String providerType;
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 this optional or required ?

will line 65 throw an exception if not set ?

private Boolean isEnabled;

@SerializedName(ApiConstants.NIC_DNS_NAME)
@Param(description = "Public IP address associated with this NIC via Static NAT rule")
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 description seems wrong

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

public void removeDetailsForValuesIn(String resourceName, List<String> values) {
SearchCriteria<NicDetailVO> sc = NameValuesSearch.create();
sc.setParameters(ApiConstants.NAME, resourceName);
sc.setParameters(ApiConstants.VALUE, values.toArray());
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.

to be safer, check if values is null or empty ? do nothing if so.

}
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

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