Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ack_generate_info:
build_date: "2026-03-11T22:05:02Z"
build_hash: 5ac6c79fbc941c426d8b70cba768820fc9296542
go_version: go1.25.7
version: v0.58.0
api_directory_checksum: b612de0e7a18f2ad41155b5b645fb6676753f2ba
build_date: "2026-03-16T19:15:38Z"
build_hash: af2891ea8affbe25b5b1c4f397146e208e134603
go_version: go1.26.1
version: v0.58.0-2-gaf2891e
api_directory_checksum: 4f28c0f1bd2454828173a60002f54f7963f18c8e
api_version: v1alpha1
aws_sdk_go_version: v1.32.6
generator_config_info:
file_checksum: c4156ee69d38bea32cd1ddac3f41da19ebcf2680
file_checksum: 5ae421d838a4d0224a0630fee8446707b0902f14
original_file_name: generator.yaml
last_modification:
reason: API generation
15 changes: 13 additions & 2 deletions apis/v1alpha1/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ resources:
from:
operation: ListResourceRecordSets
path: ResourceRecordSets.AliasTarget
# This field cannot be ignored, but values for this will be overriden and should not be used
CidrRoutingConfig:
from:
operation: ListResourceRecordSets
Expand Down Expand Up @@ -156,13 +155,21 @@ resources:
update_operation:
custom_method_name: customUpdateRecordSet
HostedZone:
custom_cel_rules:
- rule: "!has(self.hostedZoneConfig) || !self.hostedZoneConfig.privateZone || has(self.vpc)"
message: "spec.vpc is required for private hosted zones"
exceptions:
terminal_codes:
- DelegationSetNotReusable
- InvalidDomainName
- InvalidInput
- InvalidVPCId
fields:
AdditionalVPCs:
custom_field:
list_of: VPC
compare:
is_ignored: True
DelegationSet:
from:
operation: CreateHostedZone
Expand All @@ -176,7 +183,11 @@ resources:
is_ignored: True
hooks:
delta_pre_compare:
code: compareTags(delta, a, b)
code: |
compareTags(delta, a, b)
compareAdditionalVPCs(delta, a, b)
sdk_delete_pre_build_request:
template_path: hooks/hosted_zone/sdk_delete_pre_build_request.go.tpl
sdk_read_one_post_set_output:
template_path: hooks/hosted_zone/sdk_read_one_post_set_output.go.tpl
sdk_create_post_set_output:
Expand Down
3 changes: 2 additions & 1 deletion apis/v1alpha1/hosted_zone.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions config/crd/bases/route53.services.k8s.aws_hostedzones.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ spec:

A complex type that contains general information about the hosted zone.
properties:
additionalVPCs:
items:
description: |-
(Private hosted zones only) A complex type that contains information about
an Amazon VPC.

If you associate a private hosted zone with an Amazon VPC when you make a
CreateHostedZone (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateHostedZone.html)
request, the following parameters are also required.
properties:
vpcID:
description: (Private hosted zones only) The ID of an Amazon
VPC.
type: string
vpcRegion:
type: string
type: object
type: array
delegationSetID:
description: |-
If you want to associate a reusable delegation set with this hosted zone,
Expand Down Expand Up @@ -122,6 +140,10 @@ spec:
required:
- name
type: object
x-kubernetes-validations:
- message: spec.vpc is required for private hosted zones
rule: '!has(self.hostedZoneConfig) || !self.hostedZoneConfig.privateZone
|| has(self.vpc)'
status:
description: HostedZoneStatus defines the observed state of HostedZone
properties:
Expand Down
15 changes: 13 additions & 2 deletions generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ resources:
from:
operation: ListResourceRecordSets
path: ResourceRecordSets.AliasTarget
# This field cannot be ignored, but values for this will be overriden and should not be used
CidrRoutingConfig:
from:
operation: ListResourceRecordSets
Expand Down Expand Up @@ -156,13 +155,21 @@ resources:
update_operation:
custom_method_name: customUpdateRecordSet
HostedZone:
custom_cel_rules:
- rule: "!has(self.hostedZoneConfig) || !self.hostedZoneConfig.privateZone || has(self.vpc)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

p: This case is probably fairly stable, but normally we delegate validation of the resource to the AWS API itself as its the source of truth for the service's validation rules. Performing the validation within the ACK controller runs the risk of our validation becoming out of sync with what the AWS service itself actually allows.

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.

I think the thing that's weird about this case is that each AssociateVPCWithHostedZone is a separate API call and the additionalVPCs don't have a direct representation in CreateHostedZone.

One alternative would be to make a brand new ACK type, like HostedZoneAssociatedVPC that just has spec.vpc and spec.hostedZone?

message: "spec.vpc is required for private hosted zones"
exceptions:
terminal_codes:
- DelegationSetNotReusable
- InvalidDomainName
- InvalidInput
- InvalidVPCId
fields:
AdditionalVPCs:
custom_field:
list_of: VPC
compare:
is_ignored: True
DelegationSet:
from:
operation: CreateHostedZone
Expand All @@ -176,7 +183,11 @@ resources:
is_ignored: True
hooks:
delta_pre_compare:
code: compareTags(delta, a, b)
code: |
compareTags(delta, a, b)
compareAdditionalVPCs(delta, a, b)
sdk_delete_pre_build_request:
template_path: hooks/hosted_zone/sdk_delete_pre_build_request.go.tpl
sdk_read_one_post_set_output:
template_path: hooks/hosted_zone/sdk_read_one_post_set_output.go.tpl
sdk_create_post_set_output:
Expand Down
26 changes: 24 additions & 2 deletions helm/crds/route53.services.k8s.aws_hostedzones.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ spec:

A complex type that contains general information about the hosted zone.
properties:
additionalVPCs:
items:
description: |-
(Private hosted zones only) A complex type that contains information about
an Amazon VPC.

If you associate a private hosted zone with an Amazon VPC when you make a
CreateHostedZone (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateHostedZone.html)
request, the following parameters are also required.
properties:
vpcID:
description: (Private hosted zones only) The ID of an Amazon
VPC.
type: string
vpcRegion:
type: string
type: object
type: array
delegationSetID:
description: |-
If you want to associate a reusable delegation set with this hosted zone,
Expand All @@ -58,9 +76,9 @@ spec:
description: |-
(Optional) A complex type that contains the following optional values:

- For public and private hosted zones, an optional comment
* For public and private hosted zones, an optional comment

- For private hosted zones, an optional PrivateZone element
* For private hosted zones, an optional PrivateZone element

If you don't specify a comment or the PrivateZone element, omit HostedZoneConfig
and the other elements.
Expand Down Expand Up @@ -122,6 +140,10 @@ spec:
required:
- name
type: object
x-kubernetes-validations:
- message: spec.vpc is required for private hosted zones
rule: '!has(self.hostedZoneConfig) || !self.hostedZoneConfig.privateZone
|| has(self.vpc)'
status:
description: HostedZoneStatus defines the observed state of HostedZone
properties:
Expand Down
Loading