diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 1135700e..6d6f4b29 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,13 +1,13 @@ ack_generate_info: - build_date: "2024-06-19T08:11:53Z" + build_date: "2024-06-27T13:04:57Z" build_hash: 14cef51778d471698018b6c38b604181a6948248 go_version: go1.22.4 version: v0.34.0 -api_directory_checksum: 7fd395ceb7d5d8e35906991c7348d3498f384741 +api_directory_checksum: 1b53401670898ce50e6d6cc8bfba6b63ea7d5683 api_version: v1alpha1 aws_sdk_go_version: v1.44.93 generator_config_info: - file_checksum: 50dfb186094519e9534c5774690536b3e2474428 + file_checksum: ff3f54d44dba872977fef4f23c5f766a1bebbbc2 original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index ac5e4cc7..82878670 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -524,10 +524,10 @@ resources: references: resource: VPC path: Status.VPCID - IngressRules.UserIDGroupPairs.GroupName: + IngressRules.UserIDGroupPairs.GroupID: references: resource: SecurityGroup - path: Spec.Name + path: Status.ID is_required: false renames: operations: @@ -849,4 +849,4 @@ resources: sdk_read_many_post_set_output: template_path: hooks/vpc_peering_connection/sdk_read_many_post_set_output.go.tpl sdk_file_end: - template_path: hooks/vpc_peering_connection/sdk_file_end.go.tpl \ No newline at end of file + template_path: hooks/vpc_peering_connection/sdk_file_end.go.tpl diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index 558d9fcd..41aefb85 100644 --- a/apis/v1alpha1/types.go +++ b/apis/v1alpha1/types.go @@ -4585,7 +4585,7 @@ type UserIDGroupPair struct { Description *string `json:"description,omitempty"` GroupID *string `json:"groupID,omitempty"` GroupName *string `json:"groupName,omitempty"` - // Reference field for GroupName + // Reference field for GroupID GroupRef *ackv1alpha1.AWSResourceReferenceWrapper `json:"groupRef,omitempty"` PeeringStatus *string `json:"peeringStatus,omitempty"` UserID *string `json:"userID,omitempty"` diff --git a/config/controller/kustomization.yaml b/config/controller/kustomization.yaml index c4cea532..8cd7d9a5 100644 --- a/config/controller/kustomization.yaml +++ b/config/controller/kustomization.yaml @@ -6,4 +6,4 @@ kind: Kustomization images: - name: controller newName: public.ecr.aws/aws-controllers-k8s/ec2-controller - newTag: 1.2.12 \ No newline at end of file + newTag: 1.2.12 diff --git a/config/crd/bases/ec2.services.k8s.aws_securitygroups.yaml b/config/crd/bases/ec2.services.k8s.aws_securitygroups.yaml index 5098e0e2..1a09df99 100644 --- a/config/crd/bases/ec2.services.k8s.aws_securitygroups.yaml +++ b/config/crd/bases/ec2.services.k8s.aws_securitygroups.yaml @@ -121,7 +121,7 @@ spec: groupName: type: string groupRef: - description: Reference field for GroupName + description: Reference field for GroupID properties: from: description: |- @@ -217,7 +217,7 @@ spec: groupName: type: string groupRef: - description: Reference field for GroupName + description: Reference field for GroupID properties: from: description: |- diff --git a/generator.yaml b/generator.yaml index ac5e4cc7..82878670 100644 --- a/generator.yaml +++ b/generator.yaml @@ -524,10 +524,10 @@ resources: references: resource: VPC path: Status.VPCID - IngressRules.UserIDGroupPairs.GroupName: + IngressRules.UserIDGroupPairs.GroupID: references: resource: SecurityGroup - path: Spec.Name + path: Status.ID is_required: false renames: operations: @@ -849,4 +849,4 @@ resources: sdk_read_many_post_set_output: template_path: hooks/vpc_peering_connection/sdk_read_many_post_set_output.go.tpl sdk_file_end: - template_path: hooks/vpc_peering_connection/sdk_file_end.go.tpl \ No newline at end of file + template_path: hooks/vpc_peering_connection/sdk_file_end.go.tpl diff --git a/helm/crds/ec2.services.k8s.aws_securitygroups.yaml b/helm/crds/ec2.services.k8s.aws_securitygroups.yaml index 5098e0e2..1a09df99 100644 --- a/helm/crds/ec2.services.k8s.aws_securitygroups.yaml +++ b/helm/crds/ec2.services.k8s.aws_securitygroups.yaml @@ -121,7 +121,7 @@ spec: groupName: type: string groupRef: - description: Reference field for GroupName + description: Reference field for GroupID properties: from: description: |- @@ -217,7 +217,7 @@ spec: groupName: type: string groupRef: - description: Reference field for GroupName + description: Reference field for GroupID properties: from: description: |- diff --git a/helm/templates/NOTES.txt b/helm/templates/NOTES.txt index 289db84f..0eb63317 100644 --- a/helm/templates/NOTES.txt +++ b/helm/templates/NOTES.txt @@ -1,5 +1,4 @@ {{ .Chart.Name }} has been installed. - This chart deploys "public.ecr.aws/aws-controllers-k8s/ec2-controller:1.2.12". Check its status by running: diff --git a/pkg/resource/security_group/references.go b/pkg/resource/security_group/references.go index 93755a7f..0f1638ee 100644 --- a/pkg/resource/security_group/references.go +++ b/pkg/resource/security_group/references.go @@ -40,7 +40,7 @@ func (rm *resourceManager) ClearResolvedReferences(res acktypes.AWSResource) ack for f0idx, f0iter := range ko.Spec.IngressRules { for f1idx, f1iter := range f0iter.UserIDGroupPairs { if f1iter.GroupRef != nil { - ko.Spec.IngressRules[f0idx].UserIDGroupPairs[f1idx].GroupName = nil + ko.Spec.IngressRules[f0idx].UserIDGroupPairs[f1idx].GroupID = nil } } } @@ -77,7 +77,7 @@ func (rm *resourceManager) ResolveReferences( resourceHasReferences := false err := validateReferenceFields(ko) - if fieldHasReferences, err := rm.resolveReferenceForIngressRules_UserIDGroupPairs_GroupName(ctx, apiReader, namespace, ko); err != nil { + if fieldHasReferences, err := rm.resolveReferenceForIngressRules_UserIDGroupPairs_GroupID(ctx, apiReader, namespace, ko); err != nil { return &resource{ko}, (resourceHasReferences || fieldHasReferences), err } else { resourceHasReferences = resourceHasReferences || fieldHasReferences @@ -104,8 +104,8 @@ func validateReferenceFields(ko *svcapitypes.SecurityGroup) error { for _, f0iter := range ko.Spec.IngressRules { for _, f1iter := range f0iter.UserIDGroupPairs { - if f1iter.GroupRef != nil && f1iter.GroupName != nil { - return ackerr.ResourceReferenceAndIDNotSupportedFor("IngressRules.UserIDGroupPairs.GroupName", "IngressRules.UserIDGroupPairs.GroupRef") + if f1iter.GroupRef != nil && f1iter.GroupID != nil { + return ackerr.ResourceReferenceAndIDNotSupportedFor("IngressRules.UserIDGroupPairs.GroupID", "IngressRules.UserIDGroupPairs.GroupRef") } } } @@ -127,11 +127,11 @@ func validateReferenceFields(ko *svcapitypes.SecurityGroup) error { return nil } -// resolveReferenceForIngressRules_UserIDGroupPairs_GroupName reads the resource referenced -// from IngressRules.UserIDGroupPairs.GroupRef field and sets the IngressRules.UserIDGroupPairs.GroupName +// resolveReferenceForIngressRules_UserIDGroupPairs_GroupID reads the resource referenced +// from IngressRules.UserIDGroupPairs.GroupRef field and sets the IngressRules.UserIDGroupPairs.GroupID // from referenced resource. Returns a boolean indicating whether a reference // contains references, or an error -func (rm *resourceManager) resolveReferenceForIngressRules_UserIDGroupPairs_GroupName( +func (rm *resourceManager) resolveReferenceForIngressRules_UserIDGroupPairs_GroupID( ctx context.Context, apiReader client.Reader, namespace string, @@ -149,7 +149,7 @@ func (rm *resourceManager) resolveReferenceForIngressRules_UserIDGroupPairs_Grou if err := getReferencedResourceState_SecurityGroup(ctx, apiReader, obj, *arr.Name, namespace); err != nil { return hasReferences, err } - ko.Spec.IngressRules[f0idx].UserIDGroupPairs[f1idx].GroupName = (*string)(obj.Spec.Name) + ko.Spec.IngressRules[f0idx].UserIDGroupPairs[f1idx].GroupID = (*string)(obj.Status.ID) } } } @@ -199,11 +199,11 @@ func getReferencedResourceState_SecurityGroup( "SecurityGroup", namespace, name) } - if obj.Spec.Name == nil { + if obj.Status.ID == nil { return ackerr.ResourceReferenceMissingTargetFieldFor( "SecurityGroup", namespace, name, - "Spec.Name") + "Status.ID") } return nil }