Skip to content

Commit

Permalink
Merge pull request #2144 from crossplane-contrib/backport-2143-to-rel…
Browse files Browse the repository at this point in the history
…ease-0.51
  • Loading branch information
MisterMX authored Jan 17, 2025
2 parents 0d75f9e + 54a563b commit 9630015
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pkg/clients/ecs/taskdefinitionfamily/task_definition_family.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ func LateInitialize(in *ecs.TaskDefinitionFamilyParameters, resp *awsecs.Describ
}
}
if in.Volumes != nil {
for voli, vol := range in.Volumes {
awsvol := resp.TaskDefinition.Volumes[voli]
if vol.Host == nil && awsvol.Host != nil {
vol.Host = &ecs.HostVolumeProperties{
SourcePath: awsvol.Host.SourcePath,
if len(in.Volumes) == len(resp.TaskDefinition.Volumes) {
for voli, vol := range in.Volumes {
awsvol := resp.TaskDefinition.Volumes[voli]
if vol.Host == nil && awsvol.Host != nil {
vol.Host = &ecs.HostVolumeProperties{
SourcePath: awsvol.Host.SourcePath,
}
}
}
}
Expand Down Expand Up @@ -752,10 +754,16 @@ func IsUpToDate(target *ecs.TaskDefinitionFamily, out *awsecs.DescribeTaskDefini
c := GenerateTaskDefinitionFamilyFromDescribe(out).Spec.ForProvider.DeepCopy()

tags := func(a, b *ecs.Tag) bool { return aws.StringValue(a.Key) < aws.StringValue(b.Key) }
stringpointer := func(a, b *string) bool { return aws.StringValue(a) < aws.StringValue(b) }
keyValuePair := func(a, b *ecs.KeyValuePair) bool { return aws.StringValue(a.Name) < aws.StringValue(b.Name) }
secret := func(a, b *ecs.Secret) bool { return aws.StringValue(a.Name) < aws.StringValue(b.Name) }

diff := cmp.Diff(c, t,
cmpopts.EquateEmpty(),
cmpopts.SortSlices(tags),
cmpopts.SortSlices(stringpointer),
cmpopts.SortSlices(keyValuePair),
cmpopts.SortSlices(secret),
// Not present in DescribeTaskDefinitionOutput
cmpopts.IgnoreFields(ecs.TaskDefinitionFamilyParameters{}, "Region"),
cmpopts.IgnoreTypes(&xpv1.Reference{}, &xpv1.Selector{}, []xpv1.Reference{}))
Expand Down
2 changes: 2 additions & 0 deletions pkg/controller/ecs/service/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ func isUpToDate(context context.Context, service *svcapitypes.Service, output *s

tags := func(a, b *svcapitypes.Tag) bool { return aws.StringValue(a.Key) < aws.StringValue(b.Key) }
stringpointer := func(a, b *string) bool { return aws.StringValue(a) < aws.StringValue(b) }
keyValuePair := func(a, b *svcsdk.KeyValuePair) bool { return aws.StringValue(a.Name) < aws.StringValue(b.Name) }

diff := cmp.Diff(c, t,
cmpopts.EquateEmpty(),
cmpopts.SortSlices(tags),
cmpopts.SortSlices(stringpointer),
cmpopts.SortSlices(keyValuePair),
// Not present in DescribeServicesOutput
cmpopts.IgnoreFields(svcapitypes.ServiceParameters{}, "Region"),
cmpopts.IgnoreFields(svcapitypes.CustomServiceParameters{}, "Cluster"),
Expand Down

0 comments on commit 9630015

Please sign in to comment.