drop support for < kubernetes 1.13

we already depend on 1.13+ features now. 1.19 is releasing soon and 1.13 is nearing two years old.

upstream only supports 1.16+
This commit is contained in:
Benjamin Elder
2020-07-22 16:59:00 -07:00
parent 4cc1639248
commit 6e800b0e5f
3 changed files with 13 additions and 250 deletions

View File

@@ -238,17 +238,23 @@ func (c *buildContext) prePullImages(dir, containerID string) ([]string, error)
return nil, errors.New("invalid kubernetes version file")
}
// before Kubernetes v1.12.0 kubeadm requires arch specific images, instead
// later releases use manifest list images
// at node boot time we retag our images to handle this where necessary,
// so we virtually re-tag them here.
// parse version for comparison
ver, err := version.ParseSemantic(rawVersion[0])
if err != nil {
return nil, err
}
// get image tag fixing function for this version
fixRepository := repositoryCorrectorForVersion(ver, c.arch)
// For kubernetes v1.15+ (actually 1.16 alpha versions) we may need to
// drop the arch suffix from images to get the expected image
archSuffix := "-" + c.arch
fixRepository := func(repository string) string {
if strings.HasSuffix(repository, archSuffix) {
fixed := strings.TrimSuffix(repository, archSuffix)
fmt.Println("fixed: " + repository + " -> " + fixed)
repository = fixed
}
return repository
}
// correct set of built tags using the same logic we will use to rewrite
// the tags as we load the archives

View File

@@ -17,12 +17,9 @@ limitations under the License.
package nodeimage
import (
"fmt"
"path"
"strings"
"k8s.io/apimachinery/pkg/util/version"
"sigs.k8s.io/kind/pkg/exec"
)
@@ -43,35 +40,6 @@ func createFile(containerCmder exec.Cmder, filePath, contents string) error {
).Run()
}
func repositoryCorrectorForVersion(kubeVersion *version.Version, arch string) func(string) string {
archSuffix := "-" + arch
// For kubernetes v1.15+ (actually 1.16 alpha versions) we may need to
// drop the arch suffix from images to get the expected image
// for < v1.12 we need to do the opposite.
// We can accomplish this by just handling < 1.12 & >= 1.12 as we won't
// touch images that match the expectation in either case ...
if kubeVersion.LessThan(version.MustParseSemantic("v1.12.0")) {
return func(repository string) string {
if !strings.HasSuffix(repository, archSuffix) {
fixed := repository + archSuffix
fmt.Println("fixed: " + repository + " -> " + fixed)
repository = fixed
}
return repository
}
}
return func(repository string) string {
if strings.HasSuffix(repository, archSuffix) {
fixed := strings.TrimSuffix(repository, archSuffix)
fmt.Println("fixed: " + repository + " -> " + fixed)
repository = fixed
}
return repository
}
}
func findSandboxImage(images []string) string {
for _, image := range images {
// yep this seems legit