diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 8d1d4144..c40c7806 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,13 +1,13 @@ ack_generate_info: - build_date: "2023-12-12T12:34:35Z" - build_hash: 3653329ceeb20015851b8776a6061a3fb0ec2935 - go_version: go1.21.0 - version: "3653329" + build_date: "2023-12-21T23:08:47Z" + build_hash: 1f16813c807af6889060b4ce7ded2a69dc027d8c + go_version: go1.21.5 + version: v0.28.0 api_directory_checksum: d452bf19bfd1496aacdc215bf7cc9ea86c55c122 api_version: v1alpha1 aws_sdk_go_version: v1.44.93 generator_config_info: - file_checksum: df1057de840147701c11acfdbed0e28e9b0ddd96 + file_checksum: 0ea278e11a33d237e88a1bcdca878656a8ba43f9 original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index ed593f14..33a11ba6 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -62,6 +62,8 @@ ignore: - CarrierGateway - ClientVpnEndpoint - ClientVpnRoute + - CoipCidr + - CoipPool - CustomerGateway - DefaultSubnet - DefaultVpc @@ -71,16 +73,20 @@ ignore: - FpgaImage - Image #- Instance + - InstanceConnectEndpoint - InstanceEventWindow - InstanceExportTask #- InternetGateway - Ipam - IpamPool + - IpamResourceDiscovery - IpamScope - KeyPair - LaunchTemplateVersion - LaunchTemplate + - LocalGatewayRouteTable - LocalGatewayRouteTableVpcAssociation + - LocalGatewayRouteTableVirtualInterfaceGroupAssociation - LocalGatewayRoute - ManagedPrefixList #- NatGateway @@ -118,6 +124,10 @@ ignore: - TransitGatewayRouteTableAnnouncement - TransitGatewayVpcAttachment #- TransitGateway + - VerifiedAccessEndpoint + - VerifiedAccessGroup + - VerifiedAccessInstance + - VerifiedAccessTrustProvider - Volume - VpcEndpointConnectionNotification - VpcEndpointServiceConfiguration diff --git a/config/controller/kustomization.yaml b/config/controller/kustomization.yaml index 5beaa8ed..4c34088f 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.1.1 + newTag: 1.1.2 diff --git a/go.mod b/go.mod index 85fc2161..cceab5c6 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/aws-controllers-k8s/ec2-controller go 1.19 require ( - github.com/aws-controllers-k8s/runtime v0.27.1 - github.com/aws/aws-sdk-go v1.44.93 + github.com/aws-controllers-k8s/runtime v0.28.0 + github.com/aws/aws-sdk-go v1.49.0 github.com/go-logr/logr v1.2.3 github.com/samber/lo v1.37.0 github.com/spf13/pflag v1.0.5 @@ -54,11 +54,11 @@ require ( go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect - golang.org/x/net v0.8.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/term v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 3ddbea24..bfdd4da2 100644 --- a/go.sum +++ b/go.sum @@ -38,10 +38,10 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/aws-controllers-k8s/runtime v0.27.1 h1:tvJRQDioBFkob0kF4DwgS7MsoXZKwkG5QCHWxFEh+2o= -github.com/aws-controllers-k8s/runtime v0.27.1/go.mod h1:oSCqCzbzJLUrzv+cx4TIxCuSUvL75ABJmhxBc87IRqc= -github.com/aws/aws-sdk-go v1.44.93 h1:hAgd9fuaptBatSft27/5eBMdcA8+cIMqo96/tZ6rKl8= -github.com/aws/aws-sdk-go v1.44.93/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws-controllers-k8s/runtime v0.28.0 h1:QhtZDwF4TId5rBW924FMMKWFb0PGTtclVj+Cyj3bRaI= +github.com/aws-controllers-k8s/runtime v0.28.0/go.mod h1:OYbm782YcAQDN1M5k3lttI16FcLoiRqrIQL0DvU3+Lg= +github.com/aws/aws-sdk-go v1.49.0 h1:g9BkW1fo9GqKfwg2+zCD+TW/D36Ux+vtfJ8guF4AYmY= +github.com/aws/aws-sdk-go v1.49.0/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -369,8 +369,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -431,12 +431,12 @@ golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -444,8 +444,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/helm/Chart.yaml b/helm/Chart.yaml index f7993f1b..f46786e3 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v1 name: ec2-chart description: A Helm chart for the ACK service controller for Amazon Elastic Cloud Compute (EC2) -version: 1.1.1 -appVersion: 1.1.1 +version: 1.1.2 +appVersion: 1.1.2 home: https://github.com/aws-controllers-k8s/ec2-controller icon: https://raw.githubusercontent.com/aws/eks-charts/master/docs/logo/aws.png sources: diff --git a/helm/templates/NOTES.txt b/helm/templates/NOTES.txt index 03acb649..f9747cc6 100644 --- a/helm/templates/NOTES.txt +++ b/helm/templates/NOTES.txt @@ -1,5 +1,5 @@ {{ .Chart.Name }} has been installed. -This chart deploys "public.ecr.aws/aws-controllers-k8s/ec2-controller:1.1.1". +This chart deploys "public.ecr.aws/aws-controllers-k8s/ec2-controller:1.1.2". Check its status by running: kubectl --namespace {{ .Release.Namespace }} get pods -l "app.kubernetes.io/instance={{ .Release.Name }}" diff --git a/helm/values.yaml b/helm/values.yaml index 9b9422f9..bd2020a8 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -4,7 +4,7 @@ image: repository: public.ecr.aws/aws-controllers-k8s/ec2-controller - tag: 1.1.1 + tag: 1.1.2 pullPolicy: IfNotPresent pullSecrets: [] diff --git a/pkg/resource/dhcp_options/delta.go b/pkg/resource/dhcp_options/delta.go index 5bdf7bfd..da9ff168 100644 --- a/pkg/resource/dhcp_options/delta.go +++ b/pkg/resource/dhcp_options/delta.go @@ -44,11 +44,19 @@ func newResourceDelta( } compareTags(delta, a, b) - if !reflect.DeepEqual(a.ko.Spec.DHCPConfigurations, b.ko.Spec.DHCPConfigurations) { + if len(a.ko.Spec.DHCPConfigurations) != len(b.ko.Spec.DHCPConfigurations) { delta.Add("Spec.DHCPConfigurations", a.ko.Spec.DHCPConfigurations, b.ko.Spec.DHCPConfigurations) + } else if len(a.ko.Spec.DHCPConfigurations) > 0 { + if !reflect.DeepEqual(a.ko.Spec.DHCPConfigurations, b.ko.Spec.DHCPConfigurations) { + delta.Add("Spec.DHCPConfigurations", a.ko.Spec.DHCPConfigurations, b.ko.Spec.DHCPConfigurations) + } } - if !ackcompare.SliceStringPEqual(a.ko.Spec.VPC, b.ko.Spec.VPC) { + if len(a.ko.Spec.VPC) != len(b.ko.Spec.VPC) { delta.Add("Spec.VPC", a.ko.Spec.VPC, b.ko.Spec.VPC) + } else if len(a.ko.Spec.VPC) > 0 { + if !ackcompare.SliceStringPEqual(a.ko.Spec.VPC, b.ko.Spec.VPC) { + delta.Add("Spec.VPC", a.ko.Spec.VPC, b.ko.Spec.VPC) + } } if !reflect.DeepEqual(a.ko.Spec.VPCRefs, b.ko.Spec.VPCRefs) { delta.Add("Spec.VPCRefs", a.ko.Spec.VPCRefs, b.ko.Spec.VPCRefs) diff --git a/pkg/resource/flow_log/resource.go b/pkg/resource/flow_log/resource.go index 90f75661..cfdb0633 100644 --- a/pkg/resource/flow_log/resource.go +++ b/pkg/resource/flow_log/resource.go @@ -97,6 +97,7 @@ func (r *resource) SetIdentifiers(identifier *ackv1alpha1.AWSIdentifiers) error if resourceType, ok := identifier.AdditionalKeys["resourceType"]; ok { r.ko.Spec.ResourceType = &resourceType } + return nil } diff --git a/pkg/resource/instance/delta.go b/pkg/resource/instance/delta.go index e7a5a55e..a04d14c4 100644 --- a/pkg/resource/instance/delta.go +++ b/pkg/resource/instance/delta.go @@ -44,8 +44,12 @@ func newResourceDelta( } compareTags(delta, a, b) - if !reflect.DeepEqual(a.ko.Spec.BlockDeviceMappings, b.ko.Spec.BlockDeviceMappings) { + if len(a.ko.Spec.BlockDeviceMappings) != len(b.ko.Spec.BlockDeviceMappings) { delta.Add("Spec.BlockDeviceMappings", a.ko.Spec.BlockDeviceMappings, b.ko.Spec.BlockDeviceMappings) + } else if len(a.ko.Spec.BlockDeviceMappings) > 0 { + if !reflect.DeepEqual(a.ko.Spec.BlockDeviceMappings, b.ko.Spec.BlockDeviceMappings) { + delta.Add("Spec.BlockDeviceMappings", a.ko.Spec.BlockDeviceMappings, b.ko.Spec.BlockDeviceMappings) + } } if ackcompare.HasNilDifference(a.ko.Spec.CapacityReservationSpecification, b.ko.Spec.CapacityReservationSpecification) { delta.Add("Spec.CapacityReservationSpecification", a.ko.Spec.CapacityReservationSpecification, b.ko.Spec.CapacityReservationSpecification) @@ -126,11 +130,19 @@ func newResourceDelta( delta.Add("Spec.EBSOptimized", a.ko.Spec.EBSOptimized, b.ko.Spec.EBSOptimized) } } - if !reflect.DeepEqual(a.ko.Spec.ElasticGPUSpecification, b.ko.Spec.ElasticGPUSpecification) { + if len(a.ko.Spec.ElasticGPUSpecification) != len(b.ko.Spec.ElasticGPUSpecification) { delta.Add("Spec.ElasticGPUSpecification", a.ko.Spec.ElasticGPUSpecification, b.ko.Spec.ElasticGPUSpecification) + } else if len(a.ko.Spec.ElasticGPUSpecification) > 0 { + if !reflect.DeepEqual(a.ko.Spec.ElasticGPUSpecification, b.ko.Spec.ElasticGPUSpecification) { + delta.Add("Spec.ElasticGPUSpecification", a.ko.Spec.ElasticGPUSpecification, b.ko.Spec.ElasticGPUSpecification) + } } - if !reflect.DeepEqual(a.ko.Spec.ElasticInferenceAccelerators, b.ko.Spec.ElasticInferenceAccelerators) { + if len(a.ko.Spec.ElasticInferenceAccelerators) != len(b.ko.Spec.ElasticInferenceAccelerators) { delta.Add("Spec.ElasticInferenceAccelerators", a.ko.Spec.ElasticInferenceAccelerators, b.ko.Spec.ElasticInferenceAccelerators) + } else if len(a.ko.Spec.ElasticInferenceAccelerators) > 0 { + if !reflect.DeepEqual(a.ko.Spec.ElasticInferenceAccelerators, b.ko.Spec.ElasticInferenceAccelerators) { + delta.Add("Spec.ElasticInferenceAccelerators", a.ko.Spec.ElasticInferenceAccelerators, b.ko.Spec.ElasticInferenceAccelerators) + } } if ackcompare.HasNilDifference(a.ko.Spec.EnclaveOptions, b.ko.Spec.EnclaveOptions) { delta.Add("Spec.EnclaveOptions", a.ko.Spec.EnclaveOptions, b.ko.Spec.EnclaveOptions) @@ -250,8 +262,12 @@ func newResourceDelta( delta.Add("Spec.IPv6AddressCount", a.ko.Spec.IPv6AddressCount, b.ko.Spec.IPv6AddressCount) } } - if !reflect.DeepEqual(a.ko.Spec.IPv6Addresses, b.ko.Spec.IPv6Addresses) { + if len(a.ko.Spec.IPv6Addresses) != len(b.ko.Spec.IPv6Addresses) { delta.Add("Spec.IPv6Addresses", a.ko.Spec.IPv6Addresses, b.ko.Spec.IPv6Addresses) + } else if len(a.ko.Spec.IPv6Addresses) > 0 { + if !reflect.DeepEqual(a.ko.Spec.IPv6Addresses, b.ko.Spec.IPv6Addresses) { + delta.Add("Spec.IPv6Addresses", a.ko.Spec.IPv6Addresses, b.ko.Spec.IPv6Addresses) + } } if ackcompare.HasNilDifference(a.ko.Spec.KernelID, b.ko.Spec.KernelID) { delta.Add("Spec.KernelID", a.ko.Spec.KernelID, b.ko.Spec.KernelID) @@ -292,8 +308,12 @@ func newResourceDelta( } } } - if !reflect.DeepEqual(a.ko.Spec.LicenseSpecifications, b.ko.Spec.LicenseSpecifications) { + if len(a.ko.Spec.LicenseSpecifications) != len(b.ko.Spec.LicenseSpecifications) { delta.Add("Spec.LicenseSpecifications", a.ko.Spec.LicenseSpecifications, b.ko.Spec.LicenseSpecifications) + } else if len(a.ko.Spec.LicenseSpecifications) > 0 { + if !reflect.DeepEqual(a.ko.Spec.LicenseSpecifications, b.ko.Spec.LicenseSpecifications) { + delta.Add("Spec.LicenseSpecifications", a.ko.Spec.LicenseSpecifications, b.ko.Spec.LicenseSpecifications) + } } if ackcompare.HasNilDifference(a.ko.Spec.MaintenanceOptions, b.ko.Spec.MaintenanceOptions) { delta.Add("Spec.MaintenanceOptions", a.ko.Spec.MaintenanceOptions, b.ko.Spec.MaintenanceOptions) @@ -370,8 +390,12 @@ func newResourceDelta( } } } - if !reflect.DeepEqual(a.ko.Spec.NetworkInterfaces, b.ko.Spec.NetworkInterfaces) { + if len(a.ko.Spec.NetworkInterfaces) != len(b.ko.Spec.NetworkInterfaces) { delta.Add("Spec.NetworkInterfaces", a.ko.Spec.NetworkInterfaces, b.ko.Spec.NetworkInterfaces) + } else if len(a.ko.Spec.NetworkInterfaces) > 0 { + if !reflect.DeepEqual(a.ko.Spec.NetworkInterfaces, b.ko.Spec.NetworkInterfaces) { + delta.Add("Spec.NetworkInterfaces", a.ko.Spec.NetworkInterfaces, b.ko.Spec.NetworkInterfaces) + } } if ackcompare.HasNilDifference(a.ko.Spec.Placement, b.ko.Spec.Placement) { delta.Add("Spec.Placement", a.ko.Spec.Placement, b.ko.Spec.Placement) @@ -472,11 +496,19 @@ func newResourceDelta( delta.Add("Spec.RAMDiskID", a.ko.Spec.RAMDiskID, b.ko.Spec.RAMDiskID) } } - if !ackcompare.SliceStringPEqual(a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs) { + if len(a.ko.Spec.SecurityGroupIDs) != len(b.ko.Spec.SecurityGroupIDs) { delta.Add("Spec.SecurityGroupIDs", a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs) + } else if len(a.ko.Spec.SecurityGroupIDs) > 0 { + if !ackcompare.SliceStringPEqual(a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs) { + delta.Add("Spec.SecurityGroupIDs", a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs) + } } - if !ackcompare.SliceStringPEqual(a.ko.Spec.SecurityGroups, b.ko.Spec.SecurityGroups) { + if len(a.ko.Spec.SecurityGroups) != len(b.ko.Spec.SecurityGroups) { delta.Add("Spec.SecurityGroups", a.ko.Spec.SecurityGroups, b.ko.Spec.SecurityGroups) + } else if len(a.ko.Spec.SecurityGroups) > 0 { + if !ackcompare.SliceStringPEqual(a.ko.Spec.SecurityGroups, b.ko.Spec.SecurityGroups) { + delta.Add("Spec.SecurityGroups", a.ko.Spec.SecurityGroups, b.ko.Spec.SecurityGroups) + } } if ackcompare.HasNilDifference(a.ko.Spec.SubnetID, b.ko.Spec.SubnetID) { delta.Add("Spec.SubnetID", a.ko.Spec.SubnetID, b.ko.Spec.SubnetID) diff --git a/pkg/resource/internet_gateway/delta.go b/pkg/resource/internet_gateway/delta.go index 278dfa13..bee3da23 100644 --- a/pkg/resource/internet_gateway/delta.go +++ b/pkg/resource/internet_gateway/delta.go @@ -47,8 +47,12 @@ func newResourceDelta( if !reflect.DeepEqual(a.ko.Spec.RouteTableRefs, b.ko.Spec.RouteTableRefs) { delta.Add("Spec.RouteTableRefs", a.ko.Spec.RouteTableRefs, b.ko.Spec.RouteTableRefs) } - if !ackcompare.SliceStringPEqual(a.ko.Spec.RouteTables, b.ko.Spec.RouteTables) { + if len(a.ko.Spec.RouteTables) != len(b.ko.Spec.RouteTables) { delta.Add("Spec.RouteTables", a.ko.Spec.RouteTables, b.ko.Spec.RouteTables) + } else if len(a.ko.Spec.RouteTables) > 0 { + if !ackcompare.SliceStringPEqual(a.ko.Spec.RouteTables, b.ko.Spec.RouteTables) { + delta.Add("Spec.RouteTables", a.ko.Spec.RouteTables, b.ko.Spec.RouteTables) + } } if ackcompare.HasNilDifference(a.ko.Spec.VPC, b.ko.Spec.VPC) { delta.Add("Spec.VPC", a.ko.Spec.VPC, b.ko.Spec.VPC) diff --git a/pkg/resource/network_acl/delta.go b/pkg/resource/network_acl/delta.go index 41953057..0b9e3498 100644 --- a/pkg/resource/network_acl/delta.go +++ b/pkg/resource/network_acl/delta.go @@ -44,11 +44,19 @@ func newResourceDelta( } compareTags(delta, a, b) - if !reflect.DeepEqual(a.ko.Spec.Associations, b.ko.Spec.Associations) { + if len(a.ko.Spec.Associations) != len(b.ko.Spec.Associations) { delta.Add("Spec.Associations", a.ko.Spec.Associations, b.ko.Spec.Associations) + } else if len(a.ko.Spec.Associations) > 0 { + if !reflect.DeepEqual(a.ko.Spec.Associations, b.ko.Spec.Associations) { + delta.Add("Spec.Associations", a.ko.Spec.Associations, b.ko.Spec.Associations) + } } - if !reflect.DeepEqual(a.ko.Spec.Entries, b.ko.Spec.Entries) { + if len(a.ko.Spec.Entries) != len(b.ko.Spec.Entries) { delta.Add("Spec.Entries", a.ko.Spec.Entries, b.ko.Spec.Entries) + } else if len(a.ko.Spec.Entries) > 0 { + if !reflect.DeepEqual(a.ko.Spec.Entries, b.ko.Spec.Entries) { + delta.Add("Spec.Entries", a.ko.Spec.Entries, b.ko.Spec.Entries) + } } if ackcompare.HasNilDifference(a.ko.Spec.VPCID, b.ko.Spec.VPCID) { delta.Add("Spec.VPCID", a.ko.Spec.VPCID, b.ko.Spec.VPCID) diff --git a/pkg/resource/route_table/delta.go b/pkg/resource/route_table/delta.go index 0f4d3d56..e19926ba 100644 --- a/pkg/resource/route_table/delta.go +++ b/pkg/resource/route_table/delta.go @@ -44,8 +44,12 @@ func newResourceDelta( } customPreCompare(delta, a, b) - if !reflect.DeepEqual(a.ko.Spec.Routes, b.ko.Spec.Routes) { + if len(a.ko.Spec.Routes) != len(b.ko.Spec.Routes) { delta.Add("Spec.Routes", a.ko.Spec.Routes, b.ko.Spec.Routes) + } else if len(a.ko.Spec.Routes) > 0 { + if !reflect.DeepEqual(a.ko.Spec.Routes, b.ko.Spec.Routes) { + delta.Add("Spec.Routes", a.ko.Spec.Routes, b.ko.Spec.Routes) + } } if ackcompare.HasNilDifference(a.ko.Spec.VPCID, b.ko.Spec.VPCID) { delta.Add("Spec.VPCID", a.ko.Spec.VPCID, b.ko.Spec.VPCID) diff --git a/pkg/resource/security_group/delta.go b/pkg/resource/security_group/delta.go index ae6b3883..fc12fa3c 100644 --- a/pkg/resource/security_group/delta.go +++ b/pkg/resource/security_group/delta.go @@ -51,11 +51,19 @@ func newResourceDelta( delta.Add("Spec.Description", a.ko.Spec.Description, b.ko.Spec.Description) } } - if !reflect.DeepEqual(a.ko.Spec.EgressRules, b.ko.Spec.EgressRules) { + if len(a.ko.Spec.EgressRules) != len(b.ko.Spec.EgressRules) { delta.Add("Spec.EgressRules", a.ko.Spec.EgressRules, b.ko.Spec.EgressRules) + } else if len(a.ko.Spec.EgressRules) > 0 { + if !reflect.DeepEqual(a.ko.Spec.EgressRules, b.ko.Spec.EgressRules) { + delta.Add("Spec.EgressRules", a.ko.Spec.EgressRules, b.ko.Spec.EgressRules) + } } - if !reflect.DeepEqual(a.ko.Spec.IngressRules, b.ko.Spec.IngressRules) { + if len(a.ko.Spec.IngressRules) != len(b.ko.Spec.IngressRules) { delta.Add("Spec.IngressRules", a.ko.Spec.IngressRules, b.ko.Spec.IngressRules) + } else if len(a.ko.Spec.IngressRules) > 0 { + if !reflect.DeepEqual(a.ko.Spec.IngressRules, b.ko.Spec.IngressRules) { + delta.Add("Spec.IngressRules", a.ko.Spec.IngressRules, b.ko.Spec.IngressRules) + } } if ackcompare.HasNilDifference(a.ko.Spec.Name, b.ko.Spec.Name) { delta.Add("Spec.Name", a.ko.Spec.Name, b.ko.Spec.Name) diff --git a/pkg/resource/security_group/sdk.go b/pkg/resource/security_group/sdk.go index 9a33fa41..bd8b10c3 100644 --- a/pkg/resource/security_group/sdk.go +++ b/pkg/resource/security_group/sdk.go @@ -429,14 +429,26 @@ func compareIPPermission( delta.Add("IPPermission.IPProtocol", a.IPProtocol, b.IPProtocol) } } - if !reflect.DeepEqual(a.IPRanges, b.IPRanges) { + if len(a.IPRanges) != len(b.IPRanges) { delta.Add("IPPermission.IPRanges", a.IPRanges, b.IPRanges) + } else if len(a.IPRanges) > 0 { + if !reflect.DeepEqual(a.IPRanges, b.IPRanges) { + delta.Add("IPPermission.IPRanges", a.IPRanges, b.IPRanges) + } } - if !reflect.DeepEqual(a.IPv6Ranges, b.IPv6Ranges) { + if len(a.IPv6Ranges) != len(b.IPv6Ranges) { delta.Add("IPPermission.IPv6Ranges", a.IPv6Ranges, b.IPv6Ranges) + } else if len(a.IPv6Ranges) > 0 { + if !reflect.DeepEqual(a.IPv6Ranges, b.IPv6Ranges) { + delta.Add("IPPermission.IPv6Ranges", a.IPv6Ranges, b.IPv6Ranges) + } } - if !reflect.DeepEqual(a.PrefixListIDs, b.PrefixListIDs) { + if len(a.PrefixListIDs) != len(b.PrefixListIDs) { delta.Add("IPPermission.PrefixListIDs", a.PrefixListIDs, b.PrefixListIDs) + } else if len(a.PrefixListIDs) > 0 { + if !reflect.DeepEqual(a.PrefixListIDs, b.PrefixListIDs) { + delta.Add("IPPermission.PrefixListIDs", a.PrefixListIDs, b.PrefixListIDs) + } } if ackcompare.HasNilDifference(a.ToPort, b.ToPort) { delta.Add("IPPermission.ToPort", a.ToPort, b.ToPort) @@ -445,8 +457,12 @@ func compareIPPermission( delta.Add("IPPermission.ToPort", a.ToPort, b.ToPort) } } - if !reflect.DeepEqual(a.UserIDGroupPairs, b.UserIDGroupPairs) { + if len(a.UserIDGroupPairs) != len(b.UserIDGroupPairs) { delta.Add("IPPermission.UserIDGroupPairs", a.UserIDGroupPairs, b.UserIDGroupPairs) + } else if len(a.UserIDGroupPairs) > 0 { + if !reflect.DeepEqual(a.UserIDGroupPairs, b.UserIDGroupPairs) { + delta.Add("IPPermission.UserIDGroupPairs", a.UserIDGroupPairs, b.UserIDGroupPairs) + } } return delta diff --git a/pkg/resource/subnet/delta.go b/pkg/resource/subnet/delta.go index 3e053553..1551f726 100644 --- a/pkg/resource/subnet/delta.go +++ b/pkg/resource/subnet/delta.go @@ -138,8 +138,12 @@ func newResourceDelta( if !reflect.DeepEqual(a.ko.Spec.RouteTableRefs, b.ko.Spec.RouteTableRefs) { delta.Add("Spec.RouteTableRefs", a.ko.Spec.RouteTableRefs, b.ko.Spec.RouteTableRefs) } - if !ackcompare.SliceStringPEqual(a.ko.Spec.RouteTables, b.ko.Spec.RouteTables) { + if len(a.ko.Spec.RouteTables) != len(b.ko.Spec.RouteTables) { delta.Add("Spec.RouteTables", a.ko.Spec.RouteTables, b.ko.Spec.RouteTables) + } else if len(a.ko.Spec.RouteTables) > 0 { + if !ackcompare.SliceStringPEqual(a.ko.Spec.RouteTables, b.ko.Spec.RouteTables) { + delta.Add("Spec.RouteTables", a.ko.Spec.RouteTables, b.ko.Spec.RouteTables) + } } if ackcompare.HasNilDifference(a.ko.Spec.VPCID, b.ko.Spec.VPCID) { delta.Add("Spec.VPCID", a.ko.Spec.VPCID, b.ko.Spec.VPCID) diff --git a/pkg/resource/transit_gateway/delta.go b/pkg/resource/transit_gateway/delta.go index 9df34e41..edd415a3 100644 --- a/pkg/resource/transit_gateway/delta.go +++ b/pkg/resource/transit_gateway/delta.go @@ -96,8 +96,12 @@ func newResourceDelta( delta.Add("Spec.Options.MulticastSupport", a.ko.Spec.Options.MulticastSupport, b.ko.Spec.Options.MulticastSupport) } } - if !ackcompare.SliceStringPEqual(a.ko.Spec.Options.TransitGatewayCIDRBlocks, b.ko.Spec.Options.TransitGatewayCIDRBlocks) { + if len(a.ko.Spec.Options.TransitGatewayCIDRBlocks) != len(b.ko.Spec.Options.TransitGatewayCIDRBlocks) { delta.Add("Spec.Options.TransitGatewayCIDRBlocks", a.ko.Spec.Options.TransitGatewayCIDRBlocks, b.ko.Spec.Options.TransitGatewayCIDRBlocks) + } else if len(a.ko.Spec.Options.TransitGatewayCIDRBlocks) > 0 { + if !ackcompare.SliceStringPEqual(a.ko.Spec.Options.TransitGatewayCIDRBlocks, b.ko.Spec.Options.TransitGatewayCIDRBlocks) { + delta.Add("Spec.Options.TransitGatewayCIDRBlocks", a.ko.Spec.Options.TransitGatewayCIDRBlocks, b.ko.Spec.Options.TransitGatewayCIDRBlocks) + } } if ackcompare.HasNilDifference(a.ko.Spec.Options.VPNECMPSupport, b.ko.Spec.Options.VPNECMPSupport) { delta.Add("Spec.Options.VPNECMPSupport", a.ko.Spec.Options.VPNECMPSupport, b.ko.Spec.Options.VPNECMPSupport) diff --git a/pkg/resource/vpc/delta.go b/pkg/resource/vpc/delta.go index 65220f5f..3930f1c3 100644 --- a/pkg/resource/vpc/delta.go +++ b/pkg/resource/vpc/delta.go @@ -51,8 +51,12 @@ func newResourceDelta( delta.Add("Spec.AmazonProvidedIPv6CIDRBlock", a.ko.Spec.AmazonProvidedIPv6CIDRBlock, b.ko.Spec.AmazonProvidedIPv6CIDRBlock) } } - if !ackcompare.SliceStringPEqual(a.ko.Spec.CIDRBlocks, b.ko.Spec.CIDRBlocks) { + if len(a.ko.Spec.CIDRBlocks) != len(b.ko.Spec.CIDRBlocks) { delta.Add("Spec.CIDRBlocks", a.ko.Spec.CIDRBlocks, b.ko.Spec.CIDRBlocks) + } else if len(a.ko.Spec.CIDRBlocks) > 0 { + if !ackcompare.SliceStringPEqual(a.ko.Spec.CIDRBlocks, b.ko.Spec.CIDRBlocks) { + delta.Add("Spec.CIDRBlocks", a.ko.Spec.CIDRBlocks, b.ko.Spec.CIDRBlocks) + } } if ackcompare.HasNilDifference(a.ko.Spec.EnableDNSHostnames, b.ko.Spec.EnableDNSHostnames) { delta.Add("Spec.EnableDNSHostnames", a.ko.Spec.EnableDNSHostnames, b.ko.Spec.EnableDNSHostnames) diff --git a/pkg/resource/vpc_endpoint/delta.go b/pkg/resource/vpc_endpoint/delta.go index f3d85e98..1efae04e 100644 --- a/pkg/resource/vpc_endpoint/delta.go +++ b/pkg/resource/vpc_endpoint/delta.go @@ -76,14 +76,22 @@ func newResourceDelta( delta.Add("Spec.PrivateDNSEnabled", a.ko.Spec.PrivateDNSEnabled, b.ko.Spec.PrivateDNSEnabled) } } - if !ackcompare.SliceStringPEqual(a.ko.Spec.RouteTableIDs, b.ko.Spec.RouteTableIDs) { + if len(a.ko.Spec.RouteTableIDs) != len(b.ko.Spec.RouteTableIDs) { delta.Add("Spec.RouteTableIDs", a.ko.Spec.RouteTableIDs, b.ko.Spec.RouteTableIDs) + } else if len(a.ko.Spec.RouteTableIDs) > 0 { + if !ackcompare.SliceStringPEqual(a.ko.Spec.RouteTableIDs, b.ko.Spec.RouteTableIDs) { + delta.Add("Spec.RouteTableIDs", a.ko.Spec.RouteTableIDs, b.ko.Spec.RouteTableIDs) + } } if !reflect.DeepEqual(a.ko.Spec.RouteTableRefs, b.ko.Spec.RouteTableRefs) { delta.Add("Spec.RouteTableRefs", a.ko.Spec.RouteTableRefs, b.ko.Spec.RouteTableRefs) } - if !ackcompare.SliceStringPEqual(a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs) { + if len(a.ko.Spec.SecurityGroupIDs) != len(b.ko.Spec.SecurityGroupIDs) { delta.Add("Spec.SecurityGroupIDs", a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs) + } else if len(a.ko.Spec.SecurityGroupIDs) > 0 { + if !ackcompare.SliceStringPEqual(a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs) { + delta.Add("Spec.SecurityGroupIDs", a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs) + } } if !reflect.DeepEqual(a.ko.Spec.SecurityGroupRefs, b.ko.Spec.SecurityGroupRefs) { delta.Add("Spec.SecurityGroupRefs", a.ko.Spec.SecurityGroupRefs, b.ko.Spec.SecurityGroupRefs) @@ -95,8 +103,12 @@ func newResourceDelta( delta.Add("Spec.ServiceName", a.ko.Spec.ServiceName, b.ko.Spec.ServiceName) } } - if !ackcompare.SliceStringPEqual(a.ko.Spec.SubnetIDs, b.ko.Spec.SubnetIDs) { + if len(a.ko.Spec.SubnetIDs) != len(b.ko.Spec.SubnetIDs) { delta.Add("Spec.SubnetIDs", a.ko.Spec.SubnetIDs, b.ko.Spec.SubnetIDs) + } else if len(a.ko.Spec.SubnetIDs) > 0 { + if !ackcompare.SliceStringPEqual(a.ko.Spec.SubnetIDs, b.ko.Spec.SubnetIDs) { + delta.Add("Spec.SubnetIDs", a.ko.Spec.SubnetIDs, b.ko.Spec.SubnetIDs) + } } if !reflect.DeepEqual(a.ko.Spec.SubnetRefs, b.ko.Spec.SubnetRefs) { delta.Add("Spec.SubnetRefs", a.ko.Spec.SubnetRefs, b.ko.Spec.SubnetRefs)