-
Notifications
You must be signed in to change notification settings - Fork 55
Use ServiceID to match VPC Endpoint Service in ReadMany operation #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ack-prow
merged 4 commits into
aws-controllers-k8s:main
from
knottnt:endpoint-service-matching
Jul 25, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
*.swp | ||
*~ | ||
.idea | ||
.vscode | ||
/docs/site | ||
bin | ||
build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
ack_generate_info: | ||
build_date: "2025-07-22T22:13:44Z" | ||
build_hash: b2dc0f44e0b08f041de14c3944a5cc005ba97c8f | ||
build_date: "2025-07-25T17:47:22Z" | ||
build_hash: 21224288556d986791b01b9caf69e2e20e0591ca | ||
go_version: go1.24.5 | ||
version: v0.50.0 | ||
version: v0.50.0-1-g2122428 | ||
api_directory_checksum: d162a6e9df2d4861d6c01d42047402b51f341293 | ||
api_version: v1alpha1 | ||
aws_sdk_go_version: v1.32.6 | ||
generator_config_info: | ||
file_checksum: e6a6ff840d55df735215ac04826122ebf89eb79a | ||
file_checksum: e3c9cd11651288747aece625d6883dfefa718864 | ||
original_file_name: generator.yaml | ||
last_modification: | ||
reason: API generation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
templates/hooks/vpc_endpoint_service_configuration/sdk_read_many_post_build_request.go.tpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if r.ko.Status.ServiceID != nil { | ||
input.ServiceIds = []string{*r.ko.Status.ServiceID} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@72e9d798ad4f22e0e1ff4e227cfd69f7e301479a | ||
acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@e7adf679cc3b78f7bc907fa7c11a13ce0d9c41a7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: ec2.services.k8s.aws/v1alpha1 | ||
kind: VPCEndpointServiceConfiguration | ||
metadata: | ||
name: $VPC_ENDPOINT_SERVICE_ADOPTED_NAME | ||
annotations: | ||
services.k8s.aws/adoption-policy: $ADOPTION_POLICY | ||
services.k8s.aws/adoption-fields: "$ADOPTION_FIELDS" | ||
services.k8s.aws/deletion-policy: retain | ||
spec: {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
test/e2e/tests/test_vpc_endpoint_service_configuration_adoption.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You may | ||
# not use this file except in compliance with the License. A copy of the | ||
# License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0/ | ||
# | ||
# or in the "license" file accompanying this file. This file is distributed | ||
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
# express or implied. See the License for the specific language governing | ||
# permissions and limitations under the License. | ||
|
||
"""Integration tests for the Vpc Endpoint Service Configuraion Adoption. | ||
""" | ||
|
||
# Default to us-west-2 since that's where prow is deployed | ||
import logging | ||
from os import environ | ||
import time | ||
|
||
import pytest | ||
|
||
from e2e import service_marker | ||
from e2e import CRD_GROUP, CRD_VERSION, load_ec2_resource | ||
from e2e.bootstrap_resources import get_bootstrap_resources | ||
from e2e.replacement_values import REPLACEMENT_VALUES | ||
from acktest.resources import random_suffix_name | ||
from acktest.k8s import resource as k8s | ||
from acktest import tags | ||
|
||
from e2e.tests.helper import EC2Validator | ||
|
||
|
||
REGION = "us-west-2" if environ.get('AWS_DEFAULT_REGION') is None else environ.get('AWS_DEFAULT_REGION') | ||
RESOURCE_PLURAL = "vpcendpointserviceconfigurations" | ||
|
||
CREATE_WAIT_AFTER_SECONDS = 10 | ||
DELETE_WAIT_AFTER_SECONDS = 10 | ||
MODIFY_WAIT_AFTER_SECONDS = 5 | ||
|
||
@pytest.fixture | ||
def vpc_endpoint_service_adoption(): | ||
replacements = REPLACEMENT_VALUES.copy() | ||
resource_name = random_suffix_name("vpc-es-adoption", 24) | ||
service_id = get_bootstrap_resources().AdoptedVpcEndpointService.service_id | ||
assert service_id is not None | ||
|
||
replacements["VPC_ENDPOINT_SERVICE_ADOPTED_NAME"] = resource_name | ||
replacements["ADOPTION_POLICY"] = "adopt" | ||
replacements["ADOPTION_FIELDS"] = f"{{\\\"serviceID\\\": \\\"{service_id}\\\"}}" | ||
|
||
resource_data = load_ec2_resource( | ||
"vpc_endpoint_service_adoption", | ||
additional_replacements=replacements, | ||
) | ||
logging.debug(resource_data) | ||
|
||
ref = k8s.CustomResourceReference( | ||
CRD_GROUP, CRD_VERSION, RESOURCE_PLURAL, | ||
resource_name, namespace="default", | ||
) | ||
|
||
k8s.create_custom_resource(ref, resource_data) | ||
time.sleep(CREATE_WAIT_AFTER_SECONDS) | ||
|
||
cr = k8s.wait_resource_consumed_by_controller(ref) | ||
assert cr is not None | ||
assert k8s.get_resource_exists(ref) | ||
|
||
yield (ref, cr) | ||
|
||
_, deleted = k8s.delete_custom_resource(ref, DELETE_WAIT_AFTER_SECONDS) | ||
assert deleted | ||
|
||
@service_marker | ||
@pytest.mark.canary | ||
class TestVpcAdoption: | ||
|
||
def test_vpc_endpoint_service_configuration_adopt_update(self, ec2_client, vpc_endpoint_service_adoption): | ||
(ref, cr) = vpc_endpoint_service_adoption | ||
|
||
time.sleep(CREATE_WAIT_AFTER_SECONDS) | ||
|
||
assert cr is not None | ||
assert 'status' in cr | ||
assert 'serviceID' in cr['status'] | ||
resource_id = cr['status']['serviceID'] | ||
|
||
assert 'spec' in cr | ||
assert 'tags' in cr['spec'] | ||
|
||
# Check VPC Endpoint Service exists in AWS | ||
ec2_validator = EC2Validator(ec2_client) | ||
ec2_validator.assert_vpc_endpoint_service_configuration(resource_id) | ||
|
||
updated_endpoint_service_config = ec2_validator.get_vpc_endpoint_service_configuration(resource_id) | ||
|
||
actual_tags = updated_endpoint_service_config['Tags'] | ||
tags.assert_ack_system_tags(actual_tags) | ||
|
||
name_tag = next((tag for tag in actual_tags if tag['Key'] == 'Name'), None) | ||
assert name_tag is not None | ||
|
||
name_tag = {'key': 'Name', 'value': name_tag['Value']} | ||
new_tag = {'key': 'TestName', 'value': 'test-value'} | ||
updates = { | ||
"spec": {"tags": [name_tag, new_tag]} | ||
} | ||
|
||
k8s.patch_custom_resource(ref, updates) | ||
time.sleep(MODIFY_WAIT_AFTER_SECONDS) | ||
|
||
assert k8s.wait_on_condition(ref, "ACK.ResourceSynced", "True", wait_periods=5) | ||
|
||
updated_endpoint_service_config = ec2_validator.get_vpc_endpoint_service_configuration(resource_id) | ||
assert updated_endpoint_service_config is not None | ||
assert 'Tags' in updated_endpoint_service_config | ||
|
||
expected_tags = [{"Key": name_tag['key'], "Value": name_tag['value']}, {"Key": new_tag['key'], "Value": new_tag['value']}] | ||
tags.assert_equal_without_ack_tags( | ||
actual=updated_endpoint_service_config['Tags'], | ||
expected=expected_tags, | ||
) | ||
|
||
|
||
|
||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.