Skip to content

Commit 4af29b0

Browse files
authored
Add exact match check to use specified addon versions (#8478)
Fix exact addon version matching Add exact match check before partial matching to prevent v1.7.7-eksbuild.2 from incorrectly matching v1.7.7-eksbuild.20. Include test case with multi-digit version suffix.
1 parent 84fe144 commit 4af29b0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/actions/addon/addon.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ func (a *Manager) getLatestMatchingVersion(ctx context.Context, addon *api.Addon
127127
return "", false, err
128128
}
129129

130+
if addonVersion == *addonVersionInfo.AddonVersion {
131+
return *addonVersionInfo.AddonVersion, addonVersionInfo.RequiresIamPermissions, nil
132+
}
133+
130134
if addonVersion == "latest" || strings.Contains(*addonVersionInfo.AddonVersion, addonVersion) {
131135
versions = append(versions, v)
132136
}

pkg/actions/addon/update_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ var _ = Describe("Update", func() {
8585
{
8686
AddonVersion: aws.String("v1.0.0-eksbuild.2"),
8787
},
88+
{
89+
AddonVersion: aws.String("v1.0.0-eksbuild.20"),
90+
},
8891
},
8992
},
9093
},

0 commit comments

Comments
 (0)