From bfc0975010ae01a650a121598f84a37ecabbd4a6 Mon Sep 17 00:00:00 2001 From: Bogusz Przybyslawski Date: Tue, 7 Apr 2026 14:04:58 +0200 Subject: [PATCH] feat: Add support for PrivateDnsPreference --- apis/v1alpha1/ack-generate-metadata.yaml | 12 ++++++------ apis/v1alpha1/generator.yaml | 2 -- apis/v1alpha1/types.go | 4 +++- apis/v1alpha1/zz_generated.deepcopy.go | 16 ++++++++++++++++ .../ec2.services.k8s.aws_vpcendpoints.yaml | 6 ++++++ generator.yaml | 2 -- .../ec2.services.k8s.aws_vpcendpoints.yaml | 6 ++++++ pkg/resource/vpc_endpoint/delta.go | 14 ++++++++++++++ pkg/resource/vpc_endpoint/sdk.go | 18 ++++++++++++++++++ 9 files changed, 69 insertions(+), 11 deletions(-) diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 2ae1d5ab..6d6e833c 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,13 +1,13 @@ ack_generate_info: - build_date: "2026-03-31T20:49:31Z" - build_hash: a9e2ceaadfc00a742e2ea2b6d6c68348f03e52a5 - go_version: go1.26.1 - version: v0.58.0-3-ga9e2cea -api_directory_checksum: 3dca3992dafa3c55cf11ec49bf1b3084c01ae8d6 + build_date: "2026-04-07T12:02:42Z" + build_hash: 5ac6c79fbc941c426d8b70cba768820fc9296542 + go_version: go1.25.0 + version: v0.58.0 +api_directory_checksum: 867dd073cbb72ef522ddde8e85547d53864a003f api_version: v1alpha1 aws_sdk_go_version: v1.41.1 generator_config_info: - file_checksum: 7d17e806218e4f31db5006de1aa270afb85e867e + file_checksum: 413676fd125a4e590732464fa337e990ee9b27fc original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index f2c76e1c..e0ee25a6 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -70,8 +70,6 @@ ignore: - CreateVpcEndpointInput.TagSpecifications - CreateVpcEndpointInput.ClientToken - CreateVpcEndpointInput.DnsOptions.PrivateDnsOnlyForInboundResolverEndpoint - - CreateVpcEndpointInput.DnsOptions.PrivateDnsPreference - - CreateVpcEndpointInput.DnsOptions.PrivateDnsSpecifiedDomains - CreateVpcEndpointInput.ResourceConfigurationArn - CreateVpcEndpointInput.SubnetConfigurations - CreateVpcEndpointOutput.VpcEndpoint.FailureReason diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index 5e5a7d96..a972baf8 100644 --- a/apis/v1alpha1/types.go +++ b/apis/v1alpha1/types.go @@ -1209,7 +1209,9 @@ type DNSOptions struct { // Describes the DNS options for an endpoint. type DNSOptionsSpecification struct { - DNSRecordIPType *string `json:"dnsRecordIPType,omitempty"` + DNSRecordIPType *string `json:"dnsRecordIPType,omitempty"` + PrivateDNSPreference *string `json:"privateDNSPreference,omitempty"` + PrivateDNSSpecifiedDomains []*string `json:"privateDNSSpecifiedDomains,omitempty"` } // Information about the DNS server to be used. diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index bb0d244f..0c8c5d8f 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -5030,6 +5030,22 @@ func (in *DNSOptionsSpecification) DeepCopyInto(out *DNSOptionsSpecification) { *out = new(string) **out = **in } + if in.PrivateDNSPreference != nil { + in, out := &in.PrivateDNSPreference, &out.PrivateDNSPreference + *out = new(string) + **out = **in + } + if in.PrivateDNSSpecifiedDomains != nil { + in, out := &in.PrivateDNSSpecifiedDomains, &out.PrivateDNSSpecifiedDomains + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DNSOptionsSpecification. diff --git a/config/crd/bases/ec2.services.k8s.aws_vpcendpoints.yaml b/config/crd/bases/ec2.services.k8s.aws_vpcendpoints.yaml index 06853f4f..4f33c236 100644 --- a/config/crd/bases/ec2.services.k8s.aws_vpcendpoints.yaml +++ b/config/crd/bases/ec2.services.k8s.aws_vpcendpoints.yaml @@ -54,6 +54,12 @@ spec: properties: dnsRecordIPType: type: string + privateDNSPreference: + type: string + privateDNSSpecifiedDomains: + items: + type: string + type: array type: object ipAddressType: description: The IP address type for the endpoint. diff --git a/generator.yaml b/generator.yaml index f2c76e1c..e0ee25a6 100644 --- a/generator.yaml +++ b/generator.yaml @@ -70,8 +70,6 @@ ignore: - CreateVpcEndpointInput.TagSpecifications - CreateVpcEndpointInput.ClientToken - CreateVpcEndpointInput.DnsOptions.PrivateDnsOnlyForInboundResolverEndpoint - - CreateVpcEndpointInput.DnsOptions.PrivateDnsPreference - - CreateVpcEndpointInput.DnsOptions.PrivateDnsSpecifiedDomains - CreateVpcEndpointInput.ResourceConfigurationArn - CreateVpcEndpointInput.SubnetConfigurations - CreateVpcEndpointOutput.VpcEndpoint.FailureReason diff --git a/helm/crds/ec2.services.k8s.aws_vpcendpoints.yaml b/helm/crds/ec2.services.k8s.aws_vpcendpoints.yaml index 06853f4f..4f33c236 100644 --- a/helm/crds/ec2.services.k8s.aws_vpcendpoints.yaml +++ b/helm/crds/ec2.services.k8s.aws_vpcendpoints.yaml @@ -54,6 +54,12 @@ spec: properties: dnsRecordIPType: type: string + privateDNSPreference: + type: string + privateDNSSpecifiedDomains: + items: + type: string + type: array type: object ipAddressType: description: The IP address type for the endpoint. diff --git a/pkg/resource/vpc_endpoint/delta.go b/pkg/resource/vpc_endpoint/delta.go index 1243da40..2749f9b0 100644 --- a/pkg/resource/vpc_endpoint/delta.go +++ b/pkg/resource/vpc_endpoint/delta.go @@ -52,6 +52,20 @@ func newResourceDelta( delta.Add("Spec.DNSOptions.DNSRecordIPType", a.ko.Spec.DNSOptions.DNSRecordIPType, b.ko.Spec.DNSOptions.DNSRecordIPType) } } + if ackcompare.HasNilDifference(a.ko.Spec.DNSOptions.PrivateDNSPreference, b.ko.Spec.DNSOptions.PrivateDNSPreference) { + delta.Add("Spec.DNSOptions.PrivateDNSPreference", a.ko.Spec.DNSOptions.PrivateDNSPreference, b.ko.Spec.DNSOptions.PrivateDNSPreference) + } else if a.ko.Spec.DNSOptions.PrivateDNSPreference != nil && b.ko.Spec.DNSOptions.PrivateDNSPreference != nil { + if *a.ko.Spec.DNSOptions.PrivateDNSPreference != *b.ko.Spec.DNSOptions.PrivateDNSPreference { + delta.Add("Spec.DNSOptions.PrivateDNSPreference", a.ko.Spec.DNSOptions.PrivateDNSPreference, b.ko.Spec.DNSOptions.PrivateDNSPreference) + } + } + if len(a.ko.Spec.DNSOptions.PrivateDNSSpecifiedDomains) != len(b.ko.Spec.DNSOptions.PrivateDNSSpecifiedDomains) { + delta.Add("Spec.DNSOptions.PrivateDNSSpecifiedDomains", a.ko.Spec.DNSOptions.PrivateDNSSpecifiedDomains, b.ko.Spec.DNSOptions.PrivateDNSSpecifiedDomains) + } else if len(a.ko.Spec.DNSOptions.PrivateDNSSpecifiedDomains) > 0 { + if !ackcompare.SliceStringPEqual(a.ko.Spec.DNSOptions.PrivateDNSSpecifiedDomains, b.ko.Spec.DNSOptions.PrivateDNSSpecifiedDomains) { + delta.Add("Spec.DNSOptions.PrivateDNSSpecifiedDomains", a.ko.Spec.DNSOptions.PrivateDNSSpecifiedDomains, b.ko.Spec.DNSOptions.PrivateDNSSpecifiedDomains) + } + } } if ackcompare.HasNilDifference(a.ko.Spec.IPAddressType, b.ko.Spec.IPAddressType) { delta.Add("Spec.IPAddressType", a.ko.Spec.IPAddressType, b.ko.Spec.IPAddressType) diff --git a/pkg/resource/vpc_endpoint/sdk.go b/pkg/resource/vpc_endpoint/sdk.go index 94ca20da..0415f106 100644 --- a/pkg/resource/vpc_endpoint/sdk.go +++ b/pkg/resource/vpc_endpoint/sdk.go @@ -117,6 +117,12 @@ func (rm *resourceManager) sdkFind( if elem.DnsOptions.DnsRecordIpType != "" { f2.DNSRecordIPType = aws.String(string(elem.DnsOptions.DnsRecordIpType)) } + if elem.DnsOptions.PrivateDnsPreference != nil { + f2.PrivateDNSPreference = elem.DnsOptions.PrivateDnsPreference + } + if elem.DnsOptions.PrivateDnsSpecifiedDomains != nil { + f2.PrivateDNSSpecifiedDomains = aws.StringSlice(elem.DnsOptions.PrivateDnsSpecifiedDomains) + } ko.Spec.DNSOptions = f2 } else { ko.Spec.DNSOptions = nil @@ -339,6 +345,12 @@ func (rm *resourceManager) sdkCreate( if resp.VpcEndpoint.DnsOptions.DnsRecordIpType != "" { f2.DNSRecordIPType = aws.String(string(resp.VpcEndpoint.DnsOptions.DnsRecordIpType)) } + if resp.VpcEndpoint.DnsOptions.PrivateDnsPreference != nil { + f2.PrivateDNSPreference = resp.VpcEndpoint.DnsOptions.PrivateDnsPreference + } + if resp.VpcEndpoint.DnsOptions.PrivateDnsSpecifiedDomains != nil { + f2.PrivateDNSSpecifiedDomains = aws.StringSlice(resp.VpcEndpoint.DnsOptions.PrivateDnsSpecifiedDomains) + } ko.Spec.DNSOptions = f2 } else { ko.Spec.DNSOptions = nil @@ -485,6 +497,12 @@ func (rm *resourceManager) newCreateRequestPayload( if r.ko.Spec.DNSOptions.DNSRecordIPType != nil { f0.DnsRecordIpType = svcsdktypes.DnsRecordIpType(*r.ko.Spec.DNSOptions.DNSRecordIPType) } + if r.ko.Spec.DNSOptions.PrivateDNSPreference != nil { + f0.PrivateDnsPreference = r.ko.Spec.DNSOptions.PrivateDNSPreference + } + if r.ko.Spec.DNSOptions.PrivateDNSSpecifiedDomains != nil { + f0.PrivateDnsSpecifiedDomains = aws.ToStringSlice(r.ko.Spec.DNSOptions.PrivateDNSSpecifiedDomains) + } res.DnsOptions = f0 } if r.ko.Spec.IPAddressType != nil {