Skip to content

Commit 3ac6af4

Browse files
authored
hosted: describe every schema node so the Provider manifest passes core admission (#19)
The 0.4.0 hosted Provider was rejected by the core validating webhook on a live PMC (nameServers.items.description is required) and the chart's dns-api-controller Application stayed SyncError; only Route 53 and Cloudflare manifests were admitted in tests. Add the missing descriptions and a contract test that admits every packaged Provider manifest (external, hosted, route53, cloudflare) through validateProvider.
1 parent f42c181 commit 3ac6af4

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

‎deploy/charts/dns-api/templates/provider-hosted.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ spec:
2727
maxItems: 8
2828
items:
2929
type: object
30+
description: One authoritative nameserver and its glue addresses.
3031
additionalProperties: false
3132
required: [name, addresses]
3233
properties:
@@ -43,6 +44,7 @@ spec:
4344
maxItems: 8
4445
items:
4546
type: string
47+
description: One canonical IPv4 or IPv6 glue address.
4648
minLength: 2
4749
maxLength: 45
4850
soa:
@@ -58,21 +60,25 @@ spec:
5860
pattern: '^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$'
5961
refresh:
6062
type: integer
63+
description: SOA refresh interval in seconds.
6164
minimum: 1
6265
maximum: 2419200
6366
default: 3600
6467
retry:
6568
type: integer
69+
description: SOA retry interval in seconds.
6670
minimum: 1
6771
maximum: 2419200
6872
default: 900
6973
expire:
7074
type: integer
75+
description: SOA expire interval in seconds.
7176
minimum: 1
7277
maximum: 2419200
7378
default: 1209600
7479
minimum:
7580
type: integer
81+
description: SOA negative-caching TTL in seconds; the withdrawal evaluator uses it as the cache horizon.
7682
minimum: 1
7783
maximum: 2419200
7884
default: 300
@@ -84,6 +90,7 @@ spec:
8490
default: 60
8591
verification:
8692
type: object
93+
description: Read-only verification views and parent delegation observation.
8794
additionalProperties: false
8895
properties:
8996
views:
@@ -93,6 +100,7 @@ spec:
93100
uniqueItems: true
94101
items:
95102
type: string
103+
description: One canonical IP:port DNS endpoint.
96104
minLength: 3
97105
maxLength: 64
98106
pattern: '^(\[[0-9a-f:.]+\]|[0-9.]+):[1-9][0-9]{0,4}$'
@@ -167,6 +175,7 @@ spec:
167175
adoption: &empty
168176
openAPIV3Schema:
169177
type: object
178+
description: Hosted zones carry no provider adoption or record options payload.
170179
additionalProperties: false
171180
properties: {}
172181
statusProviderData:
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package webhook
2+
3+
import (
4+
"testing"
5+
6+
externalmanifest "github.com/appthrust/dns-api/internal/go/providers/external/manifest"
7+
hostedmanifest "github.com/appthrust/dns-api/internal/go/providers/hosted/manifest"
8+
dnsv1alpha1 "github.com/appthrust/dns-api/pkg/go/api/dns/v1alpha1"
9+
"sigs.k8s.io/yaml"
10+
)
11+
12+
// Every packaged Provider manifest must pass the same admission the core
13+
// webhook applies when the chart installs it. The hosted 0.4.0 manifest was
14+
// rejected live (`nameServers.items.description is required`) because only
15+
// Route 53 and Cloudflare were admitted in tests.
16+
func TestBuiltInProviderManifestsPassAdmission(t *testing.T) {
17+
manifests := map[string][]byte{
18+
"external": externalmanifest.ProviderYAML,
19+
"hosted": hostedmanifest.ProviderYAML,
20+
}
21+
for name, file := range map[string]string{"route53": "route53_extensions.yaml", "cloudflare": "cloudflare_extensions.yaml"} {
22+
provider := builtInProviderManifest(t, file)
23+
data, err := yaml.Marshal(provider)
24+
if err != nil {
25+
t.Fatal(err)
26+
}
27+
manifests[name] = data
28+
}
29+
for name, data := range manifests {
30+
t.Run(name, func(t *testing.T) {
31+
var provider dnsv1alpha1.Provider
32+
if err := yaml.Unmarshal(data, &provider); err != nil {
33+
t.Fatalf("unmarshal %s provider: %v", name, err)
34+
}
35+
if err := validateProvider(&provider); err != nil {
36+
t.Fatalf("validateProvider(%s): %v", name, err)
37+
}
38+
})
39+
}
40+
}

‎internal/go/providers/hosted/manifest/provider.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ spec:
2626
maxItems: 8
2727
items:
2828
type: object
29+
description: One authoritative nameserver and its glue addresses.
2930
additionalProperties: false
3031
required: [name, addresses]
3132
properties:
@@ -42,6 +43,7 @@ spec:
4243
maxItems: 8
4344
items:
4445
type: string
46+
description: One canonical IPv4 or IPv6 glue address.
4547
minLength: 2
4648
maxLength: 45
4749
soa:
@@ -57,21 +59,25 @@ spec:
5759
pattern: '^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$'
5860
refresh:
5961
type: integer
62+
description: SOA refresh interval in seconds.
6063
minimum: 1
6164
maximum: 2419200
6265
default: 3600
6366
retry:
6467
type: integer
68+
description: SOA retry interval in seconds.
6569
minimum: 1
6670
maximum: 2419200
6771
default: 900
6872
expire:
6973
type: integer
74+
description: SOA expire interval in seconds.
7075
minimum: 1
7176
maximum: 2419200
7277
default: 1209600
7378
minimum:
7479
type: integer
80+
description: SOA negative-caching TTL in seconds; the withdrawal evaluator uses it as the cache horizon.
7581
minimum: 1
7682
maximum: 2419200
7783
default: 300
@@ -83,6 +89,7 @@ spec:
8389
default: 60
8490
verification:
8591
type: object
92+
description: Read-only verification views and parent delegation observation.
8693
additionalProperties: false
8794
properties:
8895
views:
@@ -92,6 +99,7 @@ spec:
9299
uniqueItems: true
93100
items:
94101
type: string
102+
description: One canonical IP:port DNS endpoint.
95103
minLength: 3
96104
maxLength: 64
97105
pattern: '^(\[[0-9a-f:.]+\]|[0-9.]+):[1-9][0-9]{0,4}$'
@@ -166,6 +174,7 @@ spec:
166174
adoption: &empty
167175
openAPIV3Schema:
168176
type: object
177+
description: Hosted zones carry no provider adoption or record options payload.
169178
additionalProperties: false
170179
properties: {}
171180
statusProviderData:

0 commit comments

Comments
 (0)