Skip to content
Open
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
10 changes: 5 additions & 5 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-05-20T19:59:52Z"
build_hash: 8b46cc24f655c464e4221f893e710865d7ae600a
build_date: "2026-05-28T17:20:29Z"
build_hash: a307e8ebd9503616baf5915c744a30dc3aa227c5
go_version: go1.26.0
version: v0.59.1-1-g8b46cc2
api_directory_checksum: 5a84c7f782ad0708ddc4b430fe0b0883490fbdd4
version: v0.59.1-4-ga307e8e
api_directory_checksum: bef0ebc3452803a924992081183ab7ebebd84f59
api_version: v1alpha1
aws_sdk_go_version: v1.41.1
generator_config_info:
file_checksum: b6d9bc3dc51578dd923daee386c445b3b6dbd620
file_checksum: 06cf2c0cb981d40cd0ad704b28dac931e03f4360
original_file_name: generator.yaml
last_modification:
reason: API generation
11 changes: 9 additions & 2 deletions apis/v1alpha1/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ ignore:
- CreateVpcEndpointServiceConfigurationInput.ClientToken
- CreateVpcEndpointServiceConfigurationInput.DryRun
- CreateVpcEndpointServiceConfigurationInput.TagSpecifications
- CreateVpcEndpointServiceConfigurationInput.SupportedRegions
- CreateVpcEndpointServiceConfigurationOutput.ServiceConfiguration.SupportedRegions
- CreateVpcEndpointServiceConfigurationOutput.ServiceConfiguration.RemoteAccessEnabled
- CreateVpcEndpointServiceConfigurationOutput.ServiceConfiguration.RemoteAccessEnabled
- CreateVpcEndpointServiceConfigurationOutput.ServiceConfiguration.AvailabilityZoneIds
Expand Down Expand Up @@ -1233,6 +1231,13 @@ resources:
from:
operation: ModifyVpcEndpointServicePermissions
path: AddAllowedPrincipals
SupportedRegions:
compare:
is_ignored: true
late_initialize:
skip_incomplete_check: {}
set:
- from: Region
ServiceID:
is_primary_key: true
is_read_only: true
Expand All @@ -1255,6 +1260,8 @@ resources:
match_fields:
- ServiceId
hooks:
delta_pre_compare:
code: customPreCompare(delta, a, b)
sdk_create_post_build_request:
template_path: hooks/vpc_endpoint_service_configuration/sdk_create_post_build_request.go.tpl
sdk_create_post_set_output:
Expand Down
1 change: 1 addition & 0 deletions apis/v1alpha1/types.go

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

2 changes: 2 additions & 0 deletions apis/v1alpha1/vpc_endpoint_service_configuration.go

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

22 changes: 22 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.

Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ spec:
items:
type: string
type: array
supportedRegions:
description: The Regions from which service consumers can access the
service.
items:
type: string
type: array
tags:
description: |-
The tags. The value parameter is required, but if you don't want the tag
Expand Down
11 changes: 9 additions & 2 deletions generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ ignore:
- CreateVpcEndpointServiceConfigurationInput.ClientToken
- CreateVpcEndpointServiceConfigurationInput.DryRun
- CreateVpcEndpointServiceConfigurationInput.TagSpecifications
- CreateVpcEndpointServiceConfigurationInput.SupportedRegions
- CreateVpcEndpointServiceConfigurationOutput.ServiceConfiguration.SupportedRegions
- CreateVpcEndpointServiceConfigurationOutput.ServiceConfiguration.RemoteAccessEnabled
- CreateVpcEndpointServiceConfigurationOutput.ServiceConfiguration.RemoteAccessEnabled
- CreateVpcEndpointServiceConfigurationOutput.ServiceConfiguration.AvailabilityZoneIds
Expand Down Expand Up @@ -1233,6 +1231,13 @@ resources:
from:
operation: ModifyVpcEndpointServicePermissions
path: AddAllowedPrincipals
SupportedRegions:
compare:
is_ignored: true
late_initialize:
skip_incomplete_check: {}
set:
- from: Region
ServiceID:
is_primary_key: true
is_read_only: true
Expand All @@ -1255,6 +1260,8 @@ resources:
match_fields:
- ServiceId
hooks:
delta_pre_compare:
code: customPreCompare(delta, a, b)
sdk_create_post_build_request:
template_path: hooks/vpc_endpoint_service_configuration/sdk_create_post_build_request.go.tpl
sdk_create_post_set_output:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ spec:
items:
type: string
type: array
supportedRegions:
description: The Regions from which service consumers can access the
service.
items:
type: string
type: array
tags:
description: |-
The tags. The value parameter is required, but if you don't want the tag
Expand Down
1 change: 1 addition & 0 deletions pkg/resource/vpc_endpoint_service_configuration/delta.go

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

66 changes: 66 additions & 0 deletions pkg/resource/vpc_endpoint_service_configuration/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"time"

ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare"
ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors"
ackrequeue "github.com/aws-controllers-k8s/runtime/pkg/requeue"
ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log"
Expand Down Expand Up @@ -146,6 +147,71 @@ func (rm *resourceManager) modifyAllowedPrincipals(
return nil
}

func customPreCompare(
delta *ackcompare.Delta,
a *resource,
b *resource,
) {
desiredRegions := a.ko.Spec.SupportedRegions
latestRegions := b.ko.Spec.SupportedRegions

if len(desiredRegions) != len(latestRegions) {
delta.Add("Spec.SupportedRegions", desiredRegions, latestRegions)
return
}

for _, r := range desiredRegions {
if !ackutil.InStringPs(*r, latestRegions) {
delta.Add("Spec.SupportedRegions", desiredRegions, latestRegions)
return
}
}
}

func (rm *resourceManager) syncSupportedRegions(
ctx context.Context,
desired *resource,
latest *resource,
) error {
rlog := ackrtlog.FromContext(ctx)
exit := rlog.Trace("syncSupportedRegions")
var err error
defer func() { exit(err) }()

toAdd := []string{}
toRemove := []string{}

for _, r := range desired.ko.Spec.SupportedRegions {
if !ackutil.InStringPs(*r, latest.ko.Spec.SupportedRegions) {
toAdd = append(toAdd, *r)
}
}

for _, r := range latest.ko.Spec.SupportedRegions {
if !ackutil.InStringPs(*r, desired.ko.Spec.SupportedRegions) {
toRemove = append(toRemove, *r)
}
}

if len(toAdd) == 0 && len(toRemove) == 0 {
return nil
}

input := &svcsdk.ModifyVpcEndpointServiceConfigurationInput{
ServiceId: latest.ko.Status.ServiceID,
}
if len(toAdd) > 0 {
input.AddSupportedRegions = toAdd
}
if len(toRemove) > 0 {
input.RemoveSupportedRegions = toRemove
}

_, err = rm.sdkapi.ModifyVpcEndpointServiceConfiguration(ctx, input)
rm.metrics.RecordAPICall("UPDATE", "ModifyVpcEndpointServiceConfiguration", err)
return err
}

// Sets additional fields (not covered by CREATE Op) on the resource's object
func (rm *resourceManager) setAdditionalFields(
ctx context.Context,
Expand Down
9 changes: 7 additions & 2 deletions pkg/resource/vpc_endpoint_service_configuration/manager.go

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

74 changes: 54 additions & 20 deletions pkg/resource/vpc_endpoint_service_configuration/sdk.go

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

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

// This causes a requeue and the rest of the fields will be synced on the next reconciliation loop
return &resource{ko}, ackrequeue.Needed(errors.New("reconcile update only fields."))
ackcondition.SetSynced(&resource{ko}, corev1.ConditionFalse, aws.String("Reconciling to sync additional fields"), nil)
Loading