-
Notifications
You must be signed in to change notification settings - Fork 25
feat: add registry-level ReplicationConfiguration CRD #121
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
base: main
Are you sure you want to change the base?
feat: add registry-level ReplicationConfiguration CRD #121
Conversation
|
Hi @liskl. Thanks for your PR. I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@jlbutler any chance i can get a |
|
/ok-to-test |
|
Hi @liskl , Thank you for this! Can you run the code-generator again? I dont see the metadata file updated. |
i'm working on it now :) |
57d1ab9 to
918ee1c
Compare
…uration CRD - Updated controller-gen version from v0.16.2 to v0.18.0 in existing CRDs. - Added new CustomResourceDefinition for ReplicationConfiguration. - Updated Helm templates to include replication configurations in RBAC rules. - Enhanced deployment template to support additional labels. - Implemented resource management for ReplicationConfiguration, including CRUD operations. - Added integration tests for ReplicationConfiguration creation, update, and deletion.
- Updated controller-gen version in existing CRDs for ECR services. - Added new CRD for ReplicationConfiguration with detailed schema. - Updated existing CRDs for repositories and adopted resources to use the new controller-gen version. - Enhanced Helm templates to include replication configurations in RBAC rules. - Modified deployment template to allow additional labels from values. - Implemented resource management for ReplicationConfiguration, including CRUD operations. - Added integration tests for ReplicationConfiguration to validate creation, update, and deletion. - Introduced hooks for SDK read operations to handle replication configuration data.
…om/liskl/ecr-controller into feat/add-replication-configuration
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: liskl The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
1 similar comment
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: liskl The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
- Use ReplicationConfigurationForRegistry type in manager.go line 85 - Resolves unit test compilation error
- Add region field with description to config/crd/bases CRD - Add region field with description to helm/crds CRD - Ensures e2e tests can properly specify destination regions
- Add blank import for pkg/resource/replication_configuration in main.go - This triggers init() function to register the resource manager factory - Resolves 'no worker' issue causing e2e test timeouts - Controller will now process ReplicationConfiguration resources
- Add missing Region field to ReplicationDestination type - Fix Create method to properly convert K8s spec to AWS SDK types instead of sending empty rules - Fix ReadOne method to properly populate ReplicationConfiguration from AWS response - Resolves resource adoption errors where controller was sending empty rules to AWS
- Add setup_method and teardown_method to clear registry replication config before/after each test - Add explicit test ordering with pytest.mark.order to ensure sequential execution - Add registry cleanup to avoid conflicts between tests - This should resolve adoption errors caused by tests interfering with each other
- Change registryID to registryId in API types to match YAML templates - Update CRD schema to use consistent registryId field names - Fix test template to use consistent registryId casing - This resolves unmarshaling issues causing empty rules in AWS - Should fix all ReplicationConfiguration test failures
- Revert ReplicationConfiguration to use registryID (uppercase D) for consistency with Repository and PullThroughCacheRule resources - Update CRD schema, API types, and test templates to use registryID - Keep AWS API response checks as registryId (lowercase) since that's what AWS returns - This maintains consistency across the codebase while matching established patterns - Should resolve the original JSON unmarshaling issue
- Add debug logs to track resource processing in Create method - Log spec contents, rules count, and AWS API call details - This will help identify where the rules are being lost in the process - Temporary commit for debugging the test failures
…S state - Added debug logs to show current AWS replication config before modification - Log detailed rule counts and structure for both current and desired state - Track AWS state immediately after PutReplicationConfiguration API call - Added ReadOne debug logs to see what gets returned to tests - This will help identify if rules are being created correctly or lost somewhere in the process - Temporary debug commit to diagnose test failures
- Add missing ackerr import in manager.go - Use ackerr.NotFound instead of undefined ackrt.NotFound - Modify ReadOne to return NotFound for empty configs to trigger Create - This prevents terminal adoption errors for singleton AWS resources
- Create delta.go with proper newResourceDelta function - Fix descriptor.go to use newResourceDelta instead of returning nil - Use reflect.DeepEqual for comparing ReplicationRule slices - Prevents nil pointer dereference panic during resource reconciliation
…ests - Add comprehensive debug logging for region selection - Add safety checks to ensure destination region is never same as source - Handle environment variable overrides with validation - Add explicit assertions in all test methods to catch region conflicts - Improve error handling for invalid region combinations
- Replace if/else logic with region_alternatives dictionary mapping - Ensure update test never selects us-west-2 when running in us-west-2 - Use consistent region selection patterns across all test methods - Add fallback logic for edge cases where regions might conflict - Improve maintainability and readability of region selection logic
…configuration tests
… state verification
…ations before tests
- Add pytest-dependency to test requirements - Use @pytest.mark.dependency decorators to enforce test execution order - Remove singleton resource pattern that caused race conditions - Implement shared resource management across dependency chain - Add proper cleanup at start and end of test sequence - Ensures only one test can manage registry-level replication config at a time
- test_multiple_replication_rules now runs after update but before delete - This is the logical order: create -> update -> multiple_rules -> delete - multiple_rules is essentially another update/create test that should run before cleanup - delete test now only handles final AWS cleanup without resource management
|
those didn't pass they got skipped, weird |
- Fixes issue where dependency tests were being skipped in parallel execution - pytest-xdist runs tests in parallel across workers - scope='session' ensures dependencies are tracked across all workers - This should allow dependent tests to run instead of being skipped
…cycle test - Remove pytest-dependency completely - it doesn't work with parallel execution - Combine create/update/multiple-rules/delete into one comprehensive test - This avoids parallel execution issues since it's a single test method - Tests complete lifecycle: create → update → multiple rules → cleanup - Eliminates dependency conflicts and resource sharing issues between parallel workers - Much simpler and more reliable approach for singleton AWS resources
This commit fixes the critical bug where ReplicationConfiguration resources would enter a terminal condition during updates with the error "resource already exists but is not managed by ACK". Controller Changes: - Fix ReadOne logic to always return proper resource objects instead of NotFound when AWS has empty replication rules - Implement proper IsSynced comparison using delta logic instead of always returning false - Remove unused import Test Changes: - Revert to PATCH-based updates now that controller bug is fixed - Remove delete+recreate workaround that was masking the real issue - Maintain proper resource sync validation The root cause was in ReadOne() treating empty AWS replication configurations as "non-existent" which caused ACK runtime to incorrectly assume the resource was not managed during update reconciliation. Fixes the update failure where test expected region change from us-east-2 to us-east-1 but controller went into terminal condition instead of processing the update.
|
@liskl: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Summary
This PR introduces a new standalone
ReplicationConfigurationCRD for managing ECR registry-level replication settings, replacing the problematic repository-level approach that caused tests to fail.Changes Made
New API Resource (
apis/v1alpha1/)ReplicationConfigurationCRD as standalone resource (not embedded in Repository)ReplicationRulestruct withDestinationsandRepositoryFiltersRepositoryFilterstruct withFilterandFilterTypefieldsReplicationDestinationto include bothRegionandRegistryIDfieldsGenerator Configuration
ReplicationConfigurationresource definition ingenerator.yamlDescribeRegistry(read),PutReplicationConfiguration(create/update/delete)Implementation (
pkg/resource/replication_configuration/)Repository Cleanup
updateReplicationConfiguration(),deleteReplicationConfiguration(), etc.Tests
ReplicationConfigurationresource:Architecture Change
Before (❌ Problematic):
After (✅ Correct):
Usage Example
Key Implementation Notes
PutReplicationConfigurationAPITesting
API Reference