Skip to content
Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ca0a1b1
skip none overrides on localdns profile
Sep 19, 2025
c044f0e
update history rst
Sep 19, 2025
19c6404
refactor to process dns overrides func
Sep 22, 2025
2778aba
move overrides function to helper file
Sep 22, 2025
6d0dd1e
apply linter suggestions
Sep 22, 2025
ffa5a65
Merge branch 'main' into juanbe/feature-localdns-none-input-handling
jdbencardinop Sep 23, 2025
f9a3328
add localdnsconfig folder
saewoni Sep 23, 2025
eb1363b
add more tests
saewoni Sep 23, 2025
0fd5c83
add new json files
saewoni Sep 24, 2025
450d1b8
add default dns overrides
saewoni Sep 24, 2025
e6474f3
add more test cases
saewoni Sep 24, 2025
f11d205
move tests around, move invalid cases to another file
saewoni Sep 25, 2025
3c6153b
add back import semver
saewoni Sep 25, 2025
8d63c84
reorder the existing tests
saewoni Sep 25, 2025
5a5e8fa
delete preferred mode only
saewoni Sep 26, 2025
a77e76e
delete null.json
saewoni Sep 26, 2025
68e89e7
remove redundant json file
saewoni Sep 26, 2025
240b83e
remove redundant json file
saewoni Sep 26, 2025
0ed5860
fix the mistake at line 3349
saewoni Sep 26, 2025
3f17065
forgot that i put all the configs in data/localconfig folder
saewoni Sep 26, 2025
b43f7ad
remove unused file
saewoni Sep 26, 2025
8ac70f8
spelling error
saewoni Sep 26, 2025
8ce451e
fix default dnsOverrides check when we create agentpool with required…
saewoni Sep 29, 2025
39e0ead
restore localdnsconfig file
saewoni Sep 29, 2025
14d70aa
delete extra property case from invalid test file
saewoni Sep 29, 2025
d73d85e
add extra property cases in src/aks-preview/azext_aks_preview/tests/l…
saewoni Sep 29, 2025
9ff61c9
add extra property files
saewoni Sep 29, 2025
734ad4c
check for defaulted *dnsOverrides when making agent pool with mode: r…
saewoni Sep 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Pending
* Add blue-green upgrade strategy support for AKS node pools:
- `az aks nodepool add/update/upgrade`: Add `--upgrade-strategy` parameter to switch between rolling and blue-green nodepool upgrades.
- `az aks nodepool add/update/upgrade`: Add `--drain-batch-size`, `--drain-timeout-bg`, `--batch-soak-duration`, `--final-soak-duration` parameters to configure blue-green upgrade settings.
* Fix `--localdns-config` parameter to handle null values in JSON configuration files gracefully, preventing crashes when DNS override sections are null.
Copy link
Member

Choose a reason for hiding this comment

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

please either choose a new version number or move your history notes to the pending section


18.0.0b38
+++++++
Expand Down
16 changes: 16 additions & 0 deletions src/aks-preview/azext_aks_preview/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,19 @@ def get_extension_in_allow_list(result):
if _check_if_extension_type_is_in_allow_list(result.extension_type.lower()):
return result
return None


def process_dns_overrides(overrides_dict, target_dict, build_override_func):
Copy link
Member

Choose a reason for hiding this comment

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

similar to the change in #9188, is the work duplicated?

Copy link
Contributor

Choose a reason for hiding this comment

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

this will be a follow up PR! once #9188 is merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

abandoning/closing this PR and will be making a new PR since juan's is merged: #9252

"""Helper function to safely process DNS overrides with null checks.

Processes DNS override dictionaries from LocalDNS configuration,
filtering out null values and applying the build function to valid entries.

:param overrides_dict: Dictionary containing DNS overrides (can be None)
:param target_dict: Target dictionary to populate with processed overrides
:param build_override_func: Function to build override objects from dict values
"""
if overrides_dict is not None:
for key, value in overrides_dict.items():
if value is not None:
target_dict[key] = build_override_func(value)
35 changes: 21 additions & 14 deletions src/aks-preview/azext_aks_preview/agentpool_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
from azext_aks_preview._helpers import (
get_nodepool_snapshot_by_snapshot_id,
filter_hard_taints,
process_dns_overrides,
)

logger = get_logger(__name__)
Expand Down Expand Up @@ -1477,13 +1478,16 @@ def build_override(override_dict):
return self.models.LocalDNSOverride(**filtered)

# Build kubeDNSOverrides and vnetDNSOverrides from the localdns_profile
kube_overrides = localdns_profile.get("kubeDNSOverrides")
for key, value in kube_overrides.items():
kube_dns_overrides[key] = build_override(value)

vnet_overrides = localdns_profile.get("vnetDNSOverrides")
for key, value in vnet_overrides.items():
vnet_dns_overrides[key] = build_override(value)
process_dns_overrides(
localdns_profile.get("kubeDNSOverrides"),
kube_dns_overrides,
build_override
)
process_dns_overrides(
localdns_profile.get("vnetDNSOverrides"),
vnet_dns_overrides,
build_override
)

agentpool.local_dns_profile = self.models.LocalDNSProfile(
mode=localdns_profile.get("mode"),
Expand Down Expand Up @@ -1816,13 +1820,16 @@ def build_override(override_dict):
return self.models.LocalDNSOverride(**filtered)

# Build kubeDNSOverrides and vnetDNSOverrides from the localdns_profile
kube_overrides = localdns_profile.get("kubeDNSOverrides")
for key, value in kube_overrides.items():
kube_dns_overrides[key] = build_override(value)

vnet_overrides = localdns_profile.get("vnetDNSOverrides")
for key, value in vnet_overrides.items():
vnet_dns_overrides[key] = build_override(value)
process_dns_overrides(
localdns_profile.get("kubeDNSOverrides"),
kube_dns_overrides,
build_override
)
process_dns_overrides(
localdns_profile.get("vnetDNSOverrides"),
vnet_dns_overrides,
build_override
)

agentpool.local_dns_profile = self.models.LocalDNSProfile(
mode=localdns_profile.get("mode"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"kubeDNSOverrides": {
".": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "ClusterCoreDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "PreferUDP",
"queryLogging": "Error",
"serveStale": "Immediate",
"serveStaleDurationInSeconds": 3600
},
"cluster.local": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "ClusterCoreDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "ForceTCP",
"queryLogging": "Error",
"serveStale": "Immediate",
"serveStaleDurationInSeconds": 3600
}
},
"vnetDNSOverrides": {
".": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "VnetDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "PreferUDP",
"queryLogging": "Error",
"serveStale": "Immediate",
"serveStaleDurationInSeconds": 3600
},
"cluster.local": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "ClusterCoreDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "ForceTCP",
"queryLogging": "Error",
"serveStale": "Immediate",
"serveStaleDurationInSeconds": 3600
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"mode": "Disabled"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"mode": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"mode": "InvalidMode"
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
"serveStaleDurationInSeconds": 3600
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"kubeDnsOverrides": {
".": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "ClusterCoreDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "PreferUDP",
"queryLogging": "Error",
"serveStale": "Verify",
"serveStaleDurationInSeconds": 3600
}
},
"vnetDnsOverrides": {
".": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "VnetDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "PreferUDP",
"queryLogging": "Error",
"serveStale": "Verify",
"serveStaleDurationInSeconds": 3600
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"mode": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"mode": "Required",
"kubeDnsOverrides": {},
"vnetDnsOverrides": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"mode": "Required",
"extraProperty": "unexpected",
"kubeDnsOverrides": {
".": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "ClusterCoreDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "PreferUDP",
"queryLogging": "Error",
"serveStale": "Verify",
"serveStaleDurationInSeconds": 3600
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mode": "Required",
"kubeDnsOverrides": {
".": {
"invalidField": 123
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mode": "Required",
"vnetDnsOverrides": {
".": {
"invalidField": 456
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"mode": "Required"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"mode": "Required",
"kubeDnsOverrides": {
".": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "ClusterCoreDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "PreferUDP",
"queryLogging": "Error",
"serveStale": "Verify",
"serveStaleDurationInSeconds": 3600
}
},
"vnetDnsOverrides": {
".": "invalid"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"mode": "Required",
"kubeDnsOverrides": {
".": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "ClusterCoreDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "PreferUDP",
"queryLogging": "Error",
"serveStale": "Verify",
"serveStaleDurationInSeconds": 3600
},
"cluster.local": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "ClusterCoreDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "ForceTCP",
"queryLogging": "Error",
"serveStale": "Immediate",
"serveStaleDurationInSeconds": 3600
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"mode": "Required",
"vnetDnsOverrides": {
".": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "VnetDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "PreferUDP",
"queryLogging": "Error",
"serveStale": "Verify",
"serveStaleDurationInSeconds": 3600
},
"cluster.local": {
"cacheDurationInSeconds": 3600,
"forwardDestination": "ClusterCoreDNS",
"forwardPolicy": "Sequential",
"maxConcurrent": 1000,
"protocol": "ForceTCP",
"queryLogging": "Error",
"serveStale": "Immediate",
"serveStaleDurationInSeconds": 3600
}
}
}
Loading
Loading