Skip to content

Commit a37f76d

Browse files
authored
Pin calico images to version 3.28.0 for k0s < 1.31 (#2701)
Pin calico 3.28.0 for k0s < 1.31
1 parent b538f6b commit a37f76d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

cmd/buildtools/k0s.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,21 @@ func getCalicoTag(opts addonComponentOptions) (string, error) {
154154
if opts.upstreamVersion.Major() == 3 && opts.upstreamVersion.Minor() == 29 {
155155
return "v3.29.3", nil
156156
}
157-
158-
constraints := mustParseSemverConstraints(latestPatchConstraint(opts.upstreamVersion))
157+
calicoVersion := getCalicoVersion(opts)
158+
constraints := mustParseSemverConstraints(latestPatchConstraint(calicoVersion))
159159
tag, err := GetGreatestGitHubTag(opts.ctx, "projectcalico", "calico", constraints)
160160
if err != nil {
161161
return "", fmt.Errorf("failed to get calico release: %w", err)
162162
}
163163
return tag, nil
164164
}
165+
166+
func getCalicoVersion(opts addonComponentOptions) *semver.Version {
167+
// TODO: remove this check once we drop support for 1.31 (needed for building previous k0s version 1.30 in the k0s-1-31 branch)
168+
// k0s versions prior to 1.31 use calico versions < 3.28,
169+
// but securebuild doesn't have versions prior to 3.28
170+
if opts.k0sVersion.LessThan(semver.MustParse("1.31")) {
171+
return semver.MustParse("3.28.0")
172+
}
173+
return opts.upstreamVersion
174+
}

0 commit comments

Comments
 (0)